Skip to content

Commit cd524b8

Browse files
authored
Merge pull request #845 from zapta/main
Added apio.ini option gtkwave-extra-options.
2 parents e330a73 + 934d4e8 commit cd524b8

File tree

12 files changed

+85
-39
lines changed

12 files changed

+85
-39
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
"pytest",
171171
"pyxx",
172172
"rankdir",
173+
"rcvar",
173174
"readmemh",
174175
"realpath",
175176
"recursesubdirs",

apio/common/proto/apio.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ message ApioEnvParams {
111111
repeated string yosys_synth_extra_options = 5;
112112
// The optional value of 'nextpnr-extra-options' option in apio.ini.
113113
repeated string nextpnr_extra_options = 6;
114+
// The optional value of 'gtkwave-extra-options' option in apio.ini.
115+
repeated string gtkwave_extra_options = 7;
114116
// The optional value of the 'constraint-file' option in apio.ini.
115-
optional string constraint_file = 7 [default = ''];
117+
optional string constraint_file = 8 [default = ''];
116118
}
117119

118120
// Lint target specific params.

apio/common/proto/apio_pb2.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@
2727

2828

2929

30-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\napio.proto\x12\x11\x61pio.common.proto\"+\n\rIce40FpgaInfo\x12\x0c\n\x04type\x18\x01 \x02(\t\x12\x0c\n\x04pack\x18\x02 \x02(\t\"9\n\x0c\x45\x63p5FpgaInfo\x12\x0c\n\x04type\x18\x04 \x02(\t\x12\x0c\n\x04pack\x18\x05 \x02(\t\x12\r\n\x05speed\x18\x06 \x02(\t\"\x1f\n\rGowinFpgaInfo\x12\x0e\n\x06\x66\x61mily\x18\x04 \x02(\t\"\xda\x01\n\x08\x46pgaInfo\x12\x0f\n\x07\x66pga_id\x18\x01 \x02(\t\x12\x10\n\x08part_num\x18\x02 \x02(\t\x12\x0c\n\x04size\x18\x03 \x02(\t\x12\x31\n\x05ice40\x18\n \x01(\x0b\x32 .apio.common.proto.Ice40FpgaInfoH\x00\x12/\n\x04\x65\x63p5\x18\x0b \x01(\x0b\x32\x1f.apio.common.proto.Ecp5FpgaInfoH\x00\x12\x31\n\x05gowin\x18\x0c \x01(\x0b\x32 .apio.common.proto.GowinFpgaInfoH\x00\x42\x06\n\x04\x61rch\"I\n\tVerbosity\x12\x12\n\x03\x61ll\x18\x01 \x01(\x08:\x05\x66\x61lse\x12\x14\n\x05synth\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x12\n\x03pnr\x18\x03 \x01(\x08:\x05\x66\x61lse\"\xd9\x01\n\x0b\x45nvironment\x12\x13\n\x0bplatform_id\x18\x01 \x02(\t\x12\x12\n\nis_windows\x18\x02 \x02(\x08\x12\x36\n\rterminal_mode\x18\x03 \x02(\x0e\x32\x1f.apio.common.proto.TerminalMode\x12\x12\n\ntheme_name\x18\x04 \x02(\t\x12\x13\n\x0b\x64\x65\x62ug_level\x18\x05 \x02(\x05\x12\x12\n\nyosys_path\x18\x06 \x02(\t\x12\x14\n\x0ctrellis_path\x18\x07 \x02(\t\x12\x16\n\x0escons_shell_id\x18\x08 \x02(\t\"\xb5\x01\n\rApioEnvParams\x12\x10\n\x08\x65nv_name\x18\x01 \x02(\t\x12\x10\n\x08\x62oard_id\x18\x02 \x02(\t\x12\x12\n\ntop_module\x18\x03 \x02(\t\x12\x0f\n\x07\x64\x65\x66ines\x18\x04 \x03(\t\x12!\n\x19yosys_synth_extra_options\x18\x05 \x03(\t\x12\x1d\n\x15nextpnr_extra_options\x18\x06 \x03(\t\x12\x19\n\x0f\x63onstraint_file\x18\x07 \x01(\t:\x00\"\xc6\x01\n\nLintParams\x12\x14\n\ntop_module\x18\x01 \x01(\t:\x00\x12\x1c\n\rverilator_all\x18\x02 \x01(\x08:\x05\x66\x61lse\x12!\n\x12verilator_no_style\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x1a\n\x12verilator_no_warns\x18\x04 \x03(\t\x12\x17\n\x0fverilator_warns\x18\x05 \x03(\t\x12\x16\n\x07nosynth\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\x14\n\x05novlt\x18\x07 \x01(\x08:\x05\x66\x61lse\"o\n\x0bGraphParams\x12\x37\n\x0boutput_type\x18\x01 \x02(\x0e\x32\".apio.common.proto.GraphOutputType\x12\x12\n\ntop_module\x18\x02 \x01(\t\x12\x13\n\x0bopen_viewer\x18\x03 \x02(\x08\"d\n\tSimParams\x12\x18\n\x0etestbench_path\x18\x01 \x01(\t:\x00\x12\x11\n\tforce_sim\x18\x02 \x02(\x08\x12\x12\n\nno_gtkwave\x18\x03 \x02(\x08\x12\x16\n\x0e\x64\x65tach_gtkwave\x18\x04 \x02(\x08\"B\n\x0e\x41pioTestParams\x12\x18\n\x0etestbench_path\x18\x01 \x01(\t:\x00\x12\x16\n\x0e\x64\x65\x66\x61ult_option\x18\x02 \x02(\x08\"&\n\x0cUploadParams\x12\x16\n\x0eprogrammer_cmd\x18\x01 \x01(\t\"\x8b\x02\n\x0cTargetParams\x12-\n\x04lint\x18\n \x01(\x0b\x32\x1d.apio.common.proto.LintParamsH\x00\x12/\n\x05graph\x18\x0b \x01(\x0b\x32\x1e.apio.common.proto.GraphParamsH\x00\x12+\n\x03sim\x18\x0c \x01(\x0b\x32\x1c.apio.common.proto.SimParamsH\x00\x12\x31\n\x04test\x18\r \x01(\x0b\x32!.apio.common.proto.ApioTestParamsH\x00\x12\x31\n\x06upload\x18\x0e \x01(\x0b\x32\x1f.apio.common.proto.UploadParamsH\x00\x42\x08\n\x06target\"\xcd\x02\n\x0bSconsParams\x12\x11\n\ttimestamp\x18\x01 \x02(\t\x12)\n\x04\x61rch\x18\x02 \x02(\x0e\x32\x1b.apio.common.proto.ApioArch\x12.\n\tfpga_info\x18\x03 \x02(\x0b\x32\x1b.apio.common.proto.FpgaInfo\x12/\n\tverbosity\x18\x04 \x01(\x0b\x32\x1c.apio.common.proto.Verbosity\x12\x33\n\x0b\x65nvironment\x18\x05 \x02(\x0b\x32\x1e.apio.common.proto.Environment\x12\x39\n\x0f\x61pio_env_params\x18\x06 \x02(\x0b\x32 .apio.common.proto.ApioEnvParams\x12/\n\x06target\x18\x07 \x01(\x0b\x32\x1f.apio.common.proto.TargetParams*@\n\x08\x41pioArch\x12\x14\n\x10\x41RCH_UNSPECIFIED\x10\x00\x12\t\n\x05ICE40\x10\x01\x12\x08\n\x04\x45\x43P5\x10\x02\x12\t\n\x05GOWIN\x10\x03*_\n\x0cTerminalMode\x12\x18\n\x14TERMINAL_UNSPECIFIED\x10\x00\x12\x11\n\rAUTO_TERMINAL\x10\x01\x12\x12\n\x0e\x46ORCE_TERMINAL\x10\x02\x12\x0e\n\nFORCE_PIPE\x10\x03*B\n\x0fGraphOutputType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03SVG\x10\x01\x12\x07\n\x03PNG\x10\x02\x12\x07\n\x03PDF\x10\x03')
30+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\napio.proto\x12\x11\x61pio.common.proto\"+\n\rIce40FpgaInfo\x12\x0c\n\x04type\x18\x01 \x02(\t\x12\x0c\n\x04pack\x18\x02 \x02(\t\"9\n\x0c\x45\x63p5FpgaInfo\x12\x0c\n\x04type\x18\x04 \x02(\t\x12\x0c\n\x04pack\x18\x05 \x02(\t\x12\r\n\x05speed\x18\x06 \x02(\t\"\x1f\n\rGowinFpgaInfo\x12\x0e\n\x06\x66\x61mily\x18\x04 \x02(\t\"\xda\x01\n\x08\x46pgaInfo\x12\x0f\n\x07\x66pga_id\x18\x01 \x02(\t\x12\x10\n\x08part_num\x18\x02 \x02(\t\x12\x0c\n\x04size\x18\x03 \x02(\t\x12\x31\n\x05ice40\x18\n \x01(\x0b\x32 .apio.common.proto.Ice40FpgaInfoH\x00\x12/\n\x04\x65\x63p5\x18\x0b \x01(\x0b\x32\x1f.apio.common.proto.Ecp5FpgaInfoH\x00\x12\x31\n\x05gowin\x18\x0c \x01(\x0b\x32 .apio.common.proto.GowinFpgaInfoH\x00\x42\x06\n\x04\x61rch\"I\n\tVerbosity\x12\x12\n\x03\x61ll\x18\x01 \x01(\x08:\x05\x66\x61lse\x12\x14\n\x05synth\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x12\n\x03pnr\x18\x03 \x01(\x08:\x05\x66\x61lse\"\xd9\x01\n\x0b\x45nvironment\x12\x13\n\x0bplatform_id\x18\x01 \x02(\t\x12\x12\n\nis_windows\x18\x02 \x02(\x08\x12\x36\n\rterminal_mode\x18\x03 \x02(\x0e\x32\x1f.apio.common.proto.TerminalMode\x12\x12\n\ntheme_name\x18\x04 \x02(\t\x12\x13\n\x0b\x64\x65\x62ug_level\x18\x05 \x02(\x05\x12\x12\n\nyosys_path\x18\x06 \x02(\t\x12\x14\n\x0ctrellis_path\x18\x07 \x02(\t\x12\x16\n\x0escons_shell_id\x18\x08 \x02(\t\"\xd4\x01\n\rApioEnvParams\x12\x10\n\x08\x65nv_name\x18\x01 \x02(\t\x12\x10\n\x08\x62oard_id\x18\x02 \x02(\t\x12\x12\n\ntop_module\x18\x03 \x02(\t\x12\x0f\n\x07\x64\x65\x66ines\x18\x04 \x03(\t\x12!\n\x19yosys_synth_extra_options\x18\x05 \x03(\t\x12\x1d\n\x15nextpnr_extra_options\x18\x06 \x03(\t\x12\x1d\n\x15gtkwave_extra_options\x18\x07 \x03(\t\x12\x19\n\x0f\x63onstraint_file\x18\x08 \x01(\t:\x00\"\xc6\x01\n\nLintParams\x12\x14\n\ntop_module\x18\x01 \x01(\t:\x00\x12\x1c\n\rverilator_all\x18\x02 \x01(\x08:\x05\x66\x61lse\x12!\n\x12verilator_no_style\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x1a\n\x12verilator_no_warns\x18\x04 \x03(\t\x12\x17\n\x0fverilator_warns\x18\x05 \x03(\t\x12\x16\n\x07nosynth\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\x14\n\x05novlt\x18\x07 \x01(\x08:\x05\x66\x61lse\"o\n\x0bGraphParams\x12\x37\n\x0boutput_type\x18\x01 \x02(\x0e\x32\".apio.common.proto.GraphOutputType\x12\x12\n\ntop_module\x18\x02 \x01(\t\x12\x13\n\x0bopen_viewer\x18\x03 \x02(\x08\"d\n\tSimParams\x12\x18\n\x0etestbench_path\x18\x01 \x01(\t:\x00\x12\x11\n\tforce_sim\x18\x02 \x02(\x08\x12\x12\n\nno_gtkwave\x18\x03 \x02(\x08\x12\x16\n\x0e\x64\x65tach_gtkwave\x18\x04 \x02(\x08\"B\n\x0e\x41pioTestParams\x12\x18\n\x0etestbench_path\x18\x01 \x01(\t:\x00\x12\x16\n\x0e\x64\x65\x66\x61ult_option\x18\x02 \x02(\x08\"&\n\x0cUploadParams\x12\x16\n\x0eprogrammer_cmd\x18\x01 \x01(\t\"\x8b\x02\n\x0cTargetParams\x12-\n\x04lint\x18\n \x01(\x0b\x32\x1d.apio.common.proto.LintParamsH\x00\x12/\n\x05graph\x18\x0b \x01(\x0b\x32\x1e.apio.common.proto.GraphParamsH\x00\x12+\n\x03sim\x18\x0c \x01(\x0b\x32\x1c.apio.common.proto.SimParamsH\x00\x12\x31\n\x04test\x18\r \x01(\x0b\x32!.apio.common.proto.ApioTestParamsH\x00\x12\x31\n\x06upload\x18\x0e \x01(\x0b\x32\x1f.apio.common.proto.UploadParamsH\x00\x42\x08\n\x06target\"\xcd\x02\n\x0bSconsParams\x12\x11\n\ttimestamp\x18\x01 \x02(\t\x12)\n\x04\x61rch\x18\x02 \x02(\x0e\x32\x1b.apio.common.proto.ApioArch\x12.\n\tfpga_info\x18\x03 \x02(\x0b\x32\x1b.apio.common.proto.FpgaInfo\x12/\n\tverbosity\x18\x04 \x01(\x0b\x32\x1c.apio.common.proto.Verbosity\x12\x33\n\x0b\x65nvironment\x18\x05 \x02(\x0b\x32\x1e.apio.common.proto.Environment\x12\x39\n\x0f\x61pio_env_params\x18\x06 \x02(\x0b\x32 .apio.common.proto.ApioEnvParams\x12/\n\x06target\x18\x07 \x01(\x0b\x32\x1f.apio.common.proto.TargetParams*@\n\x08\x41pioArch\x12\x14\n\x10\x41RCH_UNSPECIFIED\x10\x00\x12\t\n\x05ICE40\x10\x01\x12\x08\n\x04\x45\x43P5\x10\x02\x12\t\n\x05GOWIN\x10\x03*_\n\x0cTerminalMode\x12\x18\n\x14TERMINAL_UNSPECIFIED\x10\x00\x12\x11\n\rAUTO_TERMINAL\x10\x01\x12\x12\n\x0e\x46ORCE_TERMINAL\x10\x02\x12\x0e\n\nFORCE_PIPE\x10\x03*B\n\x0fGraphOutputType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03SVG\x10\x01\x12\x07\n\x03PNG\x10\x02\x12\x07\n\x03PDF\x10\x03')
3131

3232
_globals = globals()
3333
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
3434
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'apio_pb2', _globals)
3535
if not _descriptor._USE_C_DESCRIPTORS:
3636
DESCRIPTOR._loaded_options = None
37-
_globals['_APIOARCH']._serialized_start=2000
38-
_globals['_APIOARCH']._serialized_end=2064
39-
_globals['_TERMINALMODE']._serialized_start=2066
40-
_globals['_TERMINALMODE']._serialized_end=2161
41-
_globals['_GRAPHOUTPUTTYPE']._serialized_start=2163
42-
_globals['_GRAPHOUTPUTTYPE']._serialized_end=2229
37+
_globals['_APIOARCH']._serialized_start=2031
38+
_globals['_APIOARCH']._serialized_end=2095
39+
_globals['_TERMINALMODE']._serialized_start=2097
40+
_globals['_TERMINALMODE']._serialized_end=2192
41+
_globals['_GRAPHOUTPUTTYPE']._serialized_start=2194
42+
_globals['_GRAPHOUTPUTTYPE']._serialized_end=2260
4343
_globals['_ICE40FPGAINFO']._serialized_start=33
4444
_globals['_ICE40FPGAINFO']._serialized_end=76
4545
_globals['_ECP5FPGAINFO']._serialized_start=78
@@ -53,19 +53,19 @@
5353
_globals['_ENVIRONMENT']._serialized_start=467
5454
_globals['_ENVIRONMENT']._serialized_end=684
5555
_globals['_APIOENVPARAMS']._serialized_start=687
56-
_globals['_APIOENVPARAMS']._serialized_end=868
57-
_globals['_LINTPARAMS']._serialized_start=871
58-
_globals['_LINTPARAMS']._serialized_end=1069
59-
_globals['_GRAPHPARAMS']._serialized_start=1071
60-
_globals['_GRAPHPARAMS']._serialized_end=1182
61-
_globals['_SIMPARAMS']._serialized_start=1184
62-
_globals['_SIMPARAMS']._serialized_end=1284
63-
_globals['_APIOTESTPARAMS']._serialized_start=1286
64-
_globals['_APIOTESTPARAMS']._serialized_end=1352
65-
_globals['_UPLOADPARAMS']._serialized_start=1354
66-
_globals['_UPLOADPARAMS']._serialized_end=1392
67-
_globals['_TARGETPARAMS']._serialized_start=1395
68-
_globals['_TARGETPARAMS']._serialized_end=1662
69-
_globals['_SCONSPARAMS']._serialized_start=1665
70-
_globals['_SCONSPARAMS']._serialized_end=1998
56+
_globals['_APIOENVPARAMS']._serialized_end=899
57+
_globals['_LINTPARAMS']._serialized_start=902
58+
_globals['_LINTPARAMS']._serialized_end=1100
59+
_globals['_GRAPHPARAMS']._serialized_start=1102
60+
_globals['_GRAPHPARAMS']._serialized_end=1213
61+
_globals['_SIMPARAMS']._serialized_start=1215
62+
_globals['_SIMPARAMS']._serialized_end=1315
63+
_globals['_APIOTESTPARAMS']._serialized_start=1317
64+
_globals['_APIOTESTPARAMS']._serialized_end=1383
65+
_globals['_UPLOADPARAMS']._serialized_start=1385
66+
_globals['_UPLOADPARAMS']._serialized_end=1423
67+
_globals['_TARGETPARAMS']._serialized_start=1426
68+
_globals['_TARGETPARAMS']._serialized_end=1693
69+
_globals['_SCONSPARAMS']._serialized_start=1696
70+
_globals['_SCONSPARAMS']._serialized_end=2029
7171
# @@protoc_insertion_point(module_scope)

apio/common/proto/apio_pb2.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,24 @@ class Environment(_message.Message):
114114
def __init__(self, platform_id: _Optional[str] = ..., is_windows: bool = ..., terminal_mode: _Optional[_Union[TerminalMode, str]] = ..., theme_name: _Optional[str] = ..., debug_level: _Optional[int] = ..., yosys_path: _Optional[str] = ..., trellis_path: _Optional[str] = ..., scons_shell_id: _Optional[str] = ...) -> None: ...
115115

116116
class ApioEnvParams(_message.Message):
117-
__slots__ = ("env_name", "board_id", "top_module", "defines", "yosys_synth_extra_options", "nextpnr_extra_options", "constraint_file")
117+
__slots__ = ("env_name", "board_id", "top_module", "defines", "yosys_synth_extra_options", "nextpnr_extra_options", "gtkwave_extra_options", "constraint_file")
118118
ENV_NAME_FIELD_NUMBER: _ClassVar[int]
119119
BOARD_ID_FIELD_NUMBER: _ClassVar[int]
120120
TOP_MODULE_FIELD_NUMBER: _ClassVar[int]
121121
DEFINES_FIELD_NUMBER: _ClassVar[int]
122122
YOSYS_SYNTH_EXTRA_OPTIONS_FIELD_NUMBER: _ClassVar[int]
123123
NEXTPNR_EXTRA_OPTIONS_FIELD_NUMBER: _ClassVar[int]
124+
GTKWAVE_EXTRA_OPTIONS_FIELD_NUMBER: _ClassVar[int]
124125
CONSTRAINT_FILE_FIELD_NUMBER: _ClassVar[int]
125126
env_name: str
126127
board_id: str
127128
top_module: str
128129
defines: _containers.RepeatedScalarFieldContainer[str]
129130
yosys_synth_extra_options: _containers.RepeatedScalarFieldContainer[str]
130131
nextpnr_extra_options: _containers.RepeatedScalarFieldContainer[str]
132+
gtkwave_extra_options: _containers.RepeatedScalarFieldContainer[str]
131133
constraint_file: str
132-
def __init__(self, env_name: _Optional[str] = ..., board_id: _Optional[str] = ..., top_module: _Optional[str] = ..., defines: _Optional[_Iterable[str]] = ..., yosys_synth_extra_options: _Optional[_Iterable[str]] = ..., nextpnr_extra_options: _Optional[_Iterable[str]] = ..., constraint_file: _Optional[str] = ...) -> None: ...
134+
def __init__(self, env_name: _Optional[str] = ..., board_id: _Optional[str] = ..., top_module: _Optional[str] = ..., defines: _Optional[_Iterable[str]] = ..., yosys_synth_extra_options: _Optional[_Iterable[str]] = ..., nextpnr_extra_options: _Optional[_Iterable[str]] = ..., gtkwave_extra_options: _Optional[_Iterable[str]] = ..., constraint_file: _Optional[str] = ...) -> None: ...
133135

134136
class LintParams(_message.Message):
135137
__slots__ = ("top_module", "verilator_all", "verilator_no_style", "verilator_no_warns", "verilator_warns", "nosynth", "novlt")

apio/managers/project.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ class EnvOptionSpec:
9090
name="nextpnr-extra-options",
9191
is_list=True,
9292
),
93+
"gtkwave-extra-options": EnvOptionSpec(
94+
name="gtkwave-extra-options",
95+
is_list=True,
96+
),
9397
"constraint-file": EnvOptionSpec(
9498
name="constraint-file",
9599
),

apio/managers/scons_manager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ def construct_scons_params(
293293
nextpnr_extra_options=apio_ctx.project.get_list_option(
294294
"nextpnr-extra-options", None
295295
),
296+
gtkwave_extra_options=apio_ctx.project.get_list_option(
297+
"gtkwave-extra-options", None
298+
),
296299
constraint_file=apio_ctx.project.get_str_option(
297300
"constraint-file", None
298301
),

apio/scons/plugin_util.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,21 @@ def action_func(
401401

402402

403403
def gtkwave_target(
404-
api_env: ApioEnv,
404+
apio_env: ApioEnv,
405405
target_name: str, # always 'sim'
406406
vcd_file_target: NodeList,
407407
testbench_info: TestbenchInfo,
408408
sim_params: SimParams,
409+
gtkwave_extra_options: Optional[List[str]],
409410
) -> List[Alias]:
410411
"""Construct a target to launch the QTWave signal viewer.
411412
vcd_file_target is the simulator target that generated the vcd file
412413
with the signals. Returns the new targets.
413414
"""
414415

416+
# pylint: disable=too-many-arguments
417+
# pylint: disable=too-many-positional-arguments
418+
415419
# -- Construct the list of actions.
416420
actions = []
417421

@@ -452,31 +456,31 @@ def create_default_gtkw_file(
452456
# -- The time penalty is negligible.
453457
# -- With the stock oss-cad-suite windows package, this is done in the
454458
# -- environment.bat script.
455-
if api_env.is_windows:
459+
if apio_env.is_windows:
456460
actions.append("gdk-pixbuf-query-loaders --update-cache")
457461

458462
# -- The actual wave viewer command.
459-
gtkwave_cmd = [
460-
"gtkwave",
461-
"--rcvar",
462-
"splash_disable on",
463-
"--rcvar",
464-
"do_initial_zoom_fit 1",
465-
vcd_path,
466-
gtkw_path,
467-
]
463+
gtkwave_cmd = ["gtkwave"]
464+
# -- NOTE: Users can override these rcvars by adding the desired
465+
# -- rcvar options in apio.ini gtkwave-extra-options which will win
466+
# -- since they will appear later in the command line.
467+
gtkwave_cmd.append("--rcvar=splash_disable on")
468+
gtkwave_cmd.append("--rcvar=do_initial_zoom_fit 1")
469+
if gtkwave_extra_options:
470+
gtkwave_cmd.extend(gtkwave_extra_options)
471+
gtkwave_cmd.extend([vcd_path, gtkw_path])
468472

469473
# -- Handle the case where gtkwave is run as a detached app, not
470474
# -- waiting for it to close and not showing its output.
471475
if sim_params.detach_gtkwave:
472-
gtkwave_action = detached_action(api_env, gtkwave_cmd)
476+
gtkwave_action = detached_action(apio_env, gtkwave_cmd)
473477
else:
474478
gtkwave_action = subprocess.list2cmdline(gtkwave_cmd)
475479

476480
actions.append(gtkwave_action)
477481

478482
# -- Define a target with the action(s) we created.
479-
target = api_env.alias(
483+
target = apio_env.alias(
480484
target_name,
481485
source=vcd_file_target,
482486
action=actions,

apio/scons/scons_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def _register_apio_sim_target(self, synth_srcs, test_srcs):
349349
builder_id=TESTBENCH_RUN_BUILDER,
350350
target=testbench_info.build_testbench_name,
351351
sources=[sim_out_target],
352-
always_build=sim_params,
352+
always_build=sim_params.force_sim,
353353
)
354354

355355
# -- The top level "sim" target.
@@ -359,6 +359,7 @@ def _register_apio_sim_target(self, synth_srcs, test_srcs):
359359
sim_vcd_target,
360360
testbench_info,
361361
sim_params,
362+
params.apio_env_params.gtkwave_extra_options,
362363
)
363364

364365
def _register_apio_test_target(self, synth_srcs, test_srcs):

docs/cmd-apio-sim.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ signals, modify them in GTKWave and save your configuration using the
1818
`File > Write Save File` menu command. The `apio sim` command will never
1919
overwrite a `.gtkw` files that were saved in this way.
2020

21+
The command line that used to invoke the signal viewer `gtkwave` can be
22+
customized using the `apio.ini` option `gtkwave-extra-options`.
23+
For example, the option below disables the var `do_initial_zoom_fit` to prevent
24+
gtkwave from forcing a fully-out zoom upon start.
25+
26+
```
27+
[env:default]
28+
gtkwave-extra-options =
29+
--rcvar=do_initial_zoom_fit 0
30+
```
31+
2132
The `apio sim` command defines the macro `APIO_SIM=1`, which allows failed
2233
assertions to skip the `$fatal` call. This lets the simulation continue and
2334
display faulty signals in the GTKWave viewer.

docs/project-file.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ format-verible-options =
169169
For the list of the Verible formatter options, run the command `apio
170170
raw -- verible-verilog-format --helpfull`
171171

172+
### gtkwave-extra-options
173+
174+
The optional `gtkwave-extra-options` string list option allows adding options to the
175+
gtkwave command that that is invoked by the `apio sim`.
176+
For example, the option below disables the var `do_initial_zoom_fit` to prevent
177+
gtkwave from forcing a fully-out zoom upon start.
178+
179+
```
180+
[env:default]
181+
gtkwave-extra-options =
182+
--rcvar=do_initial_zoom_fit 0
183+
```
184+
172185
### nextpnr-extra-options
173186

174187
The optional `nextpnr-extra-options` string list option allows adding options to the

0 commit comments

Comments
 (0)