@@ -358,22 +358,27 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
358
358
char new_name[READ_BLIF_BUFFER];
359
359
vtr::free (new_node->name );
360
360
/* in case of weird names, need to add memories manually */
361
- if (ports->count == 5 ) {
361
+ int sc_spot = -1 ;
362
+ if (std::string (subcircuit_stripped_name).find (SINGLE_PORT_RAM_string, 0 ) != std::string::npos) {
362
363
/* specify node type */
363
364
new_node->type = yosys_subckt_strmap[SINGLE_PORT_RAM_string];
364
365
/* specify node name */
365
366
odin_sprintf (new_name, " \\ %s~%ld" , SINGLE_PORT_RAM_string, hard_block_number - 1 );
366
- new_node->name = make_full_ref_name (new_name, NULL , NULL , NULL , -1 );
367
- } else if (ports->count == 9 ) {
367
+ } else if (std::string (subcircuit_stripped_name).find (DUAL_PORT_RAM_string, 0 ) != std::string::npos) {
368
368
/* specify node type */
369
369
new_node->type = yosys_subckt_strmap[DUAL_PORT_RAM_string];
370
370
/* specify node name */
371
371
odin_sprintf (new_name, " \\ %s~%ld" , DUAL_PORT_RAM_string, hard_block_number - 1 );
372
- new_node->name = make_full_ref_name (new_name, NULL , NULL , NULL , -1 );
372
+ } else if ((sc_spot = sc_lookup_string (hard_block_names, subcircuit_stripped_name)) != -1 ) {
373
+ /* specify node type */
374
+ new_node->type = HARD_IP;
375
+ /* specify node name */
376
+ odin_sprintf (new_name, " \\ %s~%ld" , subcircuit_stripped_name, hard_block_number - 1 );
373
377
} else {
374
378
error_message (PARSE_BLIF, unknown_location,
375
- " Unsupported sub-circuit type (%s) in BLIF file.\n " , subcircuit_name);
379
+ " Unsupported subcircuit type (%s) in BLIF file.\n " , subcircuit_name);
376
380
}
381
+ new_node->name = make_full_ref_name (new_name, NULL , NULL , NULL , -1 );
377
382
}
378
383
379
384
if (new_node->type == BRAM) {
@@ -410,7 +415,7 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
410
415
411
416
if (!model)
412
417
error_message (PARSE_BLIF, unknown_location,
413
- " Failed to retrieve sub-circuit model (%s)\n " , subcircuit_name);
418
+ " Failed to retrieve subcircuit model (%s)\n " , subcircuit_name);
414
419
415
420
/* Add input and output ports to the new node. */
416
421
else {
@@ -481,7 +486,7 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
481
486
}
482
487
483
488
// Create a fake ast node.
484
- if (!configuration.coarsen ) {
489
+ if (!configuration.coarsen || new_node-> type == HARD_IP ) {
485
490
new_node->related_ast_node = create_node_w_type (HARD_BLOCK, my_location);
486
491
new_node->related_ast_node ->children = (ast_node_t **)vtr::calloc (1 , sizeof (ast_node_t *));
487
492
new_node->related_ast_node ->identifier_node = create_tree_node_id (vtr::strdup (subcircuit_name), my_location);
0 commit comments