Changeset 65 for sources/src/global_functions.cc
- Timestamp:
- Oct 23, 2019, 12:53:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/src/global_functions.cc
r63 r65 232 232 } 233 233 234 /* 235 * Initialize the signals table 236 */ 237 create_signals_table(); 238 bind_to_table(); 239 if (dump_netlist_info) { 240 print_table(cerr); 241 cerr << endl; 242 print_table_stats(cerr); 243 cerr << endl; 244 } 245 // Init variables to be able to run combinational functions 246 pending_write_vector_capacity = get_signal_table_size(); 247 248 assert(pending_write_vector_capacity != 0); 234 /* 235 * Initialize the signals table 236 */ 237 create_signals_table (); 238 bind_to_table (); 239 if (dump_netlist_info) 240 { 241 print_table (cerr); 242 cerr << endl; 243 print_table_stats (cerr); 244 cerr << endl; 245 } 246 247 // Init variables to be able to run combinational functions 248 pending_write_vector_capacity = get_signal_table_size (); 249 250 assert(pending_write_vector_capacity != 0); 249 251 250 252 #ifdef _OPENMP 251 #define LINE_SIZE 128L 252 int malloc_size = (sizeof (pending_write_t) * (pending_write_vector_capacity + 1) + (LINE_SIZE - 1)) & ~(LINE_SIZE - 1); 253 assert((sizeof(pending_write_t) * (pending_write_vector_capacity + 1)) <= malloc_size && "bad allocation size"); 254 255 #pragma omp parallel 256 { 257 posix_memalign((void **) &pending_write_vector, LINE_SIZE, malloc_size); 258 pending_write_vector_nb = (int32_t *) &pending_write_vector[0]; 259 pending_write_vector = &pending_write_vector[1]; 260 //printf("malloc 0x%x @%p, idx @0x%x\n", malloc_size, pending_write_vector, pending_write_vector_nb); 261 *pending_write_vector_nb = 0; 262 } 253 #define LINE_SIZE 128L 254 int malloc_size = 255 (sizeof (pending_write_t) * (pending_write_vector_capacity + 1) + (LINE_SIZE - 1)) & ~(LINE_SIZE - 1); 256 assert((sizeof (pending_write_t) * (pending_write_vector_capacity + 1)) <= malloc_size && "bad allocation size"); 257 258 #pragma omp parallel 259 { 260 posix_memalign((void **)&pending_write_vector, LINE_SIZE, malloc_size); 261 pending_write_vector_nb = (int32_t *)&pending_write_vector[0]; 262 pending_write_vector = &pending_write_vector[1]; 263 printf("malloc 0x%x @%p, idx @0x%x\n", malloc_size, pending_write_vector, pending_write_vector_nb); 264 *pending_write_vector_nb = 0; 265 } 263 266 #else 264 pending_write_vector = (pending_write_vector_t) malloc(sizeof(pending_write_t) * pending_write_vector_capacity); 265 pending_write_vector_nb = (int32_t *) malloc(sizeof(int32_t)); 266 *pending_write_vector_nb = 0; 267 #endif 268 269 270 // create the clock list 271 clock_list_t clock_list; 272 create_clock_list(clock_list, get_equi_list()); 273 if (dump_netlist_info) { 274 cerr << "Clock list\n" << "----------\n" << clock_list << "\n\n"; 275 } 276 277 // Check if a clock exists in the system 278 if (clock_list.empty()) { 279 cerr << "System need a clock.\n" << 280 "Please define system clock using special type \"sc_clock\".\n"; 281 exit(22); 282 } 283 // Check if any constructor wrote into registers 284 if (*pending_write_vector_nb != 0) { 285 cerr << 286 "Error : Register/Signal writing is not allowed before sc_initialize.\n" 287 "Move initializations from constructors/sc_main to module reset sequences.\n"; 288 // we are unable to dump register(s) name(s) 289 // because the table binding is not yet completed. 290 exit(24); 291 } 292 293 string base_name = get_scheduling(scheduling_method); 294 295 if (dynamic_link_of_scheduling_code) { 296 compile_and_link(base_name.c_str()); 297 } 298 else { 299 use_static_func(); 300 } 301 302 *pending_write_vector_nb = 0; 303 304 check_all_ports(); 305 usage.start(); 267 pending_write_vector_nb = (int32_t *)malloc(sizeof(int32_t)); 268 pending_write_vector = (pending_write_vector_t) 269 malloc(sizeof (pending_write_t) * pending_write_vector_capacity); 270 #endif 271 272 // create the clock list 273 clock_list_t clock_list; 274 create_clock_list (clock_list, get_equi_list ()); 275 if (dump_netlist_info) 276 cerr << "Clock list\n" 277 << "----------\n" 278 << clock_list << "\n\n"; 279 // Check if a clock exists in the system 280 if (clock_list.empty()) { 281 cerr << "System need a clock.\n" << 282 "Please define system clock using special type \"sc_clock\".\n"; 283 exit(22); 284 } 285 286 string base_name = get_scheduling (scheduling_method); 287 288 if (dynamic_link_of_scheduling_code) 289 compile_and_link (base_name.c_str()); 290 else 291 use_static_func (); 292 293 *pending_write_vector_nb = 0; 294 295 check_all_ports (); 296 usage.start (); 306 297 307 298 if (dump_stage) {
Note: See TracChangeset
for help on using the changeset viewer.