Skip to content

Commit 2cbe711

Browse files
committed
Allow configuration of number of simulation steps
1 parent aafac6c commit 2cbe711

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

chipflow_lib/common/sim/main.cc.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int main(int argc, char **argv) {
7070
top.{{reset}}.set(true);
7171
{% endfor %}
7272

73-
for (int i = 0; i < 3000000; i++)
73+
for (int i = 0; i < {{num_steps}}; i++)
7474
tick();
7575

7676
close_event_log();

chipflow_lib/config_models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ class SiliconConfig(BaseModel):
1919
debug: Optional[Dict[str, bool]] = None
2020
# This is still kept around to allow forcing pad locations.
2121

22+
class SimulationConfig(BaseModel):
23+
num_steps: int = 3000000
2224

2325
class ChipFlowConfig(BaseModel):
2426
"""Root configuration for chipflow.toml."""
2527
project_name: str
2628
top: Dict[str, Any] = {}
2729
steps: Optional[Dict[str, str]] = None
2830
silicon: Optional[SiliconConfig] = None
31+
simulation: SimulationConfig = SimulationConfig()
2932
clock_domains: Optional[List[str]] = None
3033

3134

chipflow_lib/platforms/sim.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ def build(self, e, top):
237237
interfaces = [exp for exp in self._top_sim.keys()],
238238
clocks = [cxxrtlmangle(f"io${clk}$i") for clk in self._clocks.keys()],
239239
resets = [cxxrtlmangle(f"io${rst}$i") for rst in self._resets.keys()],
240-
data_load = data_load
240+
data_load = data_load,
241+
num_steps = self._config.chipflow.simulation.num_steps,
241242
),
242243
file=main_file)
243244

0 commit comments

Comments
 (0)