Skip to content

Commit

Permalink
Merge pull request #589 from riscv-boom/chisel-3.5-bump
Browse files Browse the repository at this point in the history
Chisel 3.5 bump
  • Loading branch information
abejgonzalez committed Feb 11, 2022
2 parents e252e79 + 90a4ec6 commit ad64c54
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 82 deletions.
2 changes: 1 addition & 1 deletion CHIPYARD.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
45684f1b875f018a1945476cec9269068e1618ca
4180463d52bc0a6b4c004530601ccdabebf0ab7d
2 changes: 2 additions & 0 deletions src/main/scala/common/parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ case class BoomCoreParams(
mulDiv: Option[freechips.rocketchip.rocket.MulDivParams] = Some(MulDivParams(divEarlyOut=true)),
nBreakpoints: Int = 0, // TODO Fix with better frontend breakpoint unit
nL2TLBEntries: Int = 512,
val nPTECacheEntries: Int = 8, // TODO: check
nL2TLBWays: Int = 1,
nLocalInterrupts: Int = 0,
useNMI: Boolean = false,
useAtomics: Boolean = true,
useDebug: Boolean = true,
useUser: Boolean = true,
useSupervisor: Boolean = false,
useHypervisor: Boolean = false,
useVM: Boolean = true,
useSCIE: Boolean = false,
useRVE: Boolean = false,
Expand Down
8 changes: 6 additions & 2 deletions src/main/scala/exu/core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,10 @@ class BoomCore(usingTrace: Boolean)(implicit p: Parameters) extends BoomModule
var iss_wu_idx = 1
var ren_wu_idx = 1
// The 0th wakeup port goes to the ll_wbarb
int_iss_wakeups(0).valid := ll_wbarb.io.out.fire() && ll_wbarb.io.out.bits.uop.dst_rtype === RT_FIX
int_iss_wakeups(0).valid := ll_wbarb.io.out.fire && ll_wbarb.io.out.bits.uop.dst_rtype === RT_FIX
int_iss_wakeups(0).bits := ll_wbarb.io.out.bits

int_ren_wakeups(0).valid := ll_wbarb.io.out.fire() && ll_wbarb.io.out.bits.uop.dst_rtype === RT_FIX
int_ren_wakeups(0).valid := ll_wbarb.io.out.fire && ll_wbarb.io.out.bits.uop.dst_rtype === RT_FIX
int_ren_wakeups(0).bits := ll_wbarb.io.out.bits

for (i <- 1 until memWidth) {
Expand Down Expand Up @@ -1055,6 +1055,10 @@ class BoomCore(usingTrace: Boolean)(implicit p: Parameters) extends BoomModule
csr.io.hartid := io.hartid
csr.io.interrupts := io.interrupts

// we do not support the H-extension
csr.io.htval := DontCare
csr.io.gva := DontCare

// TODO can we add this back in, but handle reset properly and save us
// the mux above on csr.io.rw.cmd?
// assert (!(csr_rw_cmd =/= rocket.CSR.N && !exe_units(0).io.resp(0).valid),
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/exu/decode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ class DecodeUnit(implicit p: Parameters) extends BoomModule
val cs = Wire(new CtrlSigs()).decode(inst, decode_table)

// Exception Handling
io.csr_decode.csr := inst(31,20)
io.csr_decode.inst := inst
val csr_en = cs.csr_cmd.isOneOf(CSR.S, CSR.C, CSR.W)
val csr_ren = cs.csr_cmd.isOneOf(CSR.S, CSR.C) && uop.lrs1 === 0.U
val system_insn = cs.csr_cmd === CSR.I
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/exu/execution-units/functional-unit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ abstract class IterativeFunctionalUnit(dataWidth: Int)(implicit p: Parameters)
val do_kill = Wire(Bool())
do_kill := io.req.bits.kill // irrelevant default

when (io.req.fire()) {
when (io.req.fire) {
// update incoming uop
do_kill := IsKilledByBranch(io.brupdate, io.req.bits.uop) || io.req.bits.kill
r_uop := io.req.bits.uop
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/exu/fp-pipeline.scala
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ class FpPipeline(implicit p: Parameters) extends BoomModule with tile.HasFPUPara

val fpiu_unit = exe_units.fpiu_unit
val fpiu_is_sdq = fpiu_unit.io.ll_iresp.bits.uop.uopc === uopSTA
io.to_int.valid := fpiu_unit.io.ll_iresp.fire() && !fpiu_is_sdq
io.to_sdq.valid := fpiu_unit.io.ll_iresp.fire() && fpiu_is_sdq
io.to_int.valid := fpiu_unit.io.ll_iresp.fire && !fpiu_is_sdq
io.to_sdq.valid := fpiu_unit.io.ll_iresp.fire && fpiu_is_sdq
io.to_int.bits := fpiu_unit.io.ll_iresp.bits
io.to_sdq.bits := fpiu_unit.io.ll_iresp.bits
fpiu_unit.io.ll_iresp.ready := io.to_sdq.ready && io.to_int.ready
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/ifu/fetch-target-queue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class FetchTargetQueue(implicit p: Parameters) extends BoomModule
None
}

val do_enq = io.enq.fire()
val do_enq = io.enq.fire


// This register lets us initialize the ghist to 0
Expand Down Expand Up @@ -344,7 +344,7 @@ class FetchTargetQueue(implicit p: Parameters) extends BoomModule
for (i <- 0 until 2) {
val idx = io.get_ftq_pc(i).ftq_idx
val next_idx = WrapInc(idx, num_entries)
val next_is_enq = (next_idx === enq_ptr) && io.enq.fire()
val next_is_enq = (next_idx === enq_ptr) && io.enq.fire
val next_pc = Mux(next_is_enq, io.enq.bits.pc, pcs(next_idx))
val get_entry = ram(idx)
val next_entry = ram(next_idx)
Expand Down
12 changes: 7 additions & 5 deletions src/main/scala/ifu/frontend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class BoomFrontendModule(outer: BoomFrontend) extends LazyModuleImp(outer)
icache.io.invalidate := io.cpu.flush_icache
val tlb = Module(new TLB(true, log2Ceil(fetchBytes), TLBConfig(nTLBSets, nTLBWays)))
io.ptw <> tlb.io.ptw
io.cpu.perf.tlbMiss := io.ptw.req.fire()
io.cpu.perf.tlbMiss := io.ptw.req.fire
io.cpu.perf.acquire := icache.io.perf.acquire

// --------------------------------------------------------
Expand Down Expand Up @@ -390,6 +390,8 @@ class BoomFrontendModule(outer: BoomFrontend) extends LazyModuleImp(outer)
tlb.io.req.bits.vaddr := s1_vpc
tlb.io.req.bits.passthrough := false.B
tlb.io.req.bits.size := log2Ceil(coreInstBytes * fetchWidth).U
tlb.io.req.bits.v := io.ptw.status.v
tlb.io.req.bits.prv := io.ptw.status.prv
tlb.io.sfence := RegNext(io.cpu.sfence)
tlb.io.kill := false.B

Expand Down Expand Up @@ -539,7 +541,7 @@ class BoomFrontendModule(outer: BoomFrontend) extends LazyModuleImp(outer)
// RAS takes a cycle to read
val ras_read_idx = RegInit(0.U(log2Ceil(nRasEntries).W))
ras.io.read_idx := ras_read_idx
when (f3.io.enq.fire()) {
when (f3.io.enq.fire) {
ras_read_idx := f3.io.enq.bits.ghist.ras_idx
ras.io.read_idx := f3.io.enq.bits.ghist.ras_idx
}
Expand All @@ -548,7 +550,7 @@ class BoomFrontendModule(outer: BoomFrontend) extends LazyModuleImp(outer)
// The BPD resp comes in f3
f3_bpd_resp.io.enq.valid := f3.io.deq.valid && RegNext(f3.io.enq.ready)
f3_bpd_resp.io.enq.bits := bpd.io.resp.f3
when (f3_bpd_resp.io.enq.fire()) {
when (f3_bpd_resp.io.enq.fire) {
bpd.io.f3_fire := true.B
}

Expand Down Expand Up @@ -764,7 +766,7 @@ class BoomFrontendModule(outer: BoomFrontend) extends LazyModuleImp(outer)
f3_fetch_bundle.end_half.valid := bank_prev_is_half
f3_fetch_bundle.end_half.bits := bank_prev_half

when (f3.io.deq.fire()) {
when (f3.io.deq.fire) {
f3_prev_is_half := bank_prev_is_half
f3_prev_half := bank_prev_half
assert(f3_bpd_resp.io.deq.bits.pc === f3_fetch_bundle.pc)
Expand Down Expand Up @@ -840,7 +842,7 @@ class BoomFrontendModule(outer: BoomFrontend) extends LazyModuleImp(outer)

// When f3 finds a btb mispredict, queue up a bpd correction update
val f4_btb_corrections = Module(new Queue(new BranchPredictionUpdate, 2))
f4_btb_corrections.io.enq.valid := f3.io.deq.fire() && f3_btb_mispredicts.reduce(_||_) && enableBTBFastRepair.B
f4_btb_corrections.io.enq.valid := f3.io.deq.fire && f3_btb_mispredicts.reduce(_||_) && enableBTBFastRepair.B
f4_btb_corrections.io.enq.bits := DontCare
f4_btb_corrections.io.enq.bits.is_mispredict_update := false.B
f4_btb_corrections.io.enq.bits.is_repair_update := false.B
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/ifu/icache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class ICacheModule(outer: ICache) extends LazyModuleImp(outer)



val s0_valid = io.req.fire()
val s0_valid = io.req.fire
val s0_vaddr = io.req.bits.addr

val s1_valid = RegNext(s0_valid)
Expand All @@ -161,12 +161,12 @@ class ICacheModule(outer: ICache) extends LazyModuleImp(outer)

val invalidated = Reg(Bool())
val refill_valid = RegInit(false.B)
val refill_fire = tl_out.a.fire()
val refill_fire = tl_out.a.fire
val s2_miss = s2_valid && !s2_hit && !RegNext(refill_valid)
val refill_paddr = RegEnable(io.s1_paddr, s1_valid && !(refill_valid || s2_miss))
val refill_tag = refill_paddr(tagBits+untagBits-1,untagBits)
val refill_idx = refill_paddr(untagBits-1,blockOffBits)
val refill_one_beat = tl_out.d.fire() && edge_out.hasData(tl_out.d.bits)
val refill_one_beat = tl_out.d.fire && edge_out.hasData(tl_out.d.bits)

io.req.ready := !refill_one_beat

Expand Down Expand Up @@ -357,7 +357,7 @@ class ICacheModule(outer: ICache) extends LazyModuleImp(outer)
tl_out.c.valid := false.B
tl_out.e.valid := false.B

io.perf.acquire := tl_out.a.fire()
io.perf.acquire := tl_out.a.fire

when (!refill_valid) { invalidated := false.B }
when (refill_fire) { refill_valid := true.B }
Expand Down
58 changes: 29 additions & 29 deletions src/main/scala/lsu/dcache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class BoomWritebackUnit(implicit edge: TLEdgeOut, p: Parameters) extends L1Hella

when (state === s_invalid) {
io.req.ready := true.B
when (io.req.fire()) {
when (io.req.fire) {
state := s_fill_buffer
data_req_cnt := 0.U
req := io.req.bits
Expand All @@ -100,7 +100,7 @@ class BoomWritebackUnit(implicit edge: TLEdgeOut, p: Parameters) extends L1Hella
r1_data_req_cnt := 0.U
r2_data_req_fired := r1_data_req_fired
r2_data_req_cnt := r1_data_req_cnt
when (io.data_req.fire() && io.meta_read.fire()) {
when (io.data_req.fire && io.meta_read.fire) {
r1_data_req_fired := true.B
r1_data_req_cnt := data_req_cnt
data_req_cnt := data_req_cnt + 1.U
Expand All @@ -116,7 +116,7 @@ class BoomWritebackUnit(implicit edge: TLEdgeOut, p: Parameters) extends L1Hella
} .elsewhen (state === s_lsu_release) {
io.lsu_release.valid := true.B
io.lsu_release.bits := probeResponse
when (io.lsu_release.fire()) {
when (io.lsu_release.fire) {
state := s_active
}
} .elsewhen (state === s_active) {
Expand All @@ -126,10 +126,10 @@ class BoomWritebackUnit(implicit edge: TLEdgeOut, p: Parameters) extends L1Hella
when (io.mem_grant) {
acked := true.B
}
when (io.release.fire()) {
when (io.release.fire) {
data_req_cnt := data_req_cnt + 1.U
}
when ((data_req_cnt === (refillCycles-1).U) && io.release.fire()) {
when ((data_req_cnt === (refillCycles-1).U) && io.release.fire) {
state := Mux(req.voluntary, s_grant, s_invalid)
}
} .elsewhen (state === s_grant) {
Expand Down Expand Up @@ -211,12 +211,12 @@ class BoomProbeUnit(implicit edge: TLEdgeOut, p: Parameters) extends L1HellaCach

// state === s_invalid
when (state === s_invalid) {
when (io.req.fire()) {
when (io.req.fire) {
state := s_meta_read
req := io.req.bits
}
} .elsewhen (state === s_meta_read) {
when (io.meta_read.fire()) {
when (io.meta_read.fire) {
state := s_meta_resp
}
} .elsewhen (state === s_meta_resp) {
Expand All @@ -230,15 +230,15 @@ class BoomProbeUnit(implicit edge: TLEdgeOut, p: Parameters) extends L1HellaCach
} .elsewhen (state === s_mshr_resp) {
state := Mux(tag_matches && is_dirty, s_writeback_req, s_lsu_release)
} .elsewhen (state === s_lsu_release) {
when (io.lsu_release.fire()) {
when (io.lsu_release.fire) {
state := s_release
}
} .elsewhen (state === s_release) {
when (io.rep.ready) {
state := Mux(tag_matches, s_meta_write, s_invalid)
}
} .elsewhen (state === s_writeback_req) {
when (io.wb_req.fire()) {
when (io.wb_req.fire) {
state := s_writeback_resp
}
} .elsewhen (state === s_writeback_resp) {
Expand All @@ -247,7 +247,7 @@ class BoomProbeUnit(implicit edge: TLEdgeOut, p: Parameters) extends L1HellaCach
state := s_meta_write
}
} .elsewhen (state === s_meta_write) {
when (io.meta_write.fire()) {
when (io.meta_write.fire) {
state := s_meta_write_resp
}
} .elsewhen (state === s_meta_write_resp) {
Expand Down Expand Up @@ -447,7 +447,7 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu

metaReadArb.io.in := DontCare
for (w <- 0 until memWidth) {
meta(w).io.write.valid := metaWriteArb.io.out.fire()
meta(w).io.write.valid := metaWriteArb.io.out.fire
meta(w).io.write.bits := metaWriteArb.io.out.bits
meta(w).io.read.valid := metaReadArb.io.out.valid
meta(w).io.read.bits := metaReadArb.io.out.bits.req(w)
Expand All @@ -469,7 +469,7 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu
}
dataReadArb.io.out.ready := true.B

data.io.write.valid := dataWriteArb.io.out.fire()
data.io.write.valid := dataWriteArb.io.out.fire
data.io.write.bits := dataWriteArb.io.out.bits
dataWriteArb.io.out.ready := true.B

Expand Down Expand Up @@ -527,7 +527,7 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu

// -----------
// Write-backs
val wb_fire = wb.io.meta_read.fire() && wb.io.data_req.fire()
val wb_fire = wb.io.meta_read.fire && wb.io.data_req.fire
val wb_req = Wire(Vec(memWidth, new BoomDCacheReq))
wb_req := DontCare
wb_req(0).uop := NullMicroOp
Expand All @@ -544,11 +544,11 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu
dataReadArb.io.in(1).bits.req(0) := wb.io.data_req.bits
dataReadArb.io.in(1).bits.valid := widthMap(w => (w == 0).B)
wb.io.data_req.ready := metaReadArb.io.in(2).ready && dataReadArb.io.in(1).ready
assert(!(wb.io.meta_read.fire() ^ wb.io.data_req.fire()))
assert(!(wb.io.meta_read.fire ^ wb.io.data_req.fire))

// -------
// Prober
val prober_fire = prober.io.meta_read.fire()
val prober_fire = prober.io.meta_read.fire
val prober_req = Wire(Vec(memWidth, new BoomDCacheReq))
prober_req := DontCare
prober_req(0).uop := NullMicroOp
Expand All @@ -563,7 +563,7 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu

// -------
// Prefetcher
val prefetch_fire = mshrs.io.prefetch.fire()
val prefetch_fire = mshrs.io.prefetch.fire
val prefetch_req = Wire(Vec(memWidth, new BoomDCacheReq))
prefetch_req := DontCare
prefetch_req(0) := mshrs.io.prefetch.bits
Expand All @@ -575,25 +575,25 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu
mshrs.io.prefetch.ready := metaReadArb.io.in(5).ready
// Prefetch does not need to read data array

val s0_valid = Mux(io.lsu.req.fire(), VecInit(io.lsu.req.bits.map(_.valid)),
Mux(mshrs.io.replay.fire() || wb_fire || prober_fire || prefetch_fire || mshrs.io.meta_read.fire(),
val s0_valid = Mux(io.lsu.req.fire, VecInit(io.lsu.req.bits.map(_.valid)),
Mux(mshrs.io.replay.fire || wb_fire || prober_fire || prefetch_fire || mshrs.io.meta_read.fire,
VecInit(1.U(memWidth.W).asBools), VecInit(0.U(memWidth.W).asBools)))
val s0_req = Mux(io.lsu.req.fire() , VecInit(io.lsu.req.bits.map(_.bits)),
val s0_req = Mux(io.lsu.req.fire , VecInit(io.lsu.req.bits.map(_.bits)),
Mux(wb_fire , wb_req,
Mux(prober_fire , prober_req,
Mux(prefetch_fire , prefetch_req,
Mux(mshrs.io.meta_read.fire(), mshr_read_req
Mux(mshrs.io.meta_read.fire, mshr_read_req
, replay_req)))))
val s0_type = Mux(io.lsu.req.fire() , t_lsu,
val s0_type = Mux(io.lsu.req.fire , t_lsu,
Mux(wb_fire , t_wb,
Mux(prober_fire , t_probe,
Mux(prefetch_fire , t_prefetch,
Mux(mshrs.io.meta_read.fire(), t_mshr_meta_read
Mux(mshrs.io.meta_read.fire, t_mshr_meta_read
, t_replay)))))

// Does this request need to send a response or nack
val s0_send_resp_or_nack = Mux(io.lsu.req.fire(), s0_valid,
VecInit(Mux(mshrs.io.replay.fire() && isRead(mshrs.io.replay.bits.uop.mem_cmd), 1.U(memWidth.W), 0.U(memWidth.W)).asBools))
val s0_send_resp_or_nack = Mux(io.lsu.req.fire, s0_valid,
VecInit(Mux(mshrs.io.replay.fire && isRead(mshrs.io.replay.bits.uop.mem_cmd), 1.U(memWidth.W), 0.U(memWidth.W)).asBools))


val s1_req = RegNext(s0_req)
Expand All @@ -604,10 +604,10 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu
RegNext(s0_valid(w) &&
!IsKilledByBranch(io.lsu.brupdate, s0_req(w).uop) &&
!(io.lsu.exception && s0_req(w).uop.uses_ldq) &&
!(s2_store_failed && io.lsu.req.fire() && s0_req(w).uop.uses_stq),
!(s2_store_failed && io.lsu.req.fire && s0_req(w).uop.uses_stq),
init=false.B))
for (w <- 0 until memWidth)
assert(!(io.lsu.s1_kill(w) && !RegNext(io.lsu.req.fire()) && !RegNext(io.lsu.req.bits(w).valid)))
assert(!(io.lsu.s1_kill(w) && !RegNext(io.lsu.req.fire) && !RegNext(io.lsu.req.bits(w).valid)))
val s1_addr = s1_req.map(_.addr)
val s1_nack = s1_addr.map(a => a(idxMSB,idxLSB) === prober.io.meta_write.bits.idx && !prober.io.req.ready)
val s1_send_resp_or_nack = RegNext(s0_send_resp_or_nack)
Expand Down Expand Up @@ -730,7 +730,7 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu

s2_nack := widthMap(w => (s2_nack_miss(w) || s2_nack_hit(w) || s2_nack_victim(w) || s2_nack_data(w) || s2_nack_wb(w)) && s2_type =/= t_replay)
val s2_send_resp = widthMap(w => (RegNext(s1_send_resp_or_nack(w)) && !s2_nack(w) &&
(s2_hit(w) || (mshrs.io.req(w).fire() && isWrite(s2_req(w).uop.mem_cmd) && !isRead(s2_req(w).uop.mem_cmd)))))
(s2_hit(w) || (mshrs.io.req(w).fire && isWrite(s2_req(w).uop.mem_cmd) && !isRead(s2_req(w).uop.mem_cmd)))))
val s2_send_nack = widthMap(w => (RegNext(s1_send_resp_or_nack(w)) && s2_nack(w)))
for (w <- 0 until memWidth)
assert(!(s2_send_resp(w) && s2_send_nack(w)))
Expand Down Expand Up @@ -770,7 +770,7 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu

mshrs.io.meta_resp.valid := !s2_nack_hit(0) || prober.io.mshr_wb_rdy
mshrs.io.meta_resp.bits := Mux1H(s2_tag_match_way(0), RegNext(meta(0).io.resp))
when (mshrs.io.req.map(_.fire()).reduce(_||_)) { replacer.miss }
when (mshrs.io.req.map(_.fire).reduce(_||_)) { replacer.miss }
tl_out.a <> mshrs.io.mem_acquire

// probes and releases
Expand Down Expand Up @@ -808,7 +808,7 @@ class BoomNonBlockingDCacheModule(outer: BoomNonBlockingDCache) extends LazyModu
wb.io.req <> wbArb.io.out
wb.io.data_resp := s2_data_muxed(0)
mshrs.io.wb_resp := wb.io.resp
wb.io.mem_grant := tl_out.d.fire() && tl_out.d.bits.source === cfg.nMSHRs.U
wb.io.mem_grant := tl_out.d.fire && tl_out.d.bits.source === cfg.nMSHRs.U

val lsu_release_arb = Module(new Arbiter(new TLBundleC(edge.bundle), 2))
io.lsu.release <> lsu_release_arb.io.out
Expand Down

0 comments on commit ad64c54

Please sign in to comment.