summaryrefslogtreecommitdiff
path: root/src/test/scala/ChiselTests/Decoder.scala
blob: 0a295678b6c53e468e4f5b7b37fd7fd5ef217463 (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 = BitPat("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))
}