Skip to content

Commit ce153dd

Browse files
committed
Merge branch 'gpc_cache_amo' into gpc_cache_wb
2 parents 9da490c + b7c185a commit ce153dd

File tree

11 files changed

+304
-263
lines changed

11 files changed

+304
-263
lines changed

.github/workflows/cache_test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: GPC DCache Test
2+
3+
on:
4+
push:
5+
tags: ['*']
6+
branches: ['gpc_cache*']
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
ci:
12+
name: ci
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Cleanup
18+
run: sed -i "s/grapecoveDCache[chisel3]/test/g" build.sc
19+
- name: Cache Scala
20+
uses: coursier/cache-action@v6
21+
- name: Setup Scala
22+
uses: coursier/setup-action@v1
23+
with:
24+
jvm: adopt:11
25+
apps: sbt mill
26+
- name: Setup Dependencies
27+
run: |
28+
sudo apt-get install ccache
29+
- name: Install Verilator
30+
run: |
31+
sudo apt-get install verilator
32+
- name: Init Submodule
33+
run: |
34+
make init
35+
- name: Cache Test
36+
run: |
37+
make test_dcache
38+
make test_amo
39+
make test_lrsc
40+
make test_mmio
41+
make test_forward
42+
make test_bypass
43+

.github/workflows/template-cleanup.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

Makefile.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ test_dcache:
44
test_amo:
55
mill -i $(PRJ)[$(CHISEL_VERSION)].test.testOnly $(PRJ).DCacheAMOTest
66

7+
test_lrsc:
8+
mill -i $(PRJ)[$(CHISEL_VERSION)].test.testOnly $(PRJ).DCacheLRSCTest
9+
710
test_mmio:
811
mill -i $(PRJ)[$(CHISEL_VERSION)].test.testOnly $(PRJ).DCacheMMIOTest
912

src/main/scala/grapecoveDcache/DCache.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class GPCDCacheImp(outer: BaseDCache) extends BaseDCacheImp(outer) {
429429
// mshr get store data in s2
430430
val s2_upgradePermMiss = RegNext(s1_upgradePermMiss)
431431
val s2_mshrStoreData = Mux(isAMO(s2_req.cmd), s2_data, Mux(s2_upgradePermMiss, s2_mergeStoreData, s2_req.wdata))
432-
val s2_mshrStoreMaskInBytes = Mux(s2_upgradePermMiss, Fill(dataBytes, 1.U), s2_req.wmask)
432+
val s2_mshrStoreMaskInBytes = Mux(s2_upgradePermMiss && !isAMO(s2_req.cmd), Fill(dataBytes, 1.U), s2_req.wmask)
433433

434434
mshrs.io.req.valid := s1_mshrAlloc
435435

@@ -572,6 +572,7 @@ class GPCDCacheImp(outer: BaseDCache) extends BaseDCacheImp(outer) {
572572

573573
// return resp
574574
io.nextCycleWb := mshrs.io.nextCycleWb
575+
io.nextSource := mshrs.io.nextSourceId
575576
io.resp.valid := s1_cacheResp.valid | mshrsResp.valid
576577
io.resp.bits := Mux(s1_cacheResp.valid, s1_cacheResp.bits, mshrsResp.bits)
577578

src/main/scala/grapecoveDcache/DataExchangeIO.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class DataExchangeIO extends Bundle {
4141
val req = Flipped(Decoupled(new DataExchangeReq))
4242
val resp = Valid(new DataExchangeResp)
4343
val nextCycleWb = Bool() // next cycle occupy wb stage
44+
val nextSource = UInt(MasterSource.width.W)
4445
val fenceRdy = Bool()
4546
val s1_kill = Input(Bool())
4647
}

src/main/scala/grapecoveDcache/MSHR.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,10 @@ class MSHRFile extends Module() {
516516
maskArray(replayReg.io.replayIdx) := 0.U
517517
dataArray(replayReg.io.replayIdx) := 0.U
518518
dataArrayWriteEna := false.B
519+
amoDataArrayWriteEna := false.B
519520
}.otherwise {
520-
dataArrayWriteEna := false.B
521+
dataArrayWriteEna := false.B
522+
amoDataArrayWriteEna := false.B
521523
}
522524

523525
// receive miss addr data at s2

src/main/scala/grapecoveDcache/MSHRIO.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class MSHREntryIO extends Bundle() {
3636
// probe permission
3737
val probeValid = Input(Bool())
3838
val probeLineAddrMatch = Output(Bool())
39-
val probePermission = Input(UInt(TLPermissions.bdWidth.W))
39+
val probePermission = Input(UInt(TLPermissions.cWidth.W))
4040
val probeState = Output(UInt(ProbeMSHRState.width.W))
4141
}
4242

@@ -127,7 +127,7 @@ class RefillMSHRFile extends Bundle() {
127127

128128
class ProbeMSHRFile extends Bundle() {
129129
val valid = Input(Bool())
130-
val probePermission = Input(UInt(TLPermissions.bdWidth.W))
130+
val probePermission = Input(UInt(TLPermissions.cWidth.W))
131131
val lineAddr = Input(UInt(lineAddrWidth.W))
132132

133133
val pass = Output(Bool())

src/main/scala/grapecoveDcache/ProbeQueue.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ class ProbeQueue(
9292
io.wbReq.bits.data := DontCare // FIXME
9393
io.wbReq.bits.hasData := false.B
9494

95-
io.memProbe.ready := (state === s_invalid) &&
96-
(!io.lrscAddr.valid ||
97-
io.lrscAddr.bits =/= getLineAddr(io.memProbe.bits.address))
98-
99-
assert(io.memProbe.bits.opcode === TLMessages.Probe || ~io.memProbe.valid)
95+
io.memProbe.ready :=
96+
(state === s_invalid) &&
97+
(!io.lrscAddr.valid ||
98+
io.lrscAddr.bits =/= getLineAddr(io.memProbe.bits.address))
10099
}

0 commit comments

Comments
 (0)