Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion flow/scripts/synth.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,20 @@ if { $::env(SYNTH_GUT) } {

if { [env_var_exists_and_non_empty SYNTH_KEEP_MODULES] } {
foreach module $::env(SYNTH_KEEP_MODULES) {
select -module $module
# Two patterns so both frontends work:
# - `$module` matches the bare name produced by verilog.
# - `$module\$*` matches the `$`-suffixed canonical names the
# slang frontend generates for parameterized instances
# (e.g. `\foo$1`); yosys's match_ids retries the pattern with
# the id's leading `\` stripped, so no `\`-prefix is needed
# here -- see tools/yosys/passes/cmds/select.cc match_ids().
# Multiple patterns on one `select` are unioned at the end of the
# command (select.cc: `while (work_stack.size() > 1) union`), so
# when a pattern matches nothing it degrades to a warning and the
# other pattern still applies -- no regression for non-slang.
# `-module <name>` would error if the module doesn't exist, which
# is why we use bare patterns instead.
select "$module" "$module\\\$*"
Comment thread
maliberty marked this conversation as resolved.
Comment thread
maliberty marked this conversation as resolved.
setattr -mod -set keep_hierarchy 1
select -clear
}
Expand Down