1
0

Don't route PLIC interrupts through PRCI

The PLIC is local to the Coreplex, and PRCI should not be.
This commit is contained in:
Andrew Waterman 2016-09-13 16:25:31 -07:00
parent 38b13da2f4
commit 5566bf1b13
5 changed files with 34 additions and 36 deletions

View File

@ -174,17 +174,14 @@ class DefaultCoreplex(tp: Parameters, tc: CoreplexConfig) extends Coreplex()(tp,
prci.io.tl <> mmioNetwork.port("int:prci") prci.io.tl <> mmioNetwork.port("int:prci")
prci.io.rtcTick := io.rtcTick prci.io.rtcTick := io.rtcTick
(prci.io.tiles, tileResets, tileList).zipped.foreach { // connect coreplex-internal interrupts to tiles
case (prci, rst, tile) => for (((tile, tileReset), i) <- (tileList zip tileResets) zipWithIndex) {
rst := reset tileReset := prci.io.tiles(i).reset
tile.io.prci <> prci tile.io.interrupts := prci.io.tiles(i).interrupts
} tile.io.interrupts.meip := plic.io.harts(plic.cfg.context(i, 'M'))
tile.io.interrupts.seip.foreach(_ := plic.io.harts(plic.cfg.context(i, 'S')))
for (i <- 0 until tc.nTiles) { tile.io.interrupts.debug := debugModule.io.debugInterrupts(i)
prci.io.interrupts(i).meip := plic.io.harts(plic.cfg.context(i, 'M')) tile.io.hartid := i
if (p(UseVM))
prci.io.interrupts(i).seip := plic.io.harts(plic.cfg.context(i, 'S'))
prci.io.interrupts(i).debug := debugModule.io.debugInterrupts(i)
} }
val tileSlavePorts = (0 until tc.nTiles) map (i => s"int:dmem$i") filter (ioAddrMap contains _) val tileSlavePorts = (0 until tc.nTiles) map (i => s"int:dmem$i") filter (ioAddrMap contains _)

View File

@ -61,6 +61,14 @@ class DCSR extends Bundle {
val prv = UInt(width = PRV.SZ) val prv = UInt(width = PRV.SZ)
} }
class TileInterrupts(implicit p: Parameters) extends CoreBundle()(p) {
val debug = Bool()
val mtip = Bool()
val msip = Bool()
val meip = Bool()
val seip = usingVM.option(Bool())
}
class MIP extends Bundle { class MIP extends Bundle {
val rocc = Bool() val rocc = Bool()
val meip = Bool() val meip = Bool()
@ -121,7 +129,8 @@ object CSR
} }
class CSRFileIO(implicit p: Parameters) extends CoreBundle { class CSRFileIO(implicit p: Parameters) extends CoreBundle {
val prci = new PRCITileIO().flip val interrupts = new TileInterrupts().asInput
val hartid = UInt(INPUT, xLen)
val rw = new Bundle { val rw = new Bundle {
val addr = UInt(INPUT, CSR.ADDRSZ) val addr = UInt(INPUT, CSR.ADDRSZ)
val cmd = Bits(INPUT, CSR.SZ) val cmd = Bits(INPUT, CSR.SZ)
@ -297,7 +306,7 @@ class CSRFile(implicit p: Parameters) extends CoreModule()(p)
CSRs.mepc -> reg_mepc.sextTo(xLen), CSRs.mepc -> reg_mepc.sextTo(xLen),
CSRs.mbadaddr -> reg_mbadaddr.sextTo(xLen), CSRs.mbadaddr -> reg_mbadaddr.sextTo(xLen),
CSRs.mcause -> reg_mcause, CSRs.mcause -> reg_mcause,
CSRs.mhartid -> io.prci.id) CSRs.mhartid -> io.hartid)
val debug_csrs = collection.immutable.ListMap( val debug_csrs = collection.immutable.ListMap(
CSRs.dcsr -> reg_dcsr.asUInt, CSRs.dcsr -> reg_dcsr.asUInt,
@ -611,8 +620,8 @@ class CSRFile(implicit p: Parameters) extends CoreModule()(p)
} }
} }
reg_mip := io.prci.interrupts reg_mip := io.interrupts
reg_dcsr.debugint := io.prci.interrupts.debug reg_dcsr.debugint := io.interrupts.debug
reg_sptbr.asid := 0 reg_sptbr.asid := 0
if (nBreakpoints <= 1) reg_tselect := 0 if (nBreakpoints <= 1) reg_tselect := 0

View File

@ -143,7 +143,8 @@ object ImmGen {
class Rocket(implicit p: Parameters) extends CoreModule()(p) { class Rocket(implicit p: Parameters) extends CoreModule()(p) {
val io = new Bundle { val io = new Bundle {
val prci = new PRCITileIO().flip val interrupts = new TileInterrupts().asInput
val hartid = UInt(INPUT, xLen)
val imem = new FrontendIO()(p.alterPartial({case CacheName => "L1I" })) val imem = new FrontendIO()(p.alterPartial({case CacheName => "L1I" }))
val dmem = new HellaCacheIO()(p.alterPartial({ case CacheName => "L1D" })) val dmem = new HellaCacheIO()(p.alterPartial({ case CacheName => "L1D" }))
val ptw = new DatapathPTWIO().flip val ptw = new DatapathPTWIO().flip
@ -514,7 +515,8 @@ class Rocket(implicit p: Parameters) extends CoreModule()(p) {
csr.io.exception := wb_reg_xcpt csr.io.exception := wb_reg_xcpt
csr.io.cause := wb_reg_cause csr.io.cause := wb_reg_cause
csr.io.retire := wb_valid csr.io.retire := wb_valid
csr.io.prci <> io.prci csr.io.interrupts := io.interrupts
csr.io.hartid := io.hartid
io.fpu.fcsr_rm := csr.io.fcsr_rm io.fpu.fcsr_rm := csr.io.fcsr_rm
csr.io.fcsr_flags := io.fpu.fcsr_flags csr.io.fcsr_flags := io.fpu.fcsr_flags
csr.io.rocc.interrupt <> io.rocc.interrupt csr.io.rocc.interrupt <> io.rocc.interrupt
@ -681,7 +683,7 @@ class Rocket(implicit p: Parameters) extends CoreModule()(p) {
} }
else { else {
printf("C%d: %d [%d] pc=[%x] W[r%d=%x][%d] R[r%d=%x] R[r%d=%x] inst=[%x] DASM(%x)\n", printf("C%d: %d [%d] pc=[%x] W[r%d=%x][%d] R[r%d=%x] R[r%d=%x] inst=[%x] DASM(%x)\n",
io.prci.id, csr.io.time(31,0), wb_valid, wb_reg_pc, io.hartid, csr.io.time(31,0), wb_valid, wb_reg_pc,
Mux(rf_wen, rf_waddr, UInt(0)), rf_wdata, rf_wen, Mux(rf_wen, rf_waddr, UInt(0)), rf_wdata, rf_wen,
wb_reg_inst(19,15), Reg(next=Reg(next=ex_rs(0))), wb_reg_inst(19,15), Reg(next=Reg(next=ex_rs(0))),
wb_reg_inst(24,20), Reg(next=Reg(next=ex_rs(1))), wb_reg_inst(24,20), Reg(next=Reg(next=ex_rs(1))),

View File

@ -31,7 +31,8 @@ abstract class Tile(clockSignal: Clock = null, resetSignal: Bool = null)
class TileIO extends Bundle { class TileIO extends Bundle {
val cached = Vec(nCachedTileLinkPorts, new ClientTileLinkIO) val cached = Vec(nCachedTileLinkPorts, new ClientTileLinkIO)
val uncached = Vec(nUncachedTileLinkPorts, new ClientUncachedTileLinkIO) val uncached = Vec(nUncachedTileLinkPorts, new ClientUncachedTileLinkIO)
val prci = new PRCITileIO().flip val hartid = UInt(INPUT, p(XLen))
val interrupts = new TileInterrupts().asInput
val slave = (p(DataScratchpadSize) > 0).option(new ClientUncachedTileLinkIO().flip) val slave = (p(DataScratchpadSize) > 0).option(new ClientUncachedTileLinkIO().flip)
} }
@ -54,7 +55,8 @@ class RocketTile(clockSignal: Clock = null, resetSignal: Bool = null)
val uncachedArbPorts = collection.mutable.ArrayBuffer(icache.io.mem) val uncachedArbPorts = collection.mutable.ArrayBuffer(icache.io.mem)
val uncachedPorts = collection.mutable.ArrayBuffer[ClientUncachedTileLinkIO]() val uncachedPorts = collection.mutable.ArrayBuffer[ClientUncachedTileLinkIO]()
val cachedPorts = collection.mutable.ArrayBuffer(dcache.mem) val cachedPorts = collection.mutable.ArrayBuffer(dcache.mem)
core.io.prci <> io.prci core.io.interrupts := io.interrupts
core.io.hartid := io.hartid
icache.io.cpu <> core.io.imem icache.io.cpu <> core.io.imem
val fpuOpt = p(FPUKey).map(cfg => Module(new FPU(cfg))) val fpuOpt = p(FPUKey).map(cfg => Module(new FPU(cfg)))

View File

@ -13,21 +13,11 @@ import cde.{Parameters, Field}
/** Number of tiles */ /** Number of tiles */
case object NTiles extends Field[Int] case object NTiles extends Field[Int]
class PRCIInterrupts extends Bundle {
val meip = Bool()
val seip = Bool()
val debug = Bool()
}
class PRCITileIO(implicit p: Parameters) extends Bundle { class PRCITileIO(implicit p: Parameters) extends Bundle {
val reset = Bool(OUTPUT) val reset = Bool(OUTPUT)
val id = UInt(OUTPUT, log2Up(p(NTiles))) val interrupts = new Bundle {
val interrupts = { val mtip = Bool()
val result = new PRCIInterrupts { val msip = Bool()
val mtip = Bool()
val msip = Bool()
}
result.asOutput
} }
override def cloneType: this.type = new PRCITileIO().asInstanceOf[this.type] override def cloneType: this.type = new PRCITileIO().asInstanceOf[this.type]
@ -47,7 +37,6 @@ class PRCI(implicit val p: Parameters) extends Module
with HasTileLinkParameters with HasTileLinkParameters
with HasAddrMapParameters { with HasAddrMapParameters {
val io = new Bundle { val io = new Bundle {
val interrupts = Vec(p(NTiles), new PRCIInterrupts).asInput
val tl = new ClientUncachedTileLinkIO().flip val tl = new ClientUncachedTileLinkIO().flip
val tiles = Vec(p(NTiles), new PRCITileIO) val tiles = Vec(p(NTiles), new PRCITileIO)
val rtcTick = Bool(INPUT) val rtcTick = Bool(INPUT)
@ -84,10 +73,9 @@ class PRCI(implicit val p: Parameters) extends Module
} }
for ((tile, i) <- io.tiles zipWithIndex) { for ((tile, i) <- io.tiles zipWithIndex) {
tile.interrupts := io.interrupts(i)
tile.interrupts.msip := ipi(i)(0) tile.interrupts.msip := ipi(i)(0)
tile.interrupts.mtip := time >= timecmp(i) tile.interrupts.mtip := time >= timecmp(i)
tile.id := UInt(i) tile.reset := reset
} }
// TODO generalize these to help other TL slaves // TODO generalize these to help other TL slaves