diff options
| author | grebe | 2016-12-22 15:01:48 -0500 |
|---|---|---|
| committer | GitHub | 2016-12-22 15:01:48 -0500 |
| commit | 33854075e4c50995d0011f773813571535a830fa (patch) | |
| tree | 56bb7e5ad2111ae3cb3c5f6dbf0a1a65f878a674 /chiselFrontend | |
| parent | 033e71a69767664c4bfae246d6cef2e2880c4404 (diff) | |
| parent | 4eebd787312792f7a3722af61ab7e6349081d3b4 (diff) | |
Merge branch 'master' into fixedPointFromBits
Diffstat (limited to 'chiselFrontend')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala | 4 | ||||
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/internal/Builder.scala | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala index 9bbf9d0e..26c971b3 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala @@ -408,12 +408,12 @@ class Bundle extends Aggregate { constructor.newInstance(_parent.get).asInstanceOf[this.type] } catch { case _: java.lang.reflect.InvocationTargetException | _: java.lang.IllegalArgumentException => - Builder.error(s"Parameterized Bundle ${this.getClass} needs cloneType method. You are probably using " + + Builder.exception(s"Parameterized Bundle ${this.getClass} needs cloneType method. You are probably using " + "an anonymous Bundle object that captures external state and hence is un-cloneTypeable") this } case _: java.lang.reflect.InvocationTargetException | _: java.lang.IllegalArgumentException => - Builder.error(s"Parameterized Bundle ${this.getClass} needs cloneType method") + Builder.exception(s"Parameterized Bundle ${this.getClass} needs cloneType method") this } } diff --git a/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala b/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala index 7a77763b..6e463311 100644 --- a/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala +++ b/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala @@ -170,7 +170,7 @@ private[chisel3] object Builder { } def forcedModule: Module = currentModule match { case Some(module) => module - case None => throw new Exception( + case None => throwException( "Error: Not in a Module. Likely cause: Missed Module() wrap or bare chisel API call." // A bare api call is, e.g. calling Wire() from the scala console). ) @@ -200,6 +200,16 @@ private[chisel3] object Builder { def warning(m: => String): Unit = errors.warning(m) def deprecated(m: => String): Unit = errors.deprecated(m) + /** Record an exception as an error, and throw it. + * + * @param m exception message + */ + @throws(classOf[ChiselException]) + def exception(m: => String): Unit = { + error(m) + throwException(m) + } + def build[T <: Module](f: => T): Circuit = { dynamicContextVar.withValue(Some(new DynamicContext())) { errors.info("Elaborating design...") |
