Skip to content

Commit 3a7e591

Browse files
committed
[Infra]: add "decode_names" to Yosys+Odin-II's options to use hierarchical naming style
instead of node-type-encoded naming, when extracting names from Yosys coarse-grained BLIF file Signed-off-by: Seyed Alireza Damghani <[email protected]>
1 parent d256cd3 commit 3a7e591

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed

ODIN_II/SRC/BLIFReader.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,10 @@ void BLIF::Reader::create_hard_block_nodes(hard_block_models* models) {
483483
output_nets_hash->add(name, new_net);
484484
}
485485

486-
if (!configuration.coarsen || new_node->type == SPRAM || new_node->type == DPRAM) {
486+
if (!configuration.coarsen
487+
|| !configuration.decode_names
488+
|| new_node->type == SPRAM
489+
|| new_node->type == DPRAM) {
487490
// Name the node subcircuit_name~hard_block_number so that the name is unique.
488491
odin_sprintf(buffer, "%s~%ld", subcircuit_name, hard_block_number++);
489492
new_node->name = make_full_ref_name(buffer, NULL, NULL, NULL, -1);

ODIN_II/SRC/include/config_t.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ struct config_t {
1717
bool fflegalize; // Legalize DFFs by making them rising edge
1818
bool coarsen; // Specify if the input BLIF is coarse-grain
1919
bool show_yosys_log; // Print Yosys logs into the standard output stream
20+
bool decode_names; // Extracting hierarchical information from Yosys coarse-grained BLIF file for signal naming
2021

2122
bool output_ast_graphs; // switch that outputs ast graphs per node for use with GRaphViz tools
2223
bool output_netlist_graphs; // switch that outputs netlist graphs per node for use with GraphViz tools

ODIN_II/SRC/include/odin_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ struct global_args_t {
113113
argparse::ArgValue<bool> fflegalize; // makes flip-flops rising edge sensitive
114114
argparse::ArgValue<bool> coarsen; // tells Odin-II that the input blif is coarse-grain
115115
argparse::ArgValue<bool> show_yosys_log; // Show Yosys output logs into the standard output stream
116+
argparse::ArgValue<bool> decode_names; // Extracting hierarchical information from Yosys coarse-grained BLIF file for signal naming
116117

117118
argparse::ArgValue<std::string> adder_def; //DEPRECATED
118119

ODIN_II/SRC/odin_ii.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,12 @@ void get_options(int argc, char** argv) {
533533
.help("TCL file")
534534
.metavar("TCL_FILE");
535535

536+
ext_elaborator_group.add_argument(global_args.decode_names, "--decode_names")
537+
.help("Enable extracting hierarchical information from Yosys coarse-grained BLIF file for signal naming")
538+
.default_value("false")
539+
.action(argparse::Action::STORE_TRUE)
540+
.metavar("DECODE_NAMES");
541+
536542
auto& other_grp = parser.add_argument_group("other options");
537543

538544
other_grp.add_argument(global_args.show_help, "-h")
@@ -752,6 +758,10 @@ void get_options(int argc, char** argv) {
752758
configuration.elaborator_type = elaborator_e::_YOSYS;
753759
}
754760

761+
if (global_args.decode_names.provenance() == argparse::Provenance::SPECIFIED) {
762+
configuration.decode_names = global_args.decode_names;
763+
}
764+
755765
if (global_args.write_netlist_as_dot.provenance() == argparse::Provenance::SPECIFIED) {
756766
configuration.output_netlist_graphs = global_args.write_netlist_as_dot;
757767
}
@@ -809,6 +819,7 @@ void set_default_config() {
809819
configuration.coarsen = false;
810820
configuration.fflegalize = false;
811821
configuration.show_yosys_log = false;
822+
configuration.decode_names = false;
812823
configuration.tcl_file = "";
813824
configuration.output_file_type = file_type_e::_BLIF;
814825
configuration.elaborator_type = elaborator_e::_ODIN;

vtr_flow/scripts/python_libs/vtr/odin/odin.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def init_config_file(
8787
config_file.write(odin_config_full_path)
8888

8989

90-
# pylint: disable=too-many-arguments, too-many-locals
90+
# pylint: disable=too-many-arguments, too-many-locals, too-many-branches
9191
def run(
9292
architecture_file,
9393
circuit_file,
@@ -190,6 +190,11 @@ def run(
190190
cmd = [odin_exec]
191191
use_odin_simulation = False
192192

193+
# handling the Odin-II decode_name flag for Yosys coarse-grained BLIFs
194+
if not odin_args["encode_names"]:
195+
odin_args["decode_names"] = True
196+
del odin_args["encode_names"]
197+
193198
if "use_odin_simulation" in odin_args:
194199
use_odin_simulation = True
195200
del odin_args["use_odin_simulation"]
@@ -245,4 +250,4 @@ def run(
245250
)
246251

247252

248-
# pylint: enable=too-many-arguments, too-many-locals
253+
# pylint: enable=too-many-arguments, too-many-locals, too-many-branches

vtr_flow/scripts/run_vtr_flow.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,14 @@ def vtr_command_argparser(prog=None):
360360
help="Make flip-flops rising edge for coarse-grain input BLIFs in the techmap"
361361
+ "(Odin-II synthesis flow generates rising edge FFs by default)",
362362
)
363+
odin.add_argument(
364+
"-encode_names",
365+
default=False,
366+
action="store_true",
367+
dest="encode_names",
368+
help="Enable Odin-II utilization of operation-type-encoded naming style for Yosys"
369+
+ " coarse-grained RTLIL nodes",
370+
)
363371
#
364372
# YOSYS arguments
365373
#
@@ -673,6 +681,7 @@ def process_odin_args(args):
673681
odin_args["adder_type"] = args.adder_type
674682
odin_args["top_module"] = args.top_module
675683
odin_args["elaborator"] = args.elaborator
684+
odin_args["encode_names"] = args.encode_names
676685

677686
if args.adder_cin_global:
678687
odin_args["adder_cin_global"] = True

0 commit comments

Comments
 (0)