Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): add ClockGate at frontend SRAMTemplate #3889

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/scala/xiangshan/frontend/FTB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ class FTB(implicit p: Parameters) extends BasePredictor with FTBParams with BPUU
way = numWays,
shouldReset = true,
holdRead = false,
singlePort = true
singlePort = true,
withClockGate = true
))
val ftb_r_entries = ftb.io.r.resp.data.map(_.entry)

Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/xiangshan/frontend/ITTAGE.scala
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ class ITTageTable(
shouldReset = true,
holdRead = true,
singlePort = true,
useBitmask = true
useBitmask = true,
withClockGate = true
))

table.io.r.req.valid := io.req.fire
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/xiangshan/frontend/NewFtq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class FtqNRSRAM[T <: Data](gen: T, numRead: Int)(implicit p: Parameters) extends
})

for (i <- 0 until numRead) {
val sram = Module(new SRAMTemplate(gen, FtqSize))
val sram = Module(new SRAMTemplate(gen, FtqSize, withClockGate = true))
sram.io.r.req.valid := io.ren(i)
sram.io.r.req.bits.setIdx := io.raddr(i)
io.rdata(i) := sram.io.r.resp.data(0)
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/xiangshan/frontend/SC.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class SCTable(val nRows: Int, val ctrBits: Int, val histLen: Int)(implicit p: Pa
shouldReset = true,
holdRead = true,
singlePort = false,
bypassWrite = true
bypassWrite = true,
withClockGate = true
))

// def getIdx(hist: UInt, pc: UInt) = {
Expand Down
9 changes: 6 additions & 3 deletions src/main/scala/xiangshan/frontend/Tage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ class TageBTable(implicit p: Parameters) extends XSModule with TBTParams {
way = numBr,
shouldReset = false,
holdRead = true,
bypassWrite = true
bypassWrite = true,
withClockGate = true
)
)

Expand Down Expand Up @@ -333,7 +334,8 @@ class TageTable(
shouldReset = true,
extraReset = true,
holdRead = true,
singlePort = true
singlePort = true,
withClockGate = true
))
us.extra_reset.get := io.update.reset_u.reduce(_ || _) && io.update.mask.reduce(_ || _)

Expand All @@ -345,7 +347,8 @@ class TageTable(
way = numBr,
shouldReset = true,
holdRead = true,
singlePort = true
singlePort = true,
withClockGate = true
))
)

Expand Down
29 changes: 17 additions & 12 deletions src/main/scala/xiangshan/frontend/icache/ICache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ class ICacheMetaArray()(implicit p: Parameters) extends ICacheArray {
way = nWays,
shouldReset = true,
holdRead = true,
singlePort = true
singlePort = true,
withClockGate = true
))

// meta connection
Expand Down Expand Up @@ -385,7 +386,8 @@ class ICacheDataArray(implicit p: Parameters) extends ICacheArray {
width = ICacheDataSRAMWidth,
shouldReset = true,
holdRead = true,
singlePort = true
singlePort = true,
withClockGate = true
))

// read
Expand Down Expand Up @@ -690,7 +692,8 @@ class ICachePartWayArray[T <: Data](gen: T, pWay: Int)(implicit p: Parameters) e
way = pWay,
shouldReset = true,
holdRead = true,
singlePort = true
singlePort = true,
withClockGate = true
))

sramBank.io.r.req.valid := io.read.req(bank).valid
Expand All @@ -716,14 +719,15 @@ class ICachePartWayArray[T <: Data](gen: T, pWay: Int)(implicit p: Parameters) e
// Automatically partition the SRAM based on the width of the data and the desired width.
// final SRAM width = width * way
class SRAMTemplateWithFixedWidth[T <: Data](
gen: T,
set: Int,
width: Int,
way: Int = 1,
shouldReset: Boolean = false,
holdRead: Boolean = false,
singlePort: Boolean = false,
bypassWrite: Boolean = false
gen: T,
set: Int,
width: Int,
way: Int = 1,
shouldReset: Boolean = false,
holdRead: Boolean = false,
singlePort: Boolean = false,
bypassWrite: Boolean = false,
withClockGate: Boolean = false
) extends Module {

val dataBits = gen.getWidth
Expand All @@ -750,7 +754,8 @@ class SRAMTemplateWithFixedWidth[T <: Data](
shouldReset = shouldReset,
holdRead = holdRead,
singlePort = singlePort,
bypassWrite = bypassWrite
bypassWrite = bypassWrite,
withClockGate = withClockGate
))
// read req
sramBank.io.r.req.valid := io.r.req.valid
Expand Down
2 changes: 1 addition & 1 deletion utility
Loading