1
0

ResetCatchAndSync: work also in the context of a RawModule (#1202)

This commit is contained in:
Wesley W. Terpstra 2018-01-19 19:45:52 -08:00 committed by GitHub
parent f6f5606f8e
commit c32150b994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
package freechips.rocketchip.util package freechips.rocketchip.util
import Chisel._ import Chisel._
import chisel3.experimental.{withClockAndReset}
/** Reset: asynchronous assert, /** Reset: asynchronous assert,
* synchronous de-assert * synchronous de-assert
@ -28,12 +29,12 @@ object ResetCatchAndSync {
def apply(clk: Clock, rst: Bool, sync: Int = 3, name: Option[String] = None, def apply(clk: Clock, rst: Bool, sync: Int = 3, name: Option[String] = None,
psd: Option[PSDTestMode] = None): Bool = { psd: Option[PSDTestMode] = None): Bool = {
val catcher = Module (new ResetCatchAndSync(sync)) withClockAndReset(clk, rst) {
if (name.isDefined) {catcher.suggestName(name.get)} val catcher = Module (new ResetCatchAndSync(sync))
catcher.clock := clk if (name.isDefined) {catcher.suggestName(name.get)}
catcher.reset := rst catcher.io.psd <> psd.getOrElse(Wire(new PSDTestMode()).fromBits(UInt(0)))
catcher.io.psd <> psd.getOrElse(Wire(new PSDTestMode()).fromBits(UInt(0))) catcher.io.sync_reset
catcher.io.sync_reset }
} }
def apply(clk: Clock, rst: Bool, sync: Int, name: String): Bool = apply(clk, rst, sync, Some(name)) def apply(clk: Clock, rst: Bool, sync: Int, name: String): Bool = apply(clk, rst, sync, Some(name))