aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorPaul Rigge2018-12-18 15:47:20 -0800
committerSchuyler Eldridge2018-12-18 18:47:20 -0500
commit3655ae091249a72bd424073cfb4a382a5ab170c6 (patch)
treef9a7a81ecf13546665fd61923dfd984be1bf1a1e /src/test
parent95801dca4d5667b3a87bed58085ef7476ae87f8b (diff)
Give better error when mport references non-existant memory. (#975)
* Give better error when mport references non-existent memory * Closes #796
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/ChirrtlMemSpec.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/ChirrtlMemSpec.scala b/src/test/scala/firrtlTests/ChirrtlMemSpec.scala
index 74d39286..a4473fe7 100644
--- a/src/test/scala/firrtlTests/ChirrtlMemSpec.scala
+++ b/src/test/scala/firrtlTests/ChirrtlMemSpec.scala
@@ -108,6 +108,23 @@ circuit foo :
parse(res.getEmittedCircuit.value)
}
+ "An mport that refers to an undefined memory" should "have a helpful error message" in {
+ val input =
+ """circuit testTestModule :
+ | module testTestModule :
+ | input clock : Clock
+ | input reset : UInt<1>
+ | output io : {flip in : UInt<10>, out : UInt<10>}
+ |
+ | node _T_10 = bits(io.in, 1, 0)
+ | read mport _T_11 = m[_T_10], clock
+ | io.out <= _T_11""".stripMargin
+
+ intercept[PassException]{
+ (new LowFirrtlCompiler).compile(CircuitState(parse(input), ChirrtlForm), Seq()).circuit
+ }.getMessage should startWith ("Undefined memory m referenced by mport _T_11")
+ }
+
ignore should "Memories should not have validif on port clocks when declared in a when" in {
val input =
""";buildInfoPackage: chisel3, version: 3.0-SNAPSHOT, scalaVersion: 2.11.11, sbtVersion: 0.13.16, builtAtString: 2017-10-06 20:55:20.367, builtAtMillis: 1507323320367