Skip to content

Commit a235684

Browse files
authored
Merge pull request #3599 from chipsalliance/ifv
Interface to vector units
2 parents 2f462f5 + d92922a commit a235684

17 files changed

+531
-193
lines changed

Diff for: src/main/resources/vsrc/RoccBlackBox.v

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ module RoccBlackBox
119119
input rocc_mem_s2_xcpt_ae_ld,
120120
input rocc_mem_s2_xcpt_ae_st,
121121
input rocc_mem_ordered,
122+
input rocc_mem_store_pending,
122123
input rocc_mem_perf_acquire,
123124
input rocc_mem_perf_release,
124125
input rocc_mem_perf_grant,
@@ -159,6 +160,7 @@ module RoccBlackBox
159160
output [fLen:0] rocc_fpu_req_bits_in1,
160161
output [fLen:0] rocc_fpu_req_bits_in2,
161162
output [fLen:0] rocc_fpu_req_bits_in3,
163+
output rocc_fpu_req_bits_vec,
162164
output rocc_fpu_resp_ready,
163165
input rocc_fpu_resp_valid,
164166
input [fLen:0] rocc_fpu_resp_bits_data,

Diff for: src/main/scala/rocket/AMOALU.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.chipsalliance.cde.config.Parameters
1010
class StoreGen(typ: UInt, addr: UInt, dat: UInt, maxSize: Int) {
1111
val size = Wire(UInt(log2Up(log2Up(maxSize)+1).W))
1212
size := typ
13+
val dat_padded = dat.pad(maxSize*8)
1314
def misaligned: Bool =
1415
(addr & ((1.U << size) - 1.U)(log2Up(maxSize)-1,0)).orR
1516

@@ -24,8 +25,8 @@ class StoreGen(typ: UInt, addr: UInt, dat: UInt, maxSize: Int) {
2425
}
2526

2627
protected def genData(i: Int): UInt =
27-
if (i >= log2Up(maxSize)) dat
28-
else Mux(size === i.U, Fill(1 << (log2Up(maxSize)-i), dat((8 << i)-1,0)), genData(i+1))
28+
if (i >= log2Up(maxSize)) dat_padded
29+
else Mux(size === i.U, Fill(1 << (log2Up(maxSize)-i), dat_padded((8 << i)-1,0)), genData(i+1))
2930

3031
def data = genData(0)
3132
def wordData = genData(2)

Diff for: src/main/scala/rocket/CSR.scala

+2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ class CSRDecodeIO(implicit p: Parameters) extends CoreBundle {
245245
val fp_illegal = Output(Bool())
246246
val vector_illegal = Output(Bool())
247247
val fp_csr = Output(Bool())
248+
val vector_csr = Output(Bool())
248249
val rocc_illegal = Output(Bool())
249250
val read_illegal = Output(Bool())
250251
val write_illegal = Output(Bool())
@@ -914,6 +915,7 @@ class CSRFile(
914915
io_dec.fp_illegal := io.status.fs === 0.U || reg_mstatus.v && reg_vsstatus.fs === 0.U || !reg_misa('f'-'a')
915916
io_dec.vector_illegal := io.status.vs === 0.U || reg_mstatus.v && reg_vsstatus.vs === 0.U || !reg_misa('v'-'a')
916917
io_dec.fp_csr := decodeFast(fp_csrs.keys.toList)
918+
io_dec.vector_csr := decodeFast(vector_csrs.keys.toList)
917919
io_dec.rocc_illegal := io.status.xs === 0.U || reg_mstatus.v && reg_vsstatus.xs === 0.U || !reg_misa('x'-'a')
918920
val csr_addr_legal = reg_mstatus.prv >= CSR.mode(addr) ||
919921
usingHypervisor.B && !reg_mstatus.v && reg_mstatus.prv === PRV.S.U && CSR.mode(addr) === PRV.H.U

Diff for: src/main/scala/rocket/DCache.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class DCache(staticIdForMetadataUseOnly: Int, val crossing: ClockCrossingType)(i
9393

9494
class DCacheTLBPort(implicit p: Parameters) extends CoreBundle()(p) {
9595
val req = Flipped(Decoupled(new TLBReq(coreDataBytes.log2)))
96-
val s1_resp = Output(new TLBResp)
96+
val s1_resp = Output(new TLBResp(coreDataBytes.log2))
9797
val s2_kill = Input(Bool())
9898
}
9999

@@ -926,6 +926,7 @@ class DCacheModule(outer: DCache) extends HellaCacheModule(outer) {
926926
val s1_isSlavePortAccess = s1_req.no_xcpt
927927
val s2_isSlavePortAccess = s2_req.no_xcpt
928928
io.cpu.ordered := !(s1_valid && !s1_isSlavePortAccess || s2_valid && !s2_isSlavePortAccess || cached_grant_wait || uncachedInFlight.asUInt.orR)
929+
io.cpu.store_pending := (cached_grant_wait && isWrite(s2_req.cmd)) || uncachedInFlight.asUInt.orR
929930

930931
val s1_xcpt_valid = tlb.io.req.valid && !s1_isSlavePortAccess && !s1_nack
931932
io.cpu.s2_xcpt := Mux(RegNext(s1_xcpt_valid), s2_tlb_xcpt, 0.U.asTypeOf(s2_tlb_xcpt))

Diff for: src/main/scala/rocket/DebugROB.scala

-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class WidenedTracedInstruction extends Bundle {
2929
// These is not synthesizable, they use a C++ blackbox to implement the
3030
// write-back reordering
3131
class DebugROBPushTrace(implicit val p: Parameters) extends BlackBox with HasBlackBoxResource with HasCoreParameters {
32-
require(traceHasWdata && (vLen max xLen) <= 512)
3332
val io = IO(new Bundle {
3433
val clock = Input(Clock())
3534
val reset = Input(Bool())
@@ -45,7 +44,6 @@ class DebugROBPushTrace(implicit val p: Parameters) extends BlackBox with HasBla
4544

4645
class DebugROBPushWb(implicit val p: Parameters) extends BlackBox
4746
with HasBlackBoxResource with HasCoreParameters {
48-
require(traceHasWdata && (vLen max xLen) <= 512)
4947
val io = IO(new Bundle {
5048
val clock = Input(Clock())
5149
val reset = Input(Bool())
@@ -59,7 +57,6 @@ class DebugROBPushWb(implicit val p: Parameters) extends BlackBox
5957
}
6058

6159
class DebugROBPopTrace(implicit val p: Parameters) extends BlackBox with HasBlackBoxResource with HasCoreParameters {
62-
require(traceHasWdata && (vLen max xLen) <= 512)
6360
val io = IO(new Bundle {
6461
val clock = Input(Clock())
6562
val reset = Input(Bool())

Diff for: src/main/scala/rocket/HellaCache.scala

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ class HellaCacheIO(implicit p: Parameters) extends CoreBundle()(p) {
187187
val s2_gpa_is_pte = Input(Bool())
188188
val uncached_resp = tileParams.dcache.get.separateUncachedResp.option(Flipped(Decoupled(new HellaCacheResp)))
189189
val ordered = Input(Bool())
190+
val store_pending = Input(Bool()) // there is a store in a store buffer somewhere
190191
val perf = Input(new HellaCachePerfEvents())
191192

192193
val keep_clock_enabled = Output(Bool()) // should D$ avoid clock-gating itself?

Diff for: src/main/scala/rocket/HellaCacheArbiter.scala

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class HellaCacheArbiter(n: Int)(implicit p: Parameters) extends Module
6363
io.requestor(i).s2_gpa := io.mem.s2_gpa
6464
io.requestor(i).s2_gpa_is_pte := io.mem.s2_gpa_is_pte
6565
io.requestor(i).ordered := io.mem.ordered
66+
io.requestor(i).store_pending := io.mem.store_pending
6667
io.requestor(i).perf := io.mem.perf
6768
io.requestor(i).s2_nack := io.mem.s2_nack && s2_id === i.U
6869
io.requestor(i).s2_nack_cause_raw := io.mem.s2_nack_cause_raw

Diff for: src/main/scala/rocket/IDecode.scala

+10
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class IntCtrlSigs(aluFn: ALUFN = ALUFN())(implicit val p: Parameters) extends Bu
4444
val fence = Bool()
4545
val amo = Bool()
4646
val dp = Bool()
47+
val vec = Bool()
4748

4849
def default: List[BitPat] =
4950
// jal renf1 fence.i
@@ -433,6 +434,15 @@ class D64Decode(aluFn: ALUFN = ALUFN())(implicit val p: Parameters) extends Deco
433434
FCVT_D_LU-> List(Y,Y,N,N,N,N,N,Y,A2_X, A1_RS1, IMM_X, DW_X, aluFn.FN_X, N,M_X, N,N,N,Y,N,N,N,CSR.N,N,N,N,Y))
434435
}
435436

437+
class VCFGDecode(aluFn: ALUFN = ALUFN())(implicit val p: Parameters) extends DecodeConstants
438+
{
439+
val table: Array[(BitPat, List[BitPat])] = Array(
440+
VSETVLI -> List(Y,N,N,N,N,N,N,Y,A2_X, A1_X, IMM_X, DW_X, aluFn.FN_X, N,M_X, N,N,N,N,N,N,Y,CSR.N,N,N,N,N),
441+
VSETIVLI -> List(Y,N,N,N,N,N,N,N,A2_X, A1_X, IMM_X, DW_X, aluFn.FN_X, N,M_X, N,N,N,N,N,N,Y,CSR.N,N,N,N,N),
442+
VSETVL -> List(Y,N,N,N,N,N,Y,Y,A2_X, A1_X, IMM_X, DW_X, aluFn.FN_X, N,M_X, N,N,N,N,N,N,Y,CSR.N,N,N,N,N))
443+
}
444+
445+
436446
class RoCCDecode(aluFn: ALUFN = ALUFN())(implicit val p: Parameters) extends DecodeConstants
437447
{
438448
val table: Array[(BitPat, List[BitPat])] = Array(

Diff for: src/main/scala/rocket/NBDcache.scala

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class IOMSHR(id: Int)(implicit edge: TLEdgeOut, p: Parameters) extends L1HellaCa
5656
val mem_access = Decoupled(new TLBundleA(edge.bundle))
5757
val mem_ack = Flipped(Valid(new TLBundleD(edge.bundle)))
5858
val replay_next = Output(Bool())
59+
val store_pending = Output(Bool())
5960
})
6061

6162
def beatOffset(addr: UInt) = addr.extract(beatOffBits - 1, wordOffBits)
@@ -119,6 +120,7 @@ class IOMSHR(id: Int)(implicit edge: TLEdgeOut, p: Parameters) extends L1HellaCa
119120
io.resp.bits.data_word_bypass := loadgen.wordData
120121
io.resp.bits.store_data := req.data
121122
io.resp.bits.replay := true.B
123+
io.store_pending := state =/= s_idle && isWrite(req.cmd)
122124

123125
when (io.req.fire) {
124126
req := io.req.bits
@@ -335,6 +337,7 @@ class MSHRFile(implicit edge: TLEdgeOut, p: Parameters) extends L1HellaCacheModu
335337
val probe_rdy = Output(Bool())
336338
val fence_rdy = Output(Bool())
337339
val replay_next = Output(Bool())
340+
val store_pending = Output(Bool())
338341
})
339342

340343
// determine if the request is cacheable or not
@@ -443,6 +446,8 @@ class MSHRFile(implicit edge: TLEdgeOut, p: Parameters) extends L1HellaCacheModu
443446
TLArbiter.lowestFromSeq(edge, io.mem_acquire, mshrs.map(_.io.mem_acquire) ++ mmios.map(_.io.mem_access))
444447
TLArbiter.lowestFromSeq(edge, io.mem_finish, mshrs.map(_.io.mem_finish))
445448

449+
io.store_pending := sdq_val =/= 0.U || mmios.map(_.io.store_pending).orR
450+
446451
io.resp <> resp_arb.io.out
447452
io.req.ready := Mux(!cacheable,
448453
mmio_rdy,
@@ -1051,6 +1056,7 @@ class NonBlockingDCacheModule(outer: NonBlockingDCache) extends HellaCacheModule
10511056
io.cpu.resp.bits.data_word_bypass := loadgen.wordData
10521057
io.cpu.resp.bits.data_raw := s2_data_word
10531058
io.cpu.ordered := mshrs.io.fence_rdy && !s1_valid && !s2_valid
1059+
io.cpu.store_pending := mshrs.io.store_pending
10541060
io.cpu.replay_next := (s1_replay && s1_read) || mshrs.io.replay_next
10551061

10561062
val s1_xcpt_valid = dtlb.io.req.valid && !s1_nack

0 commit comments

Comments
 (0)