-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2641 from chipsalliance/beu-interrupt-cdc-hcook
Define ResetCrossingType and use with BlockDuringReset in TilePRCIDomain
- Loading branch information
Showing
33 changed files
with
602 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,39 @@ | ||
// See LICENSE.SiFive for license details. | ||
|
||
package freechips.rocketchip.diplomacy | ||
import freechips.rocketchip.util.{RationalDirection, FastToSlow, AsyncQueueParams, CreditedDelay} | ||
|
||
trait HasClockDomainCrossing extends LazyScope { this: LazyModule => } | ||
// TODO this should all be moved to package freechips.rocketchip.prci now that it exists | ||
|
||
trait CrossingType | ||
|
||
trait HasDomainCrossing extends LazyScope { this: LazyModule => | ||
type DomainCrossingType <: CrossingType | ||
} | ||
|
||
trait HasClockDomainCrossing extends HasDomainCrossing { this: LazyModule => | ||
type DomainCrossingType = ClockCrossingType | ||
} | ||
|
||
/** Enumerates the types of clock crossings generally supported by Diplomatic bus protocols */ | ||
sealed trait ClockCrossingType extends CrossingType | ||
{ | ||
def sameClock = this match { | ||
case _: SynchronousCrossing | _: CreditedCrossing => true | ||
case _ => false | ||
} | ||
} | ||
|
||
case object NoCrossing // converts to SynchronousCrossing(BufferParams.none) via implicit def in package | ||
case class SynchronousCrossing(params: BufferParams = BufferParams.default) extends ClockCrossingType | ||
case class RationalCrossing(direction: RationalDirection = FastToSlow) extends ClockCrossingType | ||
case class AsynchronousCrossing(depth: Int = 8, sourceSync: Int = 3, sinkSync: Int = 3, safe: Boolean = true, narrow: Boolean = false) extends ClockCrossingType | ||
{ | ||
def asSinkParams = AsyncQueueParams(depth, sinkSync, safe, narrow) | ||
} | ||
case class CreditedCrossing(sourceDelay: CreditedDelay, sinkDelay: CreditedDelay) extends ClockCrossingType | ||
|
||
object CreditedCrossing { | ||
def apply(delay: CreditedDelay): CreditedCrossing = CreditedCrossing(delay, delay.flip) | ||
def apply(): CreditedCrossing = CreditedCrossing(CreditedDelay(1, 1)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// See LICENSE.SiFive for license details. | ||
|
||
package freechips.rocketchip.interrupts | ||
|
||
import freechips.rocketchip.config.Parameters | ||
import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp} | ||
import freechips.rocketchip.util.BlockDuringReset | ||
|
||
/** BlockDuringReset ensures that no interrupt is raised while reset is raised. */ | ||
class IntBlockDuringReset(stretchResetCycles: Int = 0)(implicit p: Parameters) extends LazyModule | ||
{ | ||
val intnode = IntAdapterNode() | ||
override def shouldBeInlined = true | ||
lazy val module = new LazyModuleImp(this) { | ||
intnode.in.zip(intnode.out).foreach { case ((in, _), (out, _)) => | ||
in.zip(out).foreach { case (i, o) => o := BlockDuringReset(i, stretchResetCycles) } | ||
} | ||
} | ||
} | ||
|
||
object IntBlockDuringReset { | ||
def apply(stretchResetCycles: Int = 0)(implicit p: Parameters): IntNode = { | ||
val block_during_reset = LazyModule(new IntBlockDuringReset(stretchResetCycles)) | ||
block_during_reset.intnode | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// See LICENSE.SiFive for license details. | ||
|
||
package freechips.rocketchip.prci | ||
|
||
import chisel3._ | ||
import freechips.rocketchip.config.{Parameters} | ||
import freechips.rocketchip.diplomacy._ | ||
import freechips.rocketchip.diplomacy.BundleBridgeNexus.fillN | ||
import freechips.rocketchip.util.{BlockDuringReset, Blockable} | ||
|
||
object BundleBridgeBlockDuringReset { | ||
def apply[T <: Data : Blockable]( | ||
resetCrossingType: ResetCrossingType, | ||
name: Option[String] = None, | ||
registered: Boolean = false, | ||
default: Option[() => T] = None, | ||
inputRequiresOutput: Boolean = false, | ||
shouldBeInlined: Boolean = true | ||
)(implicit p: Parameters): BundleBridgeNexusNode[T] = { | ||
val nexus = LazyModule(new BundleBridgeNexus[T]( | ||
inputFn = (s: Seq[T]) => { | ||
val data = BundleBridgeNexus.requireOne[T](registered)(s) | ||
resetCrossingType match { | ||
case _: NoResetCrossing => data | ||
case s: StretchedResetCrossing => BlockDuringReset(data, s.cycles) | ||
} | ||
}, | ||
outputFn = fillN[T](registered) _, | ||
default = default, | ||
inputRequiresOutput = inputRequiresOutput, | ||
shouldBeInlined = shouldBeInlined | ||
)) | ||
name.foreach(nexus.suggestName(_)) | ||
nexus.node | ||
} | ||
} |
Oops, something went wrong.