diff options
| author | Jim Lawson | 2016-12-02 12:51:03 -0800 |
|---|---|---|
| committer | GitHub | 2016-12-02 12:51:03 -0800 |
| commit | d3ec37edd39799e8cf039e5caed915c00dff7eeb (patch) | |
| tree | 03329ddc11ca15b9d6c7f832354a9cba20c87843 /chiselFrontend/src/main/scala/chisel3/internal/Builder.scala | |
| parent | 1b53d893816d349f5ea18fa0ed13325b9f1b6917 (diff) | |
| parent | eba224e524b249207b47a3b378458c61c9b66e2c (diff) | |
Merge branch 'master' into exceptionfix
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/internal/Builder.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/internal/Builder.scala | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala b/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala index 381626c5..828f1583 100644 --- a/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala +++ b/chiselFrontend/src/main/scala/chisel3/internal/Builder.scala @@ -124,7 +124,7 @@ private[chisel3] trait HasId extends InstanceId { case None => throwException(s"$instanceName doesn't have a parent") } def parentModName = _parent match { - case Some(p) => p.modName + case Some(p) => p.name case None => throwException(s"$instanceName doesn't have a parent") } @@ -146,6 +146,9 @@ private[chisel3] class DynamicContext() { val globalNamespace = new Namespace(None, Set()) val components = ArrayBuffer[Component]() var currentModule: Option[Module] = None + // Set by object Module.apply before calling class Module constructor + // Used to distinguish between no Module() wrapping, multiple wrappings, and rewrapping + var readyForModuleConstr: Boolean = false val errors = new ErrorLog } @@ -170,11 +173,18 @@ private[chisel3] object Builder { // A bare api call is, e.g. calling Wire() from the scala console). ) } + def readyForModuleConstr: Boolean = dynamicContext.readyForModuleConstr + def readyForModuleConstr_=(target: Boolean): Unit = { + dynamicContext.readyForModuleConstr = target + } // TODO(twigg): Ideally, binding checks and new bindings would all occur here // However, rest of frontend can't support this yet. def pushCommand[T <: Command](c: T): T = { - forcedModule._commands += c + forcedModule match { + case _: BlackBox => throwException("Cannot add hardware to a BlackBox") + case m => m._commands += c + } c } def pushOp[T <: Data](cmd: DefPrim[T]): T = { |
