Some fixes

This commit is contained in:
peteraa 2019-10-17 16:47:21 +02:00
parent 49bfd372d0
commit 4e21e33d68
4 changed files with 15 additions and 15 deletions

View file

@ -43,7 +43,8 @@ object Manifest {
printMergedTrace = false,
nopPadded = nopPadded,
breakPoints = Nil, // not implemented
testName = name)
testName = name,
maxSteps = 15000)
}

View file

@ -236,7 +236,6 @@ object Data {
ops : List[SourceInfo[Op]],
settings : List[TestSetting],
labelMap : Map[Label, Addr],
maxSteps : Int = 5000
){
def imem: Map[Addr, Op] =
@ -272,7 +271,7 @@ object Data {
/**
* Returns the binary code and the execution trace or an error for convenient error checking.
*/
def validate: Either[String, (Map[Addr, Int], ExecutionTrace[VM])] = machineCode.flatMap{ binary =>
def validate(maxSteps: Int): Either[String, (Map[Addr, Int], ExecutionTrace[VM])] = machineCode.flatMap{ binary =>
val uk = "UNKNOWN"
val (finish, trace) = VM.run(maxSteps, vm)
finish match {

View file

@ -66,6 +66,7 @@ object Parser {
stringWs("sra") ~> arith.mapN{Arith.sra},
stringWs("slt") ~> arith.mapN{Arith.slt},
stringWs("sgt") ~> arith.mapN{ case(x,y,z) => Arith.slt(x,z,y)},
stringWs("sltu") ~> arith.mapN{Arith.sltu},
// pseudos
@ -99,10 +100,7 @@ object Parser {
stringWs("seqz") ~> (reg <~ sep, reg, ok(1)).mapN{ArithImm.sltu},
stringWs("li") ~> (reg ~ sep ~ (hex | int)).collect{
case((a, b), c) if (c.nBitsS <= 12) => {
say(s"for c: $c, nBitsS was ${c.nBitsS}")
ArithImm.add(a, 0, c)
}
case((a, b), c) if (c.nBitsS <= 12) => { ArithImm.add(a, 0, c) }
},

View file

@ -25,7 +25,8 @@ case class TestOptions(
printMergedTrace : Boolean,
nopPadded : Boolean,
breakPoints : List[Int], // Not implemented
testName : String
testName : String,
maxSteps : Int
)
case class TestResult(
@ -44,12 +45,12 @@ object TestRunner {
val testResults = for {
lines <- fileUtils.readTest(testOptions)
program <- FiveStage.Parser.parseProgram(lines, testOptions)
(binary, (trace, finalVM)) <- program.validate.map(x => (x._1, x._2.run))
(binary, (trace, finalVM)) <- program.validate(testOptions.maxSteps).map(x => (x._1, x._2.run))
(termitationCause, chiselTrace) <- ChiselTestRunner(
binary.toList.sortBy(_._1.value).map(_._2),
program.settings,
finalVM.pc,
15000)
binary.toList.sortBy(_._1.value).map(_._2),
program.settings,
finalVM.pc,
testOptions.maxSteps)
} yield {
val traces = mergeTraces(trace, chiselTrace).map(x => printMergedTraces((x), program))
@ -106,7 +107,7 @@ object TestRunner {
val testResults = for {
lines <- fileUtils.readTest(testOptions)
program <- FiveStage.Parser.parseProgram(lines, testOptions)
(binary, (trace, finalVM)) <- program.validate.map(x => (x._1, x._2.run))
(binary, (trace, finalVM)) <- program.validate(testOptions.maxSteps).map(x => (x._1, x._2.run))
} yield {
sealed trait BranchEvent
@ -164,6 +165,7 @@ object TestRunner {
say(OneBitInfiniteSlots(events))
}
true
}
@ -173,7 +175,7 @@ object TestRunner {
val testResults = for {
lines <- fileUtils.readTest(testOptions)
program <- FiveStage.Parser.parseProgram(lines, testOptions)
(binary, (trace, finalVM)) <- program.validate.map(x => (x._1, x._2.run))
(binary, (trace, finalVM)) <- program.validate(testOptions.maxSteps).map(x => (x._1, x._2.run))
} yield {
sealed trait MemoryEvent