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
|
2017-11-01 00:29:06 +01:00
|
|
|
import freechips.rocketchip.util.{SynchronizerShiftReg, AsyncResetReg}
|
2017-10-20 05:44:54 +02:00
|
|
|
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
|
|
|
|
{
|
2017-12-01 20:27:54 +01:00
|
|
|
def apply(alreadyRegistered: Boolean = false)(implicit p: Parameters) =
|
|
|
|
{
|
|
|
|
val intsource = LazyModule(new IntSyncCrossingSource(alreadyRegistered))
|
|
|
|
intsource.node
|
|
|
|
}
|
2017-10-20 07:19:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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 {
|
2017-11-01 00:29:06 +01:00
|
|
|
out.sync := AsyncResetReg(Cat(in.reverse)).toBools
|
2017-10-20 07:19:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2017-12-01 20:27:54 +01:00
|
|
|
def apply(sync: Int = 3)(implicit p: Parameters) =
|
|
|
|
{
|
|
|
|
val intsink = LazyModule(new IntSyncCrossingSink(sync))
|
|
|
|
intsink.node
|
|
|
|
}
|
2017-10-20 07:19:19 +02:00
|
|
|
}
|