summaryrefslogtreecommitdiff
path: root/src/test/scala/ChiselTests/Decoder.scala
diff options
context:
space:
mode:
authorJim Lawson2015-07-24 17:17:01 -0700
committerJim Lawson2015-07-24 17:17:01 -0700
commite73450165c59d68b524689a7169e03140a41a1c5 (patch)
treeb7236f80d9abf60775ecbcefe6f7ca25557dce73 /src/test/scala/ChiselTests/Decoder.scala
parent94893bad972ded686a2c68dd334aa40b92e3b85d (diff)
parent3976145bb8c7595ad0f0a7fbb4ccbbd3030d8873 (diff)
Merge pull request #1 from ucb-bar/packagedir
Packagedir
Diffstat (limited to 'src/test/scala/ChiselTests/Decoder.scala')
-rw-r--r--src/test/scala/ChiselTests/Decoder.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/scala/ChiselTests/Decoder.scala b/src/test/scala/ChiselTests/Decoder.scala
new file mode 100644
index 00000000..0a295678
--- /dev/null
+++ b/src/test/scala/ChiselTests/Decoder.scala
@@ -0,0 +1,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))
+}