summaryrefslogtreecommitdiff
path: root/src/test/scala/ChiselTests/Decoder.scala
blob: c9b9f41843424c3e9beda5cf1687519400f6f85f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package ChiselTests
import Chisel._

object Insts {
  def ADD = MInt("b0000000??????????000?????0110011")
}

class Decoder extends Module {
  val io = new Bundle {
    val inst  = UInt(INPUT, 32)
    val isAdd = Bool(OUTPUT)
  }
  io.isAdd := (Insts.ADD === io.inst)
}

class DecoderTester(c: Decoder) extends Tester(c) {
  poke(c.io.inst, 0x1348533)
  step(1)
  expect(c.io.isAdd, int(true))
}