summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/chisel3/core/Reg.scala
diff options
context:
space:
mode:
authorJack Koenig2017-02-16 11:02:21 -0800
committerGitHub2017-02-16 11:02:21 -0800
commit563f348ca3e4a984ad23caba9e980dab8fa808bb (patch)
tree46dfe1e3a0a76b2f106a48332e55237ef237f441 /chiselFrontend/src/main/scala/chisel3/core/Reg.scala
parentd00a3fe9a3df5ce888b5c461181aadbd4a293bf3 (diff)
Add support for clock and reset scoping (#509)
withClockAndReset, withReset, and withClock allow changing the implicit clock and reset. Module.clock and Module.reset provide access to the current implicit clock and reset.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Reg.scala')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/Reg.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Reg.scala b/chiselFrontend/src/main/scala/chisel3/core/Reg.scala
index 30abe5e5..1287ac2f 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/Reg.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/Reg.scala
@@ -68,7 +68,8 @@ object Reg {
// to resolve all use cases. If the type inferencer / implicit resolution
// system improves, this may be changed.
val x = makeType(compileOptions, t, next, init)
- val clock = Node(x._parent.get.clock) // TODO multi-clock
+ val clock = Node(Builder.forcedClock)
+ val reset = Node(Builder.forcedReset)
// Bind each element of x to being a Reg
Binding.bind(x, RegBinder(Builder.forcedModule), "Error: t")
@@ -77,7 +78,7 @@ object Reg {
pushCommand(DefReg(sourceInfo, x, clock))
} else {
Binding.checkSynthesizable(init, s"'init' ($init)")
- pushCommand(DefRegInit(sourceInfo, x, clock, Node(x._parent.get.reset), init.ref))
+ pushCommand(DefRegInit(sourceInfo, x, clock, reset, init.ref))
}
if (next != null) {
Binding.checkSynthesizable(next, s"'next' ($next)")