aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Magyar2020-03-11 22:07:25 -0700
committerAlbert Magyar2020-03-12 09:04:39 -0700
commit7e8d21e7f5fe3469eada53e6a6c60e38c134c403 (patch)
tree8679ed76bdc5d37da730efeb6424198c00aa3386 /src
parent17f0d64edba974126b2d0fa23b4923098477f93a (diff)
Add out-of-bounds literal access test for ReplaceAccesses
Diffstat (limited to 'src')
-rw-r--r--src/test/scala/firrtlTests/ReplaceAccessesSpec.scala25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/test/scala/firrtlTests/ReplaceAccessesSpec.scala b/src/test/scala/firrtlTests/ReplaceAccessesSpec.scala
index ca20c90e..5b1e39dc 100644
--- a/src/test/scala/firrtlTests/ReplaceAccessesSpec.scala
+++ b/src/test/scala/firrtlTests/ReplaceAccessesSpec.scala
@@ -27,7 +27,7 @@ class ReplaceAccessesMultiDim extends ReplaceAccessesSpec {
module Top :
input clock : Clock
output out : UInt<1>
- reg r_vec : UInt<1>[4][2], clock
+ reg r_vec : UInt<1>[4][3], clock
out <= r_vec[UInt<2>(2)][UInt<1>(1)]
"""
val check =
@@ -35,10 +35,31 @@ class ReplaceAccessesMultiDim extends ReplaceAccessesSpec {
module Top :
input clock : Clock
output out : UInt<1>
- reg r_vec : UInt<1>[4][2], clock with :
+ reg r_vec : UInt<1>[4][3], clock with :
reset => (UInt<1>(0), r_vec)
out <= r_vec[2][1]
"""
(parse(exec(input))) should be (parse(check))
}
+
+ "ReplacesAccesses" should "NOT generate out-of-bounds indices" in {
+ val input =
+ """circuit Top :
+ module Top :
+ input clock : Clock
+ output out : UInt<1>
+ reg r_vec : UInt<1>[4][2], clock
+ out <= r_vec[UInt<3>(1)][UInt<3>(8)]
+"""
+ val check =
+ """circuit Top :
+ module Top :
+ input clock : Clock
+ output out : UInt<1>
+ reg r_vec : UInt<1>[4][2], clock with :
+ reset => (UInt<1>(0), r_vec)
+ out <= r_vec[1][UInt<3>(8)]
+"""
+ (parse(exec(input))) should be (parse(check))
+ }
}