diff --git a/script/src/Main.scala b/script/src/Main.scala index 5b4249f04..2e94792ca 100644 --- a/script/src/Main.scala +++ b/script/src/Main.scala @@ -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( @@ -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 = @@ -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