From 2b4b79d4755c081c53275d0ef70fd8922d181a3f Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Wed, 14 Feb 2024 16:47:46 -0800 Subject: [PATCH] Add error module in LazyModule construction --- src/main/scala/diplomacy/LazyModule.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/scala/diplomacy/LazyModule.scala b/src/main/scala/diplomacy/LazyModule.scala index a761a841eed..5f4da46cb9a 100644 --- a/src/main/scala/diplomacy/LazyModule.scala +++ b/src/main/scala/diplomacy/LazyModule.scala @@ -333,7 +333,14 @@ sealed trait LazyModuleImpLike extends RawModule { dangles } .getOrElse { // For non-clones, instantiate the child module - val mod = Module(c.module) + val mod = try { + Module(c.module) + } catch { + case e: ChiselException => { + println(s"Chisel exception caught when instantiating ${c.name} within ${this.name} at ${c.line}") + throw e + } + } mod.dangles } }