Skip to content

Commit 002f740

Browse files
committed
[chiselsim] Change chiselSettings to settings
Rename the parameter to some functions from "chiselSettings" to "settings". The type of the parameter had already been changed, but not the parameter name. Signed-off-by: Schuyler Eldridge <[email protected]>
1 parent 7365f30 commit 002f740

File tree

5 files changed

+27
-29
lines changed

5 files changed

+27
-29
lines changed

src/main/scala/chisel3/simulator/EphemeralSimulator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ object EphemeralSimulator extends PeekPokeAPI {
2727
implicit val temporary: HasTestingDirectory = HasTestingDirectory.temporary(deleteOnExit = true)
2828
chiselSim.simulateRaw(
2929
module,
30-
chiselSettings = Settings.defaultRaw[T].copy(verilogLayers = layerControl)
30+
settings = Settings.defaultRaw[T].copy(verilogLayers = layerControl)
3131
)(body)
3232
}
3333

src/main/scala/chisel3/simulator/Simulator.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ trait Simulator[T <: Backend] {
9292
* @param module a Chisel module to simulate
9393
* @param chiselOpts command line options to pass to Chisel
9494
* @param firtoolOpts command line options to pass to firtool
95-
* @param chiselSettings Chisel-related settings used for simulation
95+
* @param settings ChiselSim-related settings used for simulation
9696
* @param body stimulus to apply to the module
9797
* @param commonSettingsModifications modifications to common compilation
9898
* settings
@@ -103,10 +103,10 @@ trait Simulator[T <: Backend] {
103103
* by default and if you set incompatible options, the simulation will fail.
104104
*/
105105
final def simulate[T <: RawModule, U](
106-
module: => T,
107-
chiselOpts: Array[String] = Array.empty,
108-
firtoolOpts: Array[String] = Array.empty,
109-
chiselSettings: Settings[T] = Settings.defaultRaw[T]
106+
module: => T,
107+
chiselOpts: Array[String] = Array.empty,
108+
firtoolOpts: Array[String] = Array.empty,
109+
settings: Settings[T] = Settings.defaultRaw[T]
110110
)(body: (SimulatedModule[T]) => U)(
111111
implicit chiselOptsModifications: ChiselOptionsModifications,
112112
firtoolOptsModifications: FirtoolOptionsModifications,
@@ -130,16 +130,16 @@ trait Simulator[T <: Backend] {
130130
// ensures that `` `include `` directives can be resolved.
131131
includeDirs = Some(commonCompilationSettings.includeDirs.getOrElse(Seq.empty) :+ workspace.primarySourcesPath),
132132
verilogPreprocessorDefines =
133-
commonCompilationSettings.verilogPreprocessorDefines ++ chiselSettings.preprocessorDefines(elaboratedModule),
133+
commonCompilationSettings.verilogPreprocessorDefines ++ settings.preprocessorDefines(elaboratedModule),
134134
fileFilter =
135-
commonCompilationSettings.fileFilter.orElse(chiselSettings.verilogLayers.shouldIncludeFile(elaboratedModule)),
135+
commonCompilationSettings.fileFilter.orElse(settings.verilogLayers.shouldIncludeFile(elaboratedModule)),
136136
directoryFilter = commonCompilationSettings.directoryFilter.orElse(
137-
chiselSettings.verilogLayers.shouldIncludeDirectory(elaboratedModule, workspace.primarySourcesPath)
137+
settings.verilogLayers.shouldIncludeDirectory(elaboratedModule, workspace.primarySourcesPath)
138138
),
139139
simulationSettings = commonCompilationSettings.simulationSettings.copy(
140-
plusArgs = commonCompilationSettings.simulationSettings.plusArgs ++ chiselSettings.plusArgs,
140+
plusArgs = commonCompilationSettings.simulationSettings.plusArgs ++ settings.plusArgs,
141141
enableWavesAtTimeZero =
142-
commonCompilationSettings.simulationSettings.enableWavesAtTimeZero || chiselSettings.enableWavesAtTimeZero
142+
commonCompilationSettings.simulationSettings.enableWavesAtTimeZero || settings.enableWavesAtTimeZero
143143
)
144144
)
145145
)

src/main/scala/chisel3/simulator/SimulatorAPI.scala

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ trait SimulatorAPI {
2020
* @param module the Chisel module to generate
2121
* @param chiselOpts command line options to pass to Chisel
2222
* @param firtoolOpts command line options to pass to firtool
23-
* @param chiselSettings Chisel-related settings used for simulation
23+
* @param settings ChiselSim-related settings used for simulation
2424
* @param stimulus directed stimulus to use
2525
* @param testingDirectory a type class implementation that can be used to
2626
* change the behavior of where files will be created
@@ -29,10 +29,10 @@ trait SimulatorAPI {
2929
* by default and if you set incompatible options, the simulation will fail.
3030
*/
3131
def simulateRaw[T <: RawModule](
32-
module: => T,
33-
chiselOpts: Array[String] = Array.empty,
34-
firtoolOpts: Array[String] = Array.empty,
35-
chiselSettings: Settings[T] = Settings.defaultRaw[T]
32+
module: => T,
33+
chiselOpts: Array[String] = Array.empty,
34+
firtoolOpts: Array[String] = Array.empty,
35+
settings: Settings[T] = Settings.defaultRaw[T]
3636
)(stimulus: (T) => Unit)(
3737
implicit hasSimulator: HasSimulator,
3838
testingDirectory: HasTestingDirectory,
@@ -43,9 +43,8 @@ trait SimulatorAPI {
4343
): Unit = {
4444

4545
hasSimulator.getSimulator
46-
.simulate(module = module, chiselOpts = chiselOpts, firtoolOpts = firtoolOpts, chiselSettings = chiselSettings) {
47-
module =>
48-
stimulus(module.wrapped)
46+
.simulate(module = module, chiselOpts = chiselOpts, firtoolOpts = firtoolOpts, settings = settings) { module =>
47+
stimulus(module.wrapped)
4948
}
5049
.result
5150
}
@@ -57,7 +56,7 @@ trait SimulatorAPI {
5756
* @param module the Chisel module to generate
5857
* @param chiselOpts command line options to pass to Chisel
5958
* @param firtoolOpts command line options to pass to firtool
60-
* @param chiselSettings Chisel-related settings used for simulation
59+
* @param settings ChiselSim-related settings used for simulation
6160
* @param additionalResetCycles a number of _additional_ cycles to assert
6261
* reset for
6362
* @param stimulus directed stimulus to use
@@ -71,7 +70,7 @@ trait SimulatorAPI {
7170
module: => T,
7271
chiselOpts: Array[String] = Array.empty,
7372
firtoolOpts: Array[String] = Array.empty,
74-
chiselSettings: Settings[T] = Settings.default[T],
73+
settings: Settings[T] = Settings.default[T],
7574
additionalResetCycles: Int = 0
7675
)(stimulus: (T) => Unit)(
7776
implicit hasSimulator: HasSimulator,
@@ -84,7 +83,7 @@ trait SimulatorAPI {
8483
module = module,
8584
chiselOpts = chiselOpts,
8685
firtoolOpts = firtoolOpts,
87-
chiselSettings = chiselSettings
86+
settings = settings
8887
) { dut =>
8988
ResetProcedure.module(additionalResetCycles)(dut)
9089
stimulus(dut)

src/test/scala-2/chiselTests/simulator/SimulatorSpec.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,14 @@ class SimulatorSpec extends AnyFunSpec with Matchers {
308308
new VerilatorSimulator("test_run_dir/simulator/does_not_compile_disabled_layers-enabledf")
309309
.simulate(
310310
new Foo,
311-
chiselSettings = Settings.default[Foo].copy(verilogLayers = LayerControl.EnableAll)
311+
settings = Settings.default[Foo].copy(verilogLayers = LayerControl.EnableAll)
312312
) { _ => }
313313
.result
314314
}.getMessage() should include("Unsupported: s_eventually")
315315

316316
info("disabling unsupported constracts causes compilation to succeed")
317317
new VerilatorSimulator("test_run_dir/simulator/does_not_compile_disabled_layers-disabled")
318-
.simulate(new Foo, chiselSettings = Settings.default[Foo].copy(verilogLayers = LayerControl.DisableAll)) { _ =>
319-
}
318+
.simulate(new Foo, settings = Settings.default[Foo].copy(verilogLayers = LayerControl.DisableAll)) { _ => }
320319
.result
321320

322321
}

src/test/scala-2/chiselTests/simulator/scalatest/ChiselSimSpec.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ class ChiselSimSpec extends AnyFunSpec with Matchers with ChiselSim with FileChe
117117
val a, b, c = IO(Input(Bool()))
118118
}
119119

120-
val chiselSettings = Settings
120+
val settings = Settings
121121
.defaultRaw[Foo]
122122
.copy(
123123
assertVerboseCond = Some(MacroText.Signal(_.a)),
124124
printfCond = Some(MacroText.Signal(_.b)),
125125
stopCond = Some(MacroText.NotSignal(_.c))
126126
)
127127

128-
simulateRaw(new Foo, chiselSettings = chiselSettings) { _ => }
128+
simulateRaw(new Foo, settings = settings) { _ => }
129129

130130
io.Source
131131
.fromFile(
@@ -229,7 +229,7 @@ class ChiselSimSpec extends AnyFunSpec with Matchers with ChiselSim with FileChe
229229

230230
vcdFile.delete
231231

232-
simulate(new Foo, chiselSettings = Settings.default.copy(enableWavesAtTimeZero = true)) { _ => }
232+
simulate(new Foo, settings = Settings.default.copy(enableWavesAtTimeZero = true)) { _ => }
233233

234234
info(s"$vcdFile exists")
235235
vcdFile should (exist)
@@ -247,7 +247,7 @@ class ChiselSimSpec extends AnyFunSpec with Matchers with ChiselSim with FileChe
247247

248248
simulateRaw(
249249
new Foo,
250-
chiselSettings = Settings.default.copy(
250+
settings = Settings.default.copy(
251251
plusArgs = Seq(
252252
new svsim.PlusArg("value", Some("1")),
253253
new svsim.PlusArg("test", None)

0 commit comments

Comments
 (0)