diff options
| author | Albert Magyar | 2020-06-08 12:14:10 -0700 |
|---|---|---|
| committer | GitHub | 2020-06-08 19:14:10 +0000 |
| commit | 99ac8a134b134713913036013ffdec98ec92c73a (patch) | |
| tree | 481c3a78aa6beee72a6956a6e78251ad7b33842a /core/src | |
| parent | 161938b84013a6c3307abc2707f541deddf487b4 (diff) | |
Report Builder.error errors as exceptions outside hardware context (#1425)
* Immediately throw Builder.error errors outside hardware context
* Add example of hidden no-hardware-context error from #1422
Co-authored-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/main/scala/chisel3/internal/Builder.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/src/main/scala/chisel3/internal/Builder.scala b/core/src/main/scala/chisel3/internal/Builder.scala index 7e521812..bacc9fee 100644 --- a/core/src/main/scala/chisel3/internal/Builder.scala +++ b/core/src/main/scala/chisel3/internal/Builder.scala @@ -387,7 +387,13 @@ private[chisel3] object Builder { } def errors: ErrorLog = dynamicContext.errors - def error(m: => String): Unit = if (dynamicContextVar.value.isDefined) errors.error(m) + def error(m: => String): Unit = { + if (dynamicContextVar.value.isDefined) { + errors.error(m) + } else { + throwException(m) + } + } def warning(m: => String): Unit = if (dynamicContextVar.value.isDefined) errors.warning(m) def deprecated(m: => String, location: Option[String] = None): Unit = if (dynamicContextVar.value.isDefined) errors.deprecated(m, location) |
