@@ -52,75 +52,12 @@ source $::env(SCRIPTS_DIR)/memories/check_blackboxed.tcl
5252source $::env(SCRIPTS_DIR) /memories/max_bits.tcl
5353source $::env(SCRIPTS_DIR) /memories/drop_parameters.tcl
5454
55- proc auto_memories_areas { } {
56- if { ![env_var_equals AUTO_MEMORIES 1] } {
57- return {}
58- }
59- set f " $::env(RESULTS_DIR) /memories/blackboxes.txt"
60- if { ![file exists $f ] } {
61- error " AUTO_MEMORIES=1 but $f is missing;\
62- the do-auto-memories step must run before synthesis"
63- }
64- set fh [open $f r]
65- set content [string map {\r " " } [read $fh ]]
66- close $fh
67- set areas [dict create]
68- foreach line [split $content " \n " ] {
69- if { [string trim $line ] == " " } {
70- continue
71- }
72- set fields [regexp -all -inline {\S+} $line ]
73- if {
74- [llength $fields ] != 2
75- || ![string is double -strict [lindex $fields 1]]
76- } {
77- error " $f : expected `<module> <area>`, got `$line `"
78- }
79- dict set areas {*}$fields
80- }
81- return $areas
82- }
83-
8455proc auto_memories_blackboxes { } {
8556 return [dict keys [auto_memories_areas]]
8657}
8758
88- # AUTO_MEMORIES: register files inlined (AUTO_MEMORIES_REGFILES not in
89- # AUTO_MEMORIES_MACRO_PLACE): the RTL module is read as a blackbox and its
90- # generated netlist of standard cells is read in its place.
91- proc auto_memories_inline { } {
92- if { ![env_var_equals AUTO_MEMORIES 1] } {
93- return {}
94- }
95- set f " $::env(RESULTS_DIR) /memories/inline.txt"
96- if { ![file exists $f ] } {
97- return {}
98- }
99- set fh [open $f r]
100- set content [read $fh ]
101- close $fh
102- return [regexp -all -inline {\S+} $content ]
103- }
104-
105- # AUTO_MEMORIES: the RAMs the register file wrappers instantiate as
106- # macros. They are in blackboxes.txt but are no module of the sources:
107- # they arrive with the wrappers' netlists, after read_slang.
108- proc auto_memories_regfile_cores { } {
109- if { ![env_var_equals AUTO_MEMORIES 1] } {
110- return {}
111- }
112- set f " $::env(RESULTS_DIR) /memories/regfile_cores.txt"
113- if { ![file exists $f ] } {
114- return {}
115- }
116- set fh [open $f r]
117- set content [read $fh ]
118- close $fh
119- return [regexp -all -inline {\S+} $content ]
120- }
121-
12259proc read_auto_memories_inline { } {
123- foreach m [auto_memories_inline ] {
60+ foreach m [auto_memories_names inline.txt ] {
12461 # A parameterized RTL module (ibex_register_file_ff #(...)) is
12562 # instantiated with parameters the generated netlist has no
12663 # declaration for, which hierarchy refuses. The netlist is that module
@@ -187,15 +124,15 @@ proc read_design_sources { } {
187124
188125 # Blackbox AUTO_MEMORIES-detected memory modules so their generated
189126 # liberty view wins over their behavioral bodies.
190- foreach m [concat [auto_memories_blackboxes] [auto_memories_inline ]] {
127+ foreach m [concat [auto_memories_blackboxes] [auto_memories_names inline.txt ]] {
191128 lappend slang_args --blackboxed-module " $m "
192129 }
193130
194131 # Add user arguments
195132 lappend slang_args {*}$::env(SYNTH_SLANG_ARGS)
196133
197134 yosys read_slang {*}$slang_args
198- set cores [auto_memories_regfile_cores ]
135+ set cores [auto_memories_names regfile_cores.txt ]
199136 set sourced {}
200137 foreach m [auto_memories_blackboxes] {
201138 if { [lsearch -exact $cores $m ] < 0 } {
@@ -226,7 +163,7 @@ proc read_design_sources { } {
226163 if { [env_var_exists_and_non_empty SYNTH_BLACKBOXES] } {
227164 error " Non-empty SYNTH_BLACKBOXES unsupported with HDL frontend \" verific\" "
228165 }
229- if { [llength [concat [auto_memories_blackboxes] [auto_memories_inline ]]] > 0 } {
166+ if { [llength [concat [auto_memories_blackboxes] [auto_memories_names inline.txt ]]] > 0 } {
230167 error " AUTO_MEMORIES unsupported with HDL frontend \" $::env(SYNTH_HDL_FRONTEND) \" "
231168 }
232169 } elseif { ![env_var_exists_and_non_empty SYNTH_HDL_FRONTEND] } {
@@ -262,7 +199,7 @@ proc read_design_sources { } {
262199 }
263200 hierarchy -check -top $::env(DESIGN_NAME)
264201 }
265- if { [llength [auto_memories_inline ]] > 0 } {
202+ if { [llength [auto_memories_names inline.txt ]] > 0 } {
266203 read_auto_memories_inline
267204 hierarchy -check -top $::env(DESIGN_NAME)
268205 }
0 commit comments