Skip to content

Commit 0ea750c

Browse files
authored
Merge pull request #1996 from sdamghan/fix_yosys_odin_dsp
Specify used hard blocks to print related models in the BLIF generation phase
2 parents 829c06d + 53ceccb commit 0ea750c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

ODIN_II/SRC/BLIFReader.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
333333
vtr::free(mappings);
334334
mappings = NULL;
335335

336+
t_model* hb_model = NULL;
336337
nnode_t* new_node = allocate_nnode(my_location);
337338

338339
// Name the node subcircuit_name~hard_block_number so that the name is unique.
@@ -371,6 +372,11 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
371372
new_node->type = HARD_IP;
372373
/* specify node name */
373374
odin_sprintf(new_name, "\\%s~%ld", subcircuit_stripped_name, hard_block_number - 1);
375+
/* Detect used hard block for the blif generation */
376+
hb_model = find_hard_block(subcircuit_stripped_name);
377+
if (hb_model) {
378+
hb_model->used = 1;
379+
}
374380
} else {
375381
error_message(PARSE_BLIF, unknown_location,
376382
"Unsupported subcircuit type (%s) in BLIF file.\n", subcircuit_name);
@@ -449,7 +455,8 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
449455
|| new_node->type == ROM
450456
|| new_node->type == SPRAM
451457
|| new_node->type == DPRAM
452-
|| new_node->type == MEMORY)
458+
|| new_node->type == MEMORY
459+
|| hb_model != NULL)
453460
? get_hard_block_port_name(mapping)
454461
: NULL;
455462

@@ -470,7 +477,8 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
470477
|| new_node->type == ROM
471478
|| new_node->type == SPRAM
472479
|| new_node->type == DPRAM
473-
|| new_node->type == MEMORY)
480+
|| new_node->type == MEMORY
481+
|| hb_model != NULL)
474482
? get_hard_block_port_name(mapping)
475483
: NULL;
476484

ODIN_II/SRC/hard_blocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ void instantiate_hard_block(nnode_t* node, short mark, netlist_t* /*netlist*/) {
273273
/* Give names to the output pins */
274274
for (i = 0; i < node->num_output_pins; i++) {
275275
if (node->output_pins[i]->name == NULL)
276-
node->output_pins[i]->name = make_full_ref_name(node->name, NULL, NULL, node->output_pins[i]->mapping, -1);
276+
node->output_pins[i]->name = make_full_ref_name(node->name, NULL, NULL, node->output_pins[i]->mapping, (configuration.elaborator_type == elaborator_e::_YOSYS) ? i : -1);
277277

278278
index++;
279279
if (node->output_port_sizes[port] == index) {

0 commit comments

Comments
 (0)