summaryrefslogtreecommitdiff
path: root/src/main/scala/Chisel/Reg.scala
diff options
context:
space:
mode:
authorAndrew Waterman2016-01-27 15:18:49 -0800
committerAndrew Waterman2016-01-27 15:18:49 -0800
commit2a3b5fc59c732d85aafda78f2fb21368dc4a5660 (patch)
treeed56cd131bc2b80140b71b4467c1e05d235653a0 /src/main/scala/Chisel/Reg.scala
parent9017ec37d0eb7bb3bd10ed7863c0706ff1020cd9 (diff)
New FIRRTL syntax for reg
Diffstat (limited to 'src/main/scala/Chisel/Reg.scala')
-rw-r--r--src/main/scala/Chisel/Reg.scala10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/scala/Chisel/Reg.scala b/src/main/scala/Chisel/Reg.scala
index f166c84b..e69061c5 100644
--- a/src/main/scala/Chisel/Reg.scala
+++ b/src/main/scala/Chisel/Reg.scala
@@ -45,10 +45,12 @@ object Reg {
// to resolve all use cases. If the type inferencer / implicit resolution
// system improves, this may be changed.
val x = makeType(t, next, init)
- val (resetEn, resetVal) =
- if (init != null) (Node(x._parent.get.reset), init)
- else (ULit(0, Width(1)), x)
- pushCommand(DefRegister(x, Node(x._parent.get.clock), resetEn, resetVal.ref)) // TODO multi-clock
+ val clock = Node(x._parent.get.clock) // TODO multi-clock
+ if (init == null) {
+ pushCommand(DefReg(x, clock))
+ } else {
+ pushCommand(DefRegInit(x, clock, Node(x._parent.get.reset), init.ref))
+ }
if (next != null) {
x := next
}