Skip to content

Commit e8c0d23

Browse files
committed
[Yosys]: Updating Yosys execution python scripts by adding a system run command of 'write_arch_bb'
to generate the declaration of complex blocks and reading them as black box by Yosys Signed-off-by: Seyed Alireza Damghani <[email protected]>
1 parent 711cf4e commit e8c0d23

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

vtr_flow/misc/yosyslib/synthesis.tcl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ yosys -import
1818
# XXX (input circuit) is replaced with filename by the run_vtr_flow script
1919
read_verilog -sv -nolatches XXX
2020

21+
# read the custom complex blocks in the architecture
22+
read_verilog -lib CCC
23+
2124
# These commands follow the generic `synth'
2225
# command script inside Yosys
2326
# The -libdir argument allows Yosys to search the current
@@ -64,7 +67,7 @@ opt -full
6467
techmap
6568
opt -fast
6669

67-
# We read the definitions for all the VTR primitives
70+
# read the definitions for all the VTR primitives
6871
# as blackboxes
6972
read_verilog -lib TTT/adder.v
7073
read_verilog -lib TTT/multiply.v

vtr_flow/scripts/python_libs/vtr/paths.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
yosys_lib_path = vtr_flow_path / "misc" / "yosyslib"
2323
yosys_script_path = yosys_lib_path / "synthesis.tcl"
2424

25+
# ARCHFPGA paths
26+
archfpga_path = root_path / "ArchFPGA"
27+
write_arch_bb_exe_path = root_path / "build/libs/libarchfpga/write_arch_bb"
28+
2529
# ABC paths
2630
abc_path = root_path / "abc"
2731
abc_exe_path = abc_path / "abc"

vtr_flow/scripts/python_libs/vtr/yosys/yosys.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"DPRAM": "dual_port_ram.v",
2626
"SPRAMR": "spram_rename.v",
2727
"DPRAMR": "dpram_rename.v",
28+
"DSPBB": "arch_dsps.v",
2829
}
2930

3031

@@ -58,6 +59,7 @@ def init_script_file(
5859
yosys_dpram_full_path,
5960
yosys_spram_rename_full_path,
6061
yosys_dpram_rename_full_path,
62+
architecture_dsp_full_path,
6163
circuit_list,
6264
output_netlist,
6365
memory_addr_width,
@@ -81,6 +83,7 @@ def init_script_file(
8183
"DDD": yosys_dpram_full_path,
8284
"SSR": yosys_spram_rename_full_path,
8385
"DDR": yosys_dpram_rename_full_path,
86+
"CCC": architecture_dsp_full_path,
8487
"TTT": str(vtr.paths.yosys_lib_path),
8588
"ZZZ": output_netlist,
8689
},
@@ -99,7 +102,7 @@ def init_script_file(
99102
vtr.file_replace(yosys_dpram_rename_full_path, {"PPP": memory_addr_width})
100103

101104

102-
# pylint: disable=too-many-arguments, too-many-locals
105+
# pylint: disable=too-many-arguments, too-many-locals, too-many-statements
103106
def run(
104107
architecture_file,
105108
circuit_file,
@@ -202,6 +205,21 @@ def run(
202205
shutil.copyfile(yosys_base_spram_rename, yosys_spram_rename_full_path)
203206
shutil.copyfile(yosys_base_dpram_rename, yosys_dpram_rename_full_path)
204207

208+
write_arch_bb_exec = str(vtr.paths.write_arch_bb_exe_path)
209+
architecture_dsp_full_path = str(vtr.paths.scripts_path / temp_dir / YOSYS_LIB_FILES["DSPBB"])
210+
211+
# executing write_arch_bb to extract the black box definitions of the given arch file
212+
command_runner.run_system_command(
213+
[
214+
write_arch_bb_exec,
215+
str(vtr.paths.scripts_path / architecture_file),
216+
architecture_dsp_full_path,
217+
],
218+
temp_dir=temp_dir,
219+
log_filename="write_arch_bb.log",
220+
indent_depth=1,
221+
)
222+
205223
# Create a list showing all (.v) and (.vh) files
206224
circuit_list = create_circuits_list(circuit_file, include_files)
207225

@@ -212,6 +230,7 @@ def run(
212230
yosys_dpram_full_path,
213231
yosys_spram_rename_full_path,
214232
yosys_dpram_rename_full_path,
233+
architecture_dsp_full_path,
215234
circuit_list,
216235
output_netlist.name,
217236
vtr.determine_memory_addr_width(str(architecture_file)),
@@ -236,4 +255,4 @@ def run(
236255
)
237256

238257

239-
# pylint: enable=too-many-arguments, too-many-locals
258+
# pylint: enable=too-many-arguments, too-many-locals, too-many-statements

0 commit comments

Comments
 (0)