1
0

ShiftRegInit: use the rocket-chip version since it is there now

This commit is contained in:
Megan Wachs 2017-09-05 17:51:40 -07:00
parent 7d07e3af0b
commit c68d556768
4 changed files with 10 additions and 10 deletions

View File

@ -3,9 +3,8 @@ package sifive.blocks.devices.i2c
import Chisel._ import Chisel._
import chisel3.experimental.{withClockAndReset} import chisel3.experimental.{withClockAndReset}
import freechips.rocketchip.util.ShiftRegInit
import sifive.blocks.devices.pinctrl.{Pin, PinCtrl} import sifive.blocks.devices.pinctrl.{Pin, PinCtrl}
import sifive.blocks.util.ShiftRegisterInit
class I2CPins[T <: Pin](pingen: () => T) extends Bundle { class I2CPins[T <: Pin](pingen: () => T) extends Bundle {
@ -19,11 +18,11 @@ class I2CPins[T <: Pin](pingen: () => T) extends Bundle {
withClockAndReset(clock, reset) { withClockAndReset(clock, reset) {
scl.outputPin(i2c.scl.out, pue=true.B, ie = true.B) scl.outputPin(i2c.scl.out, pue=true.B, ie = true.B)
scl.o.oe := i2c.scl.oe scl.o.oe := i2c.scl.oe
i2c.scl.in := ShiftRegisterInit(scl.i.ival, syncStages, Bool(true)) i2c.scl.in := ShiftRegInit(scl.i.ival, syncStages, init = Bool(true))
sda.outputPin(i2c.sda.out, pue=true.B, ie = true.B) sda.outputPin(i2c.sda.out, pue=true.B, ie = true.B)
sda.o.oe := i2c.sda.oe sda.o.oe := i2c.sda.oe
i2c.sda.in := ShiftRegisterInit(sda.i.ival, syncStages, Bool(true)) i2c.sda.in := ShiftRegInit(sda.i.ival, syncStages, init = Bool(true))
} }
} }
} }

View File

@ -3,6 +3,7 @@ package sifive.blocks.devices.mockaon
import Chisel._ import Chisel._
import freechips.rocketchip.config.Field import freechips.rocketchip.config.Field
import freechips.rocketchip.util.SynchronizerShiftReg
import freechips.rocketchip.coreplex.{HasPeripheryBus, HasInterruptBus} import freechips.rocketchip.coreplex.{HasPeripheryBus, HasInterruptBus}
import freechips.rocketchip.devices.debug.HasPeripheryDebug import freechips.rocketchip.devices.debug.HasPeripheryDebug
import freechips.rocketchip.devices.tilelink.HasPeripheryClint import freechips.rocketchip.devices.tilelink.HasPeripheryClint
@ -43,7 +44,7 @@ trait HasPeripheryMockAONModuleImp extends LazyMultiIOModuleImp with HasPeripher
outer.aon.module.reset := Bool(true) outer.aon.module.reset := Bool(true)
// Synchronize the external toggle into the clint // Synchronize the external toggle into the clint
val rtc_sync = ShiftRegister(outer.aon.module.io.rtc.asUInt.toBool, 3) val rtc_sync = SynchronizerShiftReg(outer.aon.module.io.rtc.asUInt.toBool, 3, Some("rtc"))
val rtc_last = Reg(init = Bool(false), next=rtc_sync) val rtc_last = Reg(init = Bool(false), next=rtc_sync)
val rtc_tick = Reg(init = Bool(false), next=(rtc_sync & (~rtc_last))) val rtc_tick = Reg(init = Bool(false), next=(rtc_sync & (~rtc_last)))

View File

@ -2,7 +2,7 @@
package sifive.blocks.devices.spi package sifive.blocks.devices.spi
import Chisel._ import Chisel._
import sifive.blocks.util.ShiftRegisterInit import freechipchips.rocketchip.util.ShiftRegInit
class SPIMicroOp(c: SPIParamsBase) extends SPIBundle(c) { class SPIMicroOp(c: SPIParamsBase) extends SPIBundle(c) {
val fn = Bits(width = 1) val fn = Bits(width = 1)
@ -39,8 +39,8 @@ class SPIPhysical(c: SPIParamsBase) extends Module {
val last = Wire(init = Bool(false)) val last = Wire(init = Bool(false))
// Delayed versions // Delayed versions
val setup_d = Reg(next = setup) val setup_d = Reg(next = setup)
val sample_d = ShiftRegisterInit(sample, c.sampleDelay, Bool(false)) val sample_d = ShiftRegInit(sample, c.sampleDelay, init = Bool(false))
val last_d = ShiftRegisterInit(last, c.sampleDelay, Bool(false)) val last_d = ShiftRegInit(last, c.sampleDelay, init = Bool(false))
val scnt = Reg(init = UInt(0, c.countBits)) val scnt = Reg(init = UInt(0, c.countBits))
val tcnt = Reg(io.ctrl.sck.div) val tcnt = Reg(io.ctrl.sck.div)

View File

@ -4,10 +4,10 @@ package sifive.blocks.devices.uart
import Chisel._ import Chisel._
import chisel3.experimental.{withClockAndReset} import chisel3.experimental.{withClockAndReset}
import freechips.rocketchip.config.Field import freechips.rocketchip.config.Field
import freechips.rocketchip.util.ShiftRegInit
import freechips.rocketchip.coreplex.{HasPeripheryBus, PeripheryBusParams, HasInterruptBus} import freechips.rocketchip.coreplex.{HasPeripheryBus, PeripheryBusParams, HasInterruptBus}
import freechips.rocketchip.diplomacy.{LazyModule, LazyMultiIOModuleImp} import freechips.rocketchip.diplomacy.{LazyModule, LazyMultiIOModuleImp}
import sifive.blocks.devices.pinctrl.{Pin} import sifive.blocks.devices.pinctrl.{Pin}
import sifive.blocks.util.ShiftRegisterInit
case object PeripheryUARTKey extends Field[Seq[UARTParams]] case object PeripheryUARTKey extends Field[Seq[UARTParams]]
@ -51,7 +51,7 @@ class UARTPins[T <: Pin] (pingen: () => T) extends Bundle {
withClockAndReset(clock, reset) { withClockAndReset(clock, reset) {
txd.outputPin(uart.txd) txd.outputPin(uart.txd)
val rxd_t = rxd.inputPin() val rxd_t = rxd.inputPin()
uart.rxd := ShiftRegisterInit(rxd_t, syncStages, Bool(true)) uart.rxd := ShiftRegInit(rxd_t, n = syncStages, init = Bool(true))
} }
} }
} }