Skip to content

Commit af2d2e3

Browse files
committed
[Yosys+Odin]: - pass user-defined DSPs untouched to the partial mapping phase
- create a fake ast node for user-defined DSPs in the BLIF Reader Signed-off-by: Seyed Alireza Damghani <[email protected]>
1 parent 88ad9b7 commit af2d2e3

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

ODIN_II/SRC/BLIFElaborate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ void blif_elaborate_node(nnode_t* node, short traverse_number, netlist_t* netlis
301301
case PAD_NODE: //fallthrough
302302
case INPUT_NODE: //fallthrough
303303
case OUTPUT_NODE: //fallthrough
304+
case HARD_IP: //fallthrough
304305
case BUF_NODE: //fallthrough
305306
case BITWISE_NOT: //fallthrough
306307
case BITWISE_AND: //fallthrough
@@ -312,7 +313,6 @@ void blif_elaborate_node(nnode_t* node, short traverse_number, netlist_t* netlis
312313
/* some are already resolved for this phase */
313314
break;
314315
}
315-
case HARD_IP:
316316
case ADDER_FUNC:
317317
case CARRY_FUNC:
318318
case CLOCK_NODE:

ODIN_II/SRC/BLIFReader.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,22 +358,27 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
358358
char new_name[READ_BLIF_BUFFER];
359359
vtr::free(new_node->name);
360360
/* in case of weird names, need to add memories manually */
361-
if (ports->count == 5) {
361+
int sc_spot = -1;
362+
if ((sc_spot = sc_lookup_string(hard_block_names, subcircuit_name)) != -1) {
363+
/* specify node type */
364+
new_node->type = HARD_IP;
365+
/* specify node name */
366+
odin_sprintf(new_name, "\\%s~%ld", subcircuit_name, hard_block_number - 1);
367+
} else if (ports->count == 5) {
362368
/* specify node type */
363369
new_node->type = yosys_subckt_strmap[SINGLE_PORT_RAM_string];
364370
/* specify node name */
365371
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);
367372
} else if (ports->count == 9) {
368373
/* specify node type */
369374
new_node->type = yosys_subckt_strmap[DUAL_PORT_RAM_string];
370375
/* specify node name */
371376
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);
373377
} else {
374378
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);
376380
}
381+
new_node->name = make_full_ref_name(new_name, NULL, NULL, NULL, -1);
377382
}
378383

379384
if (new_node->type == BRAM) {
@@ -410,7 +415,7 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
410415

411416
if (!model)
412417
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);
414419

415420
/* Add input and output ports to the new node. */
416421
else {
@@ -481,7 +486,7 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
481486
}
482487

483488
// Create a fake ast node.
484-
if (!configuration.coarsen) {
489+
if (!configuration.coarsen || new_node->type == HARD_IP) {
485490
new_node->related_ast_node = create_node_w_type(HARD_BLOCK, my_location);
486491
new_node->related_ast_node->children = (ast_node_t**)vtr::calloc(1, sizeof(ast_node_t*));
487492
new_node->related_ast_node->identifier_node = create_tree_node_id(vtr::strdup(subcircuit_name), my_location);

0 commit comments

Comments
 (0)