Skip to content

Commit

Permalink
[script] fix soc issues
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin committed Apr 18, 2024
1 parent e313ef1 commit 679a53c
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions script/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ object Main:
@main def subsystememu(
@arg(
name = "case",
short = 'c',
short = 'C',
doc = "name alias for loading test case"
) testCase: String,
@arg(
Expand Down Expand Up @@ -379,7 +379,28 @@ object Main:
@arg(
name = "emulator-path",
doc = "path to emulator"
) emulatorPath: Option[String]
) emulatorPath: Option[String],
@arg(
name = "emulator-log-file-path",
doc = "Set the logging output path"
) emulatorLogFilePath: Option[os.Path] = None,
@arg(
name = "no-logging",
doc = "prevent emulator produce log (both console and file)"
) noLog: Flag = Flag(false),
@arg(
name = "no-file-logging",
doc = "prevent emulator print log to console"
) noFileLog: Flag = Flag(true),
@arg(
name = "no-console-logging",
short = 'q',
doc = "prevent emulator print log to console"
) noConsoleLog: Flag = Flag(false),
@arg(
name = "timeout",
doc = "specify timeout cycle for soc emulator"
) timeout: Int = 1000000,
): Unit =
val caseElfPath = resolveTestElfPath(config, testCase, forceX86)
val outputPath =
Expand All @@ -391,14 +412,25 @@ object Main:
emuPath
else resolveEmulatorPath(config, "subsystem", trace.value)

val emulatorLogPath =
if emulatorLogFilePath.isDefined then emulatorLogFilePath.get
else outputPath / "emulator.log"

val emuArgs =
Seq(s"+init_file=${caseElfPath}") ++ optionals(
Seq(
emulator.toString(),
s"--elf=${caseElfPath}",
s"--log-path=${emulatorLogPath}",
s"--timeout=${timeout}"
) ++ optionals(
trace.value,
Seq(s"+trace_file=${
Seq(s"--wave=${
if (traceFile.isDefined) then os.Path(traceFile.get, os.pwd)
else outputPath / "trace.fst"
else outputPath / "wave.fst"
}")
)
) ++ optionals(noLog.value, Seq("--no-logging"))
++ optionals(noFileLog.value, Seq("--no-file-logging"))
++ optionals(noConsoleLog.value, Seq("--no-console-logging"))
os.proc(emuArgs).call()

if (trace.value) then
Expand Down

0 comments on commit 679a53c

Please sign in to comment.