Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions flow/scripts/synth_preamble.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ proc read_design_sources { } {
lappend slang_args -G "$key=$value"
}

# Automatically blackbox macros from ADDITIONAL_LIBS so that
# any competing Verilog definitions in the source files are
# ignored in favor of the liberty view, consistent with the
# behavior of the builtin Verilog frontend.
if { [env_var_exists_and_non_empty ADDITIONAL_LIBS] } {
foreach m [get_liberty_cell_names $::env(ADDITIONAL_LIBS)] {
lappend slang_args --blackboxed-module "$m"
}
}

# Apply module blackboxing based on module names as they appear
# in the input, that is before any module name mangling done
# by elaboration and synthesis
Expand Down
15 changes: 15 additions & 0 deletions flow/scripts/util.tcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Extract cell names from liberty files by parsing "cell(...)" declarations
proc get_liberty_cell_names { lib_files } {
set cell_names [list]
foreach lib $lib_files {
set fid [open $lib r]
while { [gets $fid line] >= 0 } {
if { [regexp {^\s*cell\s*\(\s*"?([^")\s]+)"?\s*\)} $line -> cell_name] } {
lappend cell_names $cell_name
}
}
close $fid
}
return $cell_names
}

proc log_cmd { cmd args } {
# log the command, escape arguments with spaces
set log_cmd "$cmd[join [lmap arg $args { format " %s" [expr { [string match {* *} $arg] ? "\"$arg\"" : "$arg" }] }] ""]" ;# tclint-disable-line line-length
Expand Down