Skip to content

Commit 7365f30

Browse files
committed
[svsim] Add Coverage Directory and Name options
Add `-cm_dir` to VCS compile and simulation time options and `-cm_name` to simulation time only. (This is what is allowed by VCS.) Context: we have some usages of this internally and I'm adding this so that there is a type-safe way to access these. Signed-off-by: Schuyler Eldridge <[email protected]>
1 parent 8e6f7f7 commit 7365f30

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

svsim/src/main/scala/vcs/Backend.scala

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ object Backend {
9494
final case class SimulationSettings(
9595
customWorkingDirectory: Option[String] = None,
9696
assertionSettings: Option[AssertionSettings] = None,
97-
coverageSettings: CoverageSettings = CoverageSettings()
97+
coverageSettings: CoverageSettings = CoverageSettings(),
98+
coverageDirectory: Option[CoverageDirectory] = None,
99+
coverageName: Option[CoverageName] = None
98100
)
99101

100102
/** Trait that encodes a VCS "plus" option.
@@ -158,6 +160,30 @@ object Backend {
158160

159161
}
160162

163+
/** Settings for controlling the coverage directory
164+
*
165+
* This maps to the `-cm_dir` option.
166+
*/
167+
final case class CoverageDirectory(
168+
directory: String
169+
) {
170+
171+
def toFlags: Seq[String] = Seq("-cm_dir", directory)
172+
173+
}
174+
175+
/** Sets a unique name used for this coverage run
176+
*
177+
* This maps to the `-cm_name` option.
178+
*/
179+
final case class CoverageName(
180+
name: String
181+
) {
182+
183+
def toFlags: Seq[String] = Seq("-cm_name", name)
184+
185+
}
186+
161187
/** Settings for controlling VCS toggle coverage.
162188
*
163189
* These options map to the `-cm_tgl` option. Consult the Synopsys VCS user
@@ -220,6 +246,7 @@ object Backend {
220246
traceSettings: CompilationSettings.TraceSettings = CompilationSettings.TraceSettings(),
221247
simulationSettings: SimulationSettings = SimulationSettings(),
222248
coverageSettings: CoverageSettings = CoverageSettings(),
249+
coverageDirectory: Option[CoverageDirectory] = None,
223250
toggleCoverageSettings: ToggleCoverageSettings = ToggleCoverageSettings(),
224251
branchCoverageSettings: BranchCoverageSettings = BranchCoverageSettings(),
225252
flags: Seq[Flag.Type] = Seq.empty,
@@ -364,6 +391,8 @@ final class Backend(
364391

365392
backendSpecificSettings.coverageSettings.toFlags,
366393

394+
backendSpecificSettings.coverageDirectory.map(_.toFlags).getOrElse(Seq.empty),
395+
367396
backendSpecificSettings.toggleCoverageSettings.toFlags,
368397

369398
backendSpecificSettings.branchCoverageSettings.toFlags,
@@ -390,6 +419,8 @@ final class Backend(
390419
case Some(Backend.AssertGlobalMaxFailCount(count)) => Seq("-assert", s"global_finish_maxfail=$count")
391420
},
392421
backendSpecificSettings.simulationSettings.coverageSettings.toFlags,
422+
backendSpecificSettings.simulationSettings.coverageDirectory.map(_.toFlags).getOrElse(Seq.empty),
423+
backendSpecificSettings.simulationSettings.coverageName.map(_.toFlags).getOrElse(Seq.empty),
393424
commonSettings.simulationSettings.plusArgs.map(_.simulatorFlags),
394425
).flatten,
395426
environment = environment

0 commit comments

Comments
 (0)