Skip to content

Commit 9d98e8f

Browse files
povikoharboe
authored andcommitted
synth: support SYNTH_MOCK_LARGE_MEMORIES
Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 06042cd commit 9d98e8f

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

flow/scripts/synth.tcl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,19 @@ if { !$::env(SYNTH_HIERARCHICAL) } {
5757

5858

5959
if { $::env(SYNTH_MOCK_LARGE_MEMORIES) } {
60-
foreach module [get_modules] {
61-
foreach mem [get_memories $module] {
62-
set size [memory_get $module $mem SIZE]
63-
64-
if {$size > $::env(SYNTH_MEMORY_MAX_BITS)} {
65-
memory_set $module $mem SIZE 1
66-
puts "Shrunk memory $mem in module $module from $size to 1"
67-
}
60+
memory_collect
61+
foreach path [tee -q -s result.string select -list t:\$mem_v2] {
62+
set index [string first "/" $path]
63+
set module [string range $path 0 [expr {$index - 1}]]
64+
set instance [string range $path [expr {$index + 1}] end]
65+
66+
set width [rtlil::get_param -uint $module $instance WIDTH]
67+
set size [rtlil::get_param -uint $module $instance SIZE]
68+
set nbits [expr $width * $size]
69+
puts "Memory $path has dimensions $size x $width = $nbits"
70+
if {$nbits > $::env(SYNTH_MEMORY_MAX_BITS)} {
71+
rtlil::set_param -uint $module $instance SIZE 1
72+
puts "Shrunk memory $path from $size rows to 1"
6873
}
6974
}
7075
}

0 commit comments

Comments
 (0)