From 867738f39ba9e3893a3602c385986e3d5d82b8e8 Mon Sep 17 00:00:00 2001 From: Tynan McAuley Date: Tue, 12 Mar 2024 08:49:55 -0700 Subject: [PATCH] Add error message in LazyModule construction This just ports https://github.com/chipsalliance/rocket-chip/pull/3569 to this repo. --- diplomacy/src/diplomacy/lazymodule/LazyModuleImp.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/diplomacy/src/diplomacy/lazymodule/LazyModuleImp.scala b/diplomacy/src/diplomacy/lazymodule/LazyModuleImp.scala index 7d3f63c..5322192 100644 --- a/diplomacy/src/diplomacy/lazymodule/LazyModuleImp.scala +++ b/diplomacy/src/diplomacy/lazymodule/LazyModuleImp.scala @@ -67,7 +67,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 } }