diff options
Diffstat (limited to 'src/test/scala/chiselTests/GCD.scala')
| -rw-r--r-- | src/test/scala/chiselTests/GCD.scala | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/test/scala/chiselTests/GCD.scala b/src/test/scala/chiselTests/GCD.scala index 48a96f0d..acc1e84e 100644 --- a/src/test/scala/chiselTests/GCD.scala +++ b/src/test/scala/chiselTests/GCD.scala @@ -24,21 +24,21 @@ class GCD extends Module { io.v := y === UInt(0) } -class GCDSpec extends ChiselPropSpec { - - class GCDTester(a: Int, b: Int, z: Int) extends BasicTester { - val dut = Module(new GCD) - val first = Reg(init=Bool(true)) - dut.io.a := UInt(a) - dut.io.b := UInt(b) - dut.io.e := first - when(first) { first := Bool(false) } - when(dut.io.v) { - io.done := Bool(true) - io.error := (dut.io.z != UInt(z)).toUInt - } +class GCDTester(a: Int, b: Int, z: Int) extends BasicTester { + val dut = Module(new GCD) + val first = Reg(init=Bool(true)) + dut.io.a := UInt(a) + dut.io.b := UInt(b) + dut.io.e := first + when(first) { first := Bool(false) } + when(dut.io.v) { + io.done := Bool(true) + io.error := (dut.io.z != UInt(z)).toUInt } +} +class GCDSpec extends ChiselPropSpec { + //TODO: use generators and this function to make z's def gcd(a: Int, b: Int): Int = if(b == 0) a else gcd(b, a%b) |
