Skip to content

Commit

Permalink
format frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Yan-Muzi committed Oct 25, 2024
1 parent 6196b2a commit c1b4541
Show file tree
Hide file tree
Showing 25 changed files with 5,197 additions and 4,546 deletions.
858 changes: 500 additions & 358 deletions src/main/scala/xiangshan/frontend/BPU.scala

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/scala/xiangshan/frontend/Bim.scala
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ class BIM(implicit p: Parameters) extends BasePredictor with BimParams with BPUU
}
}
*/
*/
31 changes: 15 additions & 16 deletions src/main/scala/xiangshan/frontend/Composer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package xiangshan.frontend

import org.chipsalliance.cde.config.Parameters
import chisel3._
import chisel3.util._
import xiangshan._
import utils._
import org.chipsalliance.cde.config.Parameters
import utility._
import utils._
import xiangshan._

class Composer(implicit p: Parameters) extends BasePredictor with HasBPUConst with HasPerfEvents {
val (components, resp) = getBPDComponents(io.in.bits.resp_in(0), p)
Expand All @@ -35,15 +35,15 @@ class Composer(implicit p: Parameters) extends BasePredictor with HasBPUConst wi
io.out.s1 := fast_pred.io.out.s1
}

var metas = 0.U(1.W)
var metas = 0.U(1.W)
var meta_sz = 0
for (c <- components) {
c.io.reset_vector := io.reset_vector
c.io.in.valid := io.in.valid
c.io.in.bits.s0_pc := io.in.bits.s0_pc
c.io.in.bits.folded_hist := io.in.bits.folded_hist
c.io.reset_vector := io.reset_vector
c.io.in.valid := io.in.valid
c.io.in.bits.s0_pc := io.in.bits.s0_pc
c.io.in.bits.folded_hist := io.in.bits.folded_hist
c.io.in.bits.s1_folded_hist := io.in.bits.s1_folded_hist
c.io.in.bits.ghist := io.in.bits.ghist
c.io.in.bits.ghist := io.in.bits.ghist

c.io.s0_fire := io.s0_fire
c.io.s1_fire := io.s1_fire
Expand All @@ -53,18 +53,17 @@ class Composer(implicit p: Parameters) extends BasePredictor with HasBPUConst wi
c.io.s2_redirect := io.s2_redirect
c.io.s3_redirect := io.s3_redirect

c.io.redirect := io.redirect
c.io.ctrl := DelayN(io.ctrl, 1)
c.io.redirect := io.redirect
c.io.ctrl := DelayN(io.ctrl, 1)
c.io.redirectFromIFU := io.redirectFromIFU

if (c.meta_size > 0) {
metas = (metas << c.meta_size) | c.io.out.last_stage_meta(c.meta_size-1,0)
metas = (metas << c.meta_size) | c.io.out.last_stage_meta(c.meta_size - 1, 0)
}
meta_sz = meta_sz + c.meta_size
}
println(s"total meta size: $meta_sz\n\n")


io.in.ready := components.map(_.io.s1_ready).reduce(_ && _)

io.s1_ready := components.map(_.io.s1_ready).reduce(_ && _)
Expand All @@ -75,7 +74,7 @@ class Composer(implicit p: Parameters) extends BasePredictor with HasBPUConst wi

var update_meta = io.update.bits.meta
for (c <- components.reverse) {
c.io.update := io.update
c.io.update := io.update
c.io.update.bits.meta := update_meta
update_meta = update_meta >> c.meta_size
}
Expand All @@ -90,8 +89,8 @@ class Composer(implicit p: Parameters) extends BasePredictor with HasBPUConst wi
metas(idx)
}

override def getFoldedHistoryInfo = Some(components.map(_.getFoldedHistoryInfo.getOrElse(Set())).reduce(_++_))
override def getFoldedHistoryInfo = Some(components.map(_.getFoldedHistoryInfo.getOrElse(Set())).reduce(_ ++ _))

override val perfEvents = components.map(_.getPerfEvents).reduce(_++_)
override val perfEvents = components.map(_.getPerfEvents).reduce(_ ++ _)
generatePerfEvent()
}
Loading

0 comments on commit c1b4541

Please sign in to comment.