split off SCR functionality from HTIF
This commit is contained in:
parent
bdc6972a8d
commit
21f96f382c
@ -4,7 +4,7 @@ package uncore
|
|||||||
|
|
||||||
import Chisel._
|
import Chisel._
|
||||||
import Chisel.ImplicitConversions._
|
import Chisel.ImplicitConversions._
|
||||||
import junctions.{SMIIO, MMIOBase}
|
import junctions.SMIIO
|
||||||
|
|
||||||
case object HTIFWidth extends Field[Int]
|
case object HTIFWidth extends Field[Int]
|
||||||
case object HTIFNSCR extends Field[Int]
|
case object HTIFNSCR extends Field[Int]
|
||||||
@ -16,6 +16,7 @@ abstract trait HTIFParameters extends UsesParameters {
|
|||||||
val dataBeats = params(TLDataBeats)
|
val dataBeats = params(TLDataBeats)
|
||||||
val w = params(HTIFWidth)
|
val w = params(HTIFWidth)
|
||||||
val nSCR = params(HTIFNSCR)
|
val nSCR = params(HTIFNSCR)
|
||||||
|
val scrAddrBits = log2Up(nSCR)
|
||||||
val offsetBits = params(HTIFOffsetBits)
|
val offsetBits = params(HTIFOffsetBits)
|
||||||
val nCores = params(HTIFNCores)
|
val nCores = params(HTIFNCores)
|
||||||
}
|
}
|
||||||
@ -42,18 +43,11 @@ class HTIFIO extends HTIFBundle {
|
|||||||
// expected to be used to quickly indicate to testbench to do logging b/c in 'interesting' work
|
// expected to be used to quickly indicate to testbench to do logging b/c in 'interesting' work
|
||||||
}
|
}
|
||||||
|
|
||||||
class SCRIO extends HTIFBundle {
|
|
||||||
val rdata = Vec(Bits(INPUT, 64), nSCR)
|
|
||||||
val wen = Bool(OUTPUT)
|
|
||||||
val waddr = UInt(OUTPUT, log2Up(nSCR))
|
|
||||||
val wdata = Bits(OUTPUT, 64)
|
|
||||||
}
|
|
||||||
|
|
||||||
class HTIFModuleIO extends HTIFBundle {
|
class HTIFModuleIO extends HTIFBundle {
|
||||||
val host = new HostIO
|
val host = new HostIO
|
||||||
val cpu = Vec(new HTIFIO, nCores).flip
|
val cpu = Vec(new HTIFIO, nCores).flip
|
||||||
val mem = new ClientUncachedTileLinkIO
|
val mem = new ClientUncachedTileLinkIO
|
||||||
val scr = new SCRIO
|
val scr = new SMIIO(64, scrAddrBits)
|
||||||
}
|
}
|
||||||
|
|
||||||
class HTIF(pcr_RESET: Int) extends Module with HTIFParameters {
|
class HTIF(pcr_RESET: Int) extends Module with HTIFParameters {
|
||||||
@ -200,9 +194,8 @@ class HTIF(pcr_RESET: Int) extends Module with HTIFParameters {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when (state === state_pcr_req && cpu.pcr.req.fire()) {
|
when (cpu.pcr.req.fire()) { state := state_pcr_resp }
|
||||||
state := state_pcr_resp
|
|
||||||
}
|
|
||||||
when (state === state_pcr_req && me && pcr_addr === UInt(pcr_RESET)) {
|
when (state === state_pcr_req && me && pcr_addr === UInt(pcr_RESET)) {
|
||||||
when (cmd === cmd_writecr) {
|
when (cmd === cmd_writecr) {
|
||||||
my_reset := pcr_wdata(0)
|
my_reset := pcr_wdata(0)
|
||||||
@ -218,19 +211,15 @@ class HTIF(pcr_RESET: Int) extends Module with HTIFParameters {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val scr_addr = addr(log2Up(nSCR)-1, 0)
|
io.scr.req.valid := (state === state_pcr_req && pcr_coreid.andR)
|
||||||
val scr_rdata = Wire(Vec(Bits(width=64), io.scr.rdata.size))
|
io.scr.req.bits.addr := addr(scrAddrBits - 1, 0).toUInt
|
||||||
for (i <- 0 until scr_rdata.size)
|
io.scr.req.bits.data := pcr_wdata
|
||||||
scr_rdata(i) := io.scr.rdata(i)
|
io.scr.req.bits.rw := (cmd === cmd_writecr)
|
||||||
scr_rdata(0) := UInt(nCores)
|
io.scr.resp.ready := Bool(true)
|
||||||
scr_rdata(1) := UInt(params(MMIOBase) >> 20)
|
|
||||||
|
|
||||||
io.scr.wen := Bool(false)
|
when (io.scr.req.fire()) { state := state_pcr_resp }
|
||||||
io.scr.wdata := pcr_wdata
|
when (state === state_pcr_resp && io.scr.resp.valid) {
|
||||||
io.scr.waddr := scr_addr.toUInt
|
pcrReadData := io.scr.resp.bits
|
||||||
when (state === state_pcr_req && pcr_coreid.andR) {
|
|
||||||
io.scr.wen := cmd === cmd_writecr
|
|
||||||
pcrReadData := scr_rdata(scr_addr)
|
|
||||||
state := state_tx
|
state := state_tx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
41
uncore/src/main/scala/scr.scala
Normal file
41
uncore/src/main/scala/scr.scala
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package uncore
|
||||||
|
|
||||||
|
import Chisel._
|
||||||
|
import junctions.{SMIIO, MMIOBase}
|
||||||
|
|
||||||
|
class SCRIO extends HTIFBundle {
|
||||||
|
val rdata = Vec(Bits(INPUT, 64), nSCR)
|
||||||
|
val wen = Bool(OUTPUT)
|
||||||
|
val waddr = UInt(OUTPUT, log2Up(nSCR))
|
||||||
|
val wdata = Bits(OUTPUT, 64)
|
||||||
|
}
|
||||||
|
|
||||||
|
class SCRFile extends Module with HTIFParameters {
|
||||||
|
val io = new Bundle {
|
||||||
|
val smi = new SMIIO(64, scrAddrBits).flip
|
||||||
|
val scr = new SCRIO
|
||||||
|
}
|
||||||
|
|
||||||
|
val scr_rdata = Wire(Vec(Bits(width=64), io.scr.rdata.size))
|
||||||
|
for (i <- 0 until scr_rdata.size)
|
||||||
|
scr_rdata(i) := io.scr.rdata(i)
|
||||||
|
scr_rdata(0) := UInt(nCores)
|
||||||
|
scr_rdata(1) := UInt(params(MMIOBase) >> 20)
|
||||||
|
|
||||||
|
val read_addr = Reg(init = UInt(0, scrAddrBits))
|
||||||
|
val resp_valid = Reg(init = Bool(false))
|
||||||
|
|
||||||
|
io.smi.req.ready := !resp_valid
|
||||||
|
io.smi.resp.valid := resp_valid
|
||||||
|
io.smi.resp.bits := scr_rdata(read_addr)
|
||||||
|
|
||||||
|
io.scr.wen := io.smi.req.fire() && io.smi.req.bits.rw
|
||||||
|
io.scr.wdata := io.smi.req.bits.data
|
||||||
|
io.scr.waddr := io.smi.req.bits.addr
|
||||||
|
|
||||||
|
when (io.smi.req.fire()) {
|
||||||
|
read_addr := io.smi.req.bits.addr
|
||||||
|
resp_valid := Bool(true)
|
||||||
|
}
|
||||||
|
when (io.smi.resp.fire()) { resp_valid := Bool(false) }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user