aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Waterman2016-06-10 00:44:00 -0700
committerAndrew Waterman2016-06-10 01:14:12 -0700
commit7afe9f6180a53fd9f024c67d78289689a601c8b7 (patch)
tree764a780ad3dd8bb94421ca88ca65be24a86c04dc /src
parent0b4446fd9bb18f26150d6b21e129362b76ae2ac1 (diff)
Fix Verilog codegen for reg
Previously, we emitted if-else sequences for reg updates. Recent improvements to FIRRTL resulted in the emission of explicit mux networks instead. While equivalent, doing so reduces QoR, presumably because ECAD tools are tuned to the habits of manual Verilog coders. This seems to be a result of WRefs appearing between the regs and muxes. Chasing down the sources of the WRefs corrects the code generation. This patch reduces the Rocket pipeline area by about 2% and improves rocket-chip's Verilator performance by about 8%.
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/firrtl/Emitter.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/scala/firrtl/Emitter.scala b/src/main/scala/firrtl/Emitter.scala
index 14e8fbd7..eb8eba32 100644
--- a/src/main/scala/firrtl/Emitter.scala
+++ b/src/main/scala/firrtl/Emitter.scala
@@ -320,7 +320,7 @@ class VerilogEmitter extends Emitter {
}
def update_and_reset(r: Expression, clk: Expression, reset: Expression, init: Expression) = {
def addUpdate(e: Expression, tabs: String): Seq[Seq[Any]] = {
- e match {
+ netlist.getOrElse(e, e) match {
case m: Mux => {
val ifStatement = Seq(tabs, "if(", m.cond, ") begin")
val trueCase = addUpdate(m.tval, tabs + tab)