aboutsummaryrefslogtreecommitdiff
path: root/src/test/resources/features/ZeroWidthMem.fir
diff options
context:
space:
mode:
authorgrebe2018-03-19 15:37:25 -0700
committerAdam Izraelevitz2018-03-19 15:37:25 -0700
commit5f68881b90a638bd175491f6131c473e6204381a (patch)
tree49e458410c8c867ff290f3e610178adcdd70455d /src/test/resources/features/ZeroWidthMem.fir
parent97cfb9b5090641e2df52db4649965be5ad7b86a8 (diff)
Masks for zero-width fields of mems should be width zero. (#763)
Closes #666.
Diffstat (limited to 'src/test/resources/features/ZeroWidthMem.fir')
-rw-r--r--src/test/resources/features/ZeroWidthMem.fir28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/resources/features/ZeroWidthMem.fir b/src/test/resources/features/ZeroWidthMem.fir
new file mode 100644
index 00000000..c56f8390
--- /dev/null
+++ b/src/test/resources/features/ZeroWidthMem.fir
@@ -0,0 +1,28 @@
+; See LICENSE for license details.
+circuit ZeroWidthMem :
+ module ZeroWidthMem :
+ input clock : Clock
+ input reset : UInt<1>
+ input waddr : UInt<4>
+ input in : {0: UInt<10>, 1: UInt<0>}
+ input raddr : UInt<4>
+ output out : {0: UInt<10>, 1: UInt<0>}
+
+ cmem ram : {0: UInt<10>, 1: UInt<0>}[16]
+ infer mport ramin = ram[waddr], clock
+ infer mport ramout = ram[raddr], clock
+
+ ramin.0 <= in.0
+ ramin.1 <= in.1
+ out <= ramout
+
+ wire foo : UInt<32>
+ foo <= UInt<32>("hdeadbeef")
+
+ when not(reset) :
+ when eq(foo, UInt<32>("hdeadbeef")) :
+ stop(clock, UInt(1), 0) ; Success !
+ else :
+ printf(clock, UInt(1), "Assertion failed!\n")
+ stop(clock, UInt(1), 1) ; Failure!
+