Some fixes
This commit is contained in:
parent
49bfd372d0
commit
4e21e33d68
4 changed files with 15 additions and 15 deletions
|
@ -43,7 +43,8 @@ object Manifest {
|
||||||
printMergedTrace = false,
|
printMergedTrace = false,
|
||||||
nopPadded = nopPadded,
|
nopPadded = nopPadded,
|
||||||
breakPoints = Nil, // not implemented
|
breakPoints = Nil, // not implemented
|
||||||
testName = name)
|
testName = name,
|
||||||
|
maxSteps = 15000)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,6 @@ object Data {
|
||||||
ops : List[SourceInfo[Op]],
|
ops : List[SourceInfo[Op]],
|
||||||
settings : List[TestSetting],
|
settings : List[TestSetting],
|
||||||
labelMap : Map[Label, Addr],
|
labelMap : Map[Label, Addr],
|
||||||
maxSteps : Int = 5000
|
|
||||||
){
|
){
|
||||||
|
|
||||||
def imem: Map[Addr, Op] =
|
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.
|
* 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 uk = "UNKNOWN"
|
||||||
val (finish, trace) = VM.run(maxSteps, vm)
|
val (finish, trace) = VM.run(maxSteps, vm)
|
||||||
finish match {
|
finish match {
|
||||||
|
|
|
@ -66,6 +66,7 @@ object Parser {
|
||||||
stringWs("sra") ~> arith.mapN{Arith.sra},
|
stringWs("sra") ~> arith.mapN{Arith.sra},
|
||||||
|
|
||||||
stringWs("slt") ~> arith.mapN{Arith.slt},
|
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},
|
stringWs("sltu") ~> arith.mapN{Arith.sltu},
|
||||||
|
|
||||||
// pseudos
|
// pseudos
|
||||||
|
@ -99,10 +100,7 @@ object Parser {
|
||||||
stringWs("seqz") ~> (reg <~ sep, reg, ok(1)).mapN{ArithImm.sltu},
|
stringWs("seqz") ~> (reg <~ sep, reg, ok(1)).mapN{ArithImm.sltu},
|
||||||
|
|
||||||
stringWs("li") ~> (reg ~ sep ~ (hex | int)).collect{
|
stringWs("li") ~> (reg ~ sep ~ (hex | int)).collect{
|
||||||
case((a, b), c) if (c.nBitsS <= 12) => {
|
case((a, b), c) if (c.nBitsS <= 12) => { ArithImm.add(a, 0, c) }
|
||||||
say(s"for c: $c, nBitsS was ${c.nBitsS}")
|
|
||||||
ArithImm.add(a, 0, c)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ case class TestOptions(
|
||||||
printMergedTrace : Boolean,
|
printMergedTrace : Boolean,
|
||||||
nopPadded : Boolean,
|
nopPadded : Boolean,
|
||||||
breakPoints : List[Int], // Not implemented
|
breakPoints : List[Int], // Not implemented
|
||||||
testName : String
|
testName : String,
|
||||||
|
maxSteps : Int
|
||||||
)
|
)
|
||||||
|
|
||||||
case class TestResult(
|
case class TestResult(
|
||||||
|
@ -44,12 +45,12 @@ object TestRunner {
|
||||||
val testResults = for {
|
val testResults = for {
|
||||||
lines <- fileUtils.readTest(testOptions)
|
lines <- fileUtils.readTest(testOptions)
|
||||||
program <- FiveStage.Parser.parseProgram(lines, 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(
|
(termitationCause, chiselTrace) <- ChiselTestRunner(
|
||||||
binary.toList.sortBy(_._1.value).map(_._2),
|
binary.toList.sortBy(_._1.value).map(_._2),
|
||||||
program.settings,
|
program.settings,
|
||||||
finalVM.pc,
|
finalVM.pc,
|
||||||
15000)
|
testOptions.maxSteps)
|
||||||
} yield {
|
} yield {
|
||||||
val traces = mergeTraces(trace, chiselTrace).map(x => printMergedTraces((x), program))
|
val traces = mergeTraces(trace, chiselTrace).map(x => printMergedTraces((x), program))
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ object TestRunner {
|
||||||
val testResults = for {
|
val testResults = for {
|
||||||
lines <- fileUtils.readTest(testOptions)
|
lines <- fileUtils.readTest(testOptions)
|
||||||
program <- FiveStage.Parser.parseProgram(lines, 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 {
|
} yield {
|
||||||
|
|
||||||
sealed trait BranchEvent
|
sealed trait BranchEvent
|
||||||
|
@ -164,6 +165,7 @@ object TestRunner {
|
||||||
say(OneBitInfiniteSlots(events))
|
say(OneBitInfiniteSlots(events))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +175,7 @@ object TestRunner {
|
||||||
val testResults = for {
|
val testResults = for {
|
||||||
lines <- fileUtils.readTest(testOptions)
|
lines <- fileUtils.readTest(testOptions)
|
||||||
program <- FiveStage.Parser.parseProgram(lines, 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 {
|
} yield {
|
||||||
|
|
||||||
sealed trait MemoryEvent
|
sealed trait MemoryEvent
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue