diff options
Diffstat (limited to 'src/main/scala/Chisel/Module.scala')
| -rw-r--r-- | src/main/scala/Chisel/Module.scala | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/src/main/scala/Chisel/Module.scala b/src/main/scala/Chisel/Module.scala index 1c1c02de..f799a7ce 100644 --- a/src/main/scala/Chisel/Module.scala +++ b/src/main/scala/Chisel/Module.scala @@ -6,37 +6,27 @@ import Builder.pushCommand import Builder.dynamicContext object Module { - // TODO: update documentation when parameters gets removed from core Chisel - // and this gets simplified. /** A wrapper method that all Module instantiations must be wrapped in * (necessary to help Chisel track internal state). * * @param m the Module being created - * @param p Parameters passed down implicitly from that it is created in * - * @return the input module `m` + * @return the input module `m` with Chisel metadata properly set */ - def apply[T <: Module](bc: => T)(implicit currParams: Parameters = Builder.getParams.push): T = { - paramsScope(currParams) { - val parent = dynamicContext.currentModule - val m = bc.setRefs() - // init module outputs - m._commands prependAll (for (p <- m.io.flatten; if p.dir == OUTPUT) - yield Connect(p.lref, p.fromInt(0).ref)) - dynamicContext.currentModule = parent - val ports = m.computePorts - Builder.components += Component(m, m.name, ports, m._commands) - pushCommand(DefInstance(m, ports)) - // init instance inputs - for (p <- m.io.flatten; if p.dir == INPUT) - p := p.fromInt(0) - m - }.connectImplicitIOs() - } - - //TODO @deprecated("Use Chisel.paramsScope object","08-01-2015") - def apply[T <: Module](m: => T, f: PartialFunction[Any,Any]): T = { - apply(m)(Builder.getParams.alterPartial(f)) + def apply[T <: Module](bc: => T): T = { + val parent = dynamicContext.currentModule + val m = bc.setRefs() + // init module outputs + m._commands prependAll (for (p <- m.io.flatten; if p.dir == OUTPUT) + yield Connect(p.lref, p.fromInt(0).ref)) + dynamicContext.currentModule = parent + val ports = m.computePorts + Builder.components += Component(m, m.name, ports, m._commands) + pushCommand(DefInstance(m, ports)) + // init instance inputs + for (p <- m.io.flatten; if p.dir == INPUT) + p := p.fromInt(0) + m.connectImplicitIOs() } } |
