1 // See LICENSE for license details.
2 package sifive.blocks.util
5 import freechips.rocketchip.util.AsyncResetRegVec
7 /** Reset: asynchronous assert,
8 * synchronous de-assert
12 class ResetCatchAndSync (sync: Int = 3) extends Module {
15 val sync_reset = Bool(OUTPUT)
18 val reset_n_catch_reg = Module (new AsyncResetRegVec(sync, 0))
20 reset_n_catch_reg.io.en := Bool(true)
21 reset_n_catch_reg.io.d := Cat(Bool(true), reset_n_catch_reg.io.q >> 1)
23 io.sync_reset := ~reset_n_catch_reg.io.q(0)
27 object ResetCatchAndSync {
29 def apply(clk: Clock, rst: Bool, sync: Int = 3, name: Option[String] = None): Bool = {
31 val catcher = Module (new ResetCatchAndSync(sync))
32 if (name.isDefined) {catcher.suggestName(name.get)}
39 def apply(clk: Clock, rst: Bool, sync: Int, name: String): Bool = apply(clk, rst, sync, Some(name))
40 def apply(clk: Clock, rst: Bool, name: String): Bool = apply(clk, rst, name = Some(name))