@@ -21,38 +21,52 @@ if {[env_var_exists_and_non_empty SYNTH_NETLIST_FILES]} {
2121 exit
2222}
2323
24- # Setup verilog include directories
25- set vIdirsArgs " "
26- if {[env_var_exists_and_non_empty VERILOG_INCLUDE_DIRS]} {
27- foreach dir $::env(VERILOG_INCLUDE_DIRS) {
28- lappend vIdirsArgs " -I$dir "
29- }
30- set vIdirsArgs [join $vIdirsArgs ]
31- }
32-
33-
34- # Read verilog files
35- foreach file $::env(VERILOG_FILES) {
36- if {[file extension $file ] == " .rtlil" } {
37- read_rtlil $file
38- } elseif {[file extension $file ] == " .json" } {
24+ # Read design
25+ if {[env_var_exists_and_non_empty RTLIL_FILE]} {
26+ # We are reading a Yosys checkpoint
27+ set file $env(RTLIL_FILE)
28+ if {[file extension $file ] == " .json" } {
3929 read_json $file
4030 } else {
41- read_verilog -defer -sv {*}$vIdirsArgs $file
31+ read_rtlil $file
32+ }
33+ } else {
34+ # We are reading Verilog sources
35+ source $::env(SCRIPTS_DIR) /synth_stdcells.tcl
36+
37+ # Setup verilog include directories
38+ set vIdirsArgs " "
39+ if {[env_var_exists_and_non_empty VERILOG_INCLUDE_DIRS]} {
40+ foreach dir $::env(VERILOG_INCLUDE_DIRS) {
41+ lappend vIdirsArgs " -I$dir "
42+ }
43+ set vIdirsArgs [join $vIdirsArgs ]
4244 }
43- }
4445
45- source $::env(SCRIPTS_DIR) /synth_stdcells.tcl
46+ if {[env_var_exists_and_non_empty SYNTH_USE_SLANG]} {
47+ # slang requires all files at once
48+ plugin -i slang
49+ yosys read_slang -D SYNTHESIS --keep-hierarchy --compat=vcs \
50+ --ignore-assertions --top $::env(DESIGN_NAME) \
51+ {*}$vIdirsArgs {*}$::env(VERILOG_FILES) {*}$::env(VERILOG_DEFINES)
52+ # Workaround for yosys-slang#119
53+ setattr -unset init
54+ } else {
55+ foreach file $::env(VERILOG_FILES) {
56+ read_verilog -defer -sv {*}$vIdirsArgs $file
57+ }
58+ }
4659
47- # Read platform specific mapfile for OPENROAD_CLKGATE cells
48- if {[env_var_exists_and_non_empty CLKGATE_MAP_FILE]} {
49- read_verilog -defer $::env(CLKGATE_MAP_FILE)
50- }
60+ # Read platform specific mapfile for OPENROAD_CLKGATE cells
61+ if {[env_var_exists_and_non_empty CLKGATE_MAP_FILE]} {
62+ read_verilog -defer $::env(CLKGATE_MAP_FILE)
63+ }
5164
52- if {[env_var_exists_and_non_empty SYNTH_BLACKBOXES]} {
53- hierarchy -check -top $::env(DESIGN_NAME)
54- foreach m $::env(SYNTH_BLACKBOXES) {
55- blackbox $m
65+ if {[env_var_exists_and_non_empty SYNTH_BLACKBOXES]} {
66+ hierarchy -check -top $::env(DESIGN_NAME)
67+ foreach m $::env(SYNTH_BLACKBOXES) {
68+ blackbox $m
69+ }
5670 }
5771}
5872
0 commit comments