diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index b1339b4928..fdedab1209 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -307,7 +307,7 @@ configuration file. | SYNTH_HIER_SEPARATOR| Separator used for the synthesis flatten stage.| .| | SYNTH_INSBUF| Insert input buffers on top-level input ports during synthesis. Useful to disable when doing parallel synthesis and concatenating netlists later as we're generating netlists of submodules.| 1| | SYNTH_KEEP_MOCKED_MEMORIES| When `SYNTH_MOCK_LARGE_MEMORIES=1`, setting this to 1, will keep mocked memories (not flattening them). This preserves some of the access logic complexity and avoids optimizations outside of the mocked memory.| 1| -| SYNTH_KEEP_MODULES| Mark modules to keep from getting removed in flattening. A name that matches no module of the design stops synthesis.| | +| SYNTH_KEEP_MODULES| Mark modules to keep from getting removed in flattening. When the whole design is synthesized, a name that matches no module of the design stops synthesis. In a partition of a parallel synthesis (SYNTH_CHECKPOINT set) a kept module of another partition is not in the partition's checkpoint, and its name is skipped.| | | SYNTH_MEMORY_MAX_BITS| Maximum number of bits for memory synthesis. Ideally, real RAM or realistic fakeram should be used for RAMs much larger than 1024 bits. To temporarily ignore the RAM concerns and investigate other aspects of the design, consider setting `SYNTH_MOCK_LARGE_MEMORIES=1`, or adjusting `SYNTH_MEMORY_MAX_BITS`. ROMs, inferred memories with no write port, are not counted: a ROM holds constants that synthesis maps to logic like any other, and it goes through the normal flow. The limit is there so that a read/write memory, which belongs in a macro (`AUTO_MEMORIES`, fakeram) or a mock, does not go undetected into flip-flops; raising it to admit a large ROM would let read/write memories of that size through too.| 4096| | SYNTH_MINIMUM_KEEP_SIZE| For hierarchical synthesis, we keep modules of larger area than given by this variable and flatten smaller modules. The area unit used is the size of a basic nand2 gate from the platform's standard cell library. The default value is platform specific.| 0| | SYNTH_MOCK_LARGE_MEMORIES| Reduce Yosys inferred memories larger than SYNTH_MEMORY_MAX_BITS to 1 row. Yosys will generally infer memories from behavioral Verilog code, whether the memories are in standalone modules or instantiated within some larger module. fakeram and empty Verilog memories(blackboxes) of memories will not be inferred memories by Yosys and are therefore not affected by this variable. This is useful and convenient to separate the concern of instantiating and placing memories from investigating other issues with a design, though it comes at the expense of the increased accuracy that using realistic fakemem would provide. Memories with a single 1 row will of course have unrealistically good timing and area characteristics, but timing will still correctly terminate in a register. Large port memories, typically register files, will still have the retain a lot of the port logic that can be useful to investigate issues. This can be especially useful during development of designs where the behavioral model comes first and suitable memories are matched up when the design RTL is stable. A typical use case would be Chisel which will generate a behavioral model for a memories with the required clocks, ports, etc. in addition to a computer readable file with the specification of the memories that is used to [automatically](https://chipyard.readthedocs.io/en/stable/Tools/Barstools.html/) match up suitable memory macros later in the flow. During an architectural screening study, a large range of memory configurations can be investigated quickly with this option, without getting bogged down in the concern of how to realize the memories in silicon for emphemral RTL configurations that exist only long enough to run through the ORFS flow to create a table of some characteristics of a design configuration.| 0| diff --git a/flow/scripts/synth.tcl b/flow/scripts/synth.tcl index f13789c04e..798320d74d 100644 --- a/flow/scripts/synth.tcl +++ b/flow/scripts/synth.tcl @@ -88,7 +88,13 @@ if { [env_var_exists_and_non_empty SYNTH_KEEP_MODULES] } { # `-module ` would error if the module doesn't exist, which # is why we use bare patterns instead. select "$module" "$module\\\$*" - if { [string trim [tee -q -s result.string select -list]] eq "" } { + # In a partition (SYNTH_CHECKPOINT set) a kept module of another + # partition is not in this partition's checkpoint: the selection is + # empty and setattr below marks nothing. + if { + ![env_var_exists_and_non_empty SYNTH_CHECKPOINT] + && [string trim [tee -q -s result.string select -list]] eq "" + } { error "SYNTH_KEEP_MODULES: no module $module in the design" } setattr -mod -set keep_hierarchy 1 diff --git a/flow/scripts/variables.json b/flow/scripts/variables.json index 50c1517476..fe8a22553e 100644 --- a/flow/scripts/variables.json +++ b/flow/scripts/variables.json @@ -1371,7 +1371,7 @@ ] }, "SYNTH_KEEP_MODULES": { - "description": "Mark modules to keep from getting removed in flattening.\nA name that matches no module of the design stops synthesis.\n", + "description": "Mark modules to keep from getting removed in flattening.\nWhen the whole design is synthesized, a name that matches no module\nof the design stops synthesis. In a partition of a parallel synthesis\n(SYNTH_CHECKPOINT set) a kept module of another partition is not in\nthe partition's checkpoint, and its name is skipped.\n", "stages": [ "synth" ] diff --git a/flow/scripts/variables.yaml b/flow/scripts/variables.yaml index 2cd82356fd..fe451c7403 100644 --- a/flow/scripts/variables.yaml +++ b/flow/scripts/variables.yaml @@ -1121,7 +1121,10 @@ DFF_LIB_FILE: SYNTH_KEEP_MODULES: description: | Mark modules to keep from getting removed in flattening. - A name that matches no module of the design stops synthesis. + When the whole design is synthesized, a name that matches no module + of the design stops synthesis. In a partition of a parallel synthesis + (SYNTH_CHECKPOINT set) a kept module of another partition is not in + the partition's checkpoint, and its name is skipped. stages: - synth SYNTH_ARGS: