2017-10-20 05:44:54 +02:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
|
|
|
|
package freechips.rocketchip.interrupts
|
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import freechips.rocketchip.config.Parameters
|
|
|
|
import freechips.rocketchip.util.SynchronizerShiftReg
|
|
|
|
import freechips.rocketchip.diplomacy._
|
|
|
|
|
|
|
|
@deprecated("IntXing does not ensure interrupt source is glitch free. Use IntSyncSource and IntSyncSink", "rocket-chip 1.2")
|
|
|
|
class IntXing(sync: Int = 3)(implicit p: Parameters) extends LazyModule
|
|
|
|
{
|
|
|
|
val intnode = IntAdapterNode()
|
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) {
|
|
|
|
(intnode.in zip intnode.out) foreach { case ((in, _), (out, _)) =>
|
|
|
|
out := SynchronizerShiftReg(in, sync)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-10-20 07:19:19 +02:00
|
|
|
|
|
|
|
object IntSyncCrossingSource
|
|
|
|
{
|
|
|
|
def apply(alreadyRegistered: Boolean = false)(implicit p: Parameters) = LazyModule(new IntSyncCrossingSource(alreadyRegistered)).node
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class IntSyncCrossingSource(alreadyRegistered: Boolean = false)(implicit p: Parameters) extends LazyModule
|
|
|
|
{
|
2017-10-26 22:11:47 +02:00
|
|
|
val node = IntSyncSourceNode(alreadyRegistered)
|
2017-10-20 07:19:19 +02:00
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) {
|
|
|
|
(node.in zip node.out) foreach { case ((in, edgeIn), (out, edgeOut)) =>
|
|
|
|
if (alreadyRegistered) {
|
|
|
|
out.sync := in
|
|
|
|
} else {
|
|
|
|
out.sync := RegNext(in)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class IntSyncCrossingSink(sync: Int = 3)(implicit p: Parameters) extends LazyModule
|
|
|
|
{
|
2017-10-26 22:11:47 +02:00
|
|
|
val node = IntSyncSinkNode(sync)
|
2017-10-20 07:19:19 +02:00
|
|
|
|
|
|
|
lazy val module = new LazyModuleImp(this) {
|
|
|
|
(node.in zip node.out) foreach { case ((in, edgeIn), (out, edgeOut)) =>
|
|
|
|
out := SynchronizerShiftReg(in.sync, sync)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
object IntSyncCrossingSink
|
|
|
|
{
|
|
|
|
def apply(sync: Int = 3)(implicit p: Parameters) = LazyModule(new IntSyncCrossingSink(sync)).node
|
|
|
|
}
|