From dbf599f6a1dfe941c48df4f00298a82dd5dafd96 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Tue, 19 Sep 2017 12:05:00 -0700 Subject: [PATCH] Support SynchronizerShiftReg(sync = 0) This makes it easier to parameterize code where the synchronizer might not always be needed. --- src/main/scala/util/ShiftReg.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/scala/util/ShiftReg.scala b/src/main/scala/util/ShiftReg.scala index 917447f8..f8827c2d 100644 --- a/src/main/scala/util/ShiftReg.scala +++ b/src/main/scala/util/ShiftReg.scala @@ -125,8 +125,10 @@ class SynchronizerShiftReg(w: Int = 1, sync: Int = 3) extends AbstractPipelineRe object SynchronizerShiftReg { - def apply [T <: Chisel.Data](in: T, sync: Int = 3, name: Option[String] = None): T = - AbstractPipelineReg(new SynchronizerShiftReg(in.getWidth, sync), in, name) + def apply [T <: Chisel.Data](in: T, sync: Int = 3, name: Option[String] = None): T = { + if (sync == 0) in + else AbstractPipelineReg(new SynchronizerShiftReg(in.getWidth, sync), in, name) + } } class SyncResetSynchronizerShiftReg(w: Int = 1, sync: Int = 3, init: Int = 0) extends AbstractPipelineReg(w) {