Skip to content

Commit 13fd2ab

Browse files
feat&fix: use verilatorBEnd and wire@MemCtrl addr
+ change backend to verilator @ClusterGroup & PECluster test; + using wire instead of register to get new address @MemCtrl;
1 parent d1f95ff commit 13fd2ab

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

dla/src/diplomatic/MemCtrl.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class EyerissMemCtrlModule()(implicit val p: EyerissMemCtrlParameters) extends M
4848
protected val inActStarAdrReg: UInt = RegInit(0.U(p.addressBits.W))
4949
protected val weightStarAdrReg: UInt = RegInit(0.U(p.addressBits.W))
5050
protected val pSumStarAdrReg: UInt = RegInit(0.U(p.addressBits.W))
51-
protected val inActReqAdrReg: UInt = RegInit(0.U(p.addressBits.W))
52-
protected val weightReqAdrReg: UInt = RegInit(0.U(p.addressBits.W))
53-
protected val pSumReqAdrReg: UInt = RegInit(0.U(p.addressBits.W))
51+
protected val inActReqAdrWire: UInt = Wire(UInt(p.addressBits.W))
52+
protected val weightReqAdrWire: UInt = Wire(UInt(p.addressBits.W))
53+
protected val pSumReqAdrWire: UInt = Wire(UInt(p.addressBits.W))
5454
protected val inActReqSizeReg: UInt = RegInit(0.U(p.inActSizeBits.W))
5555
inActReqSizeReg.suggestName("inActReqSizeReg")
5656
protected val weightReqSizeReg: UInt = RegInit(0.U(p.weightSizeBits.W))
@@ -85,19 +85,19 @@ class EyerissMemCtrlModule()(implicit val p: EyerissMemCtrlParameters) extends M
8585
inActReqAdrAcc := Mux(inActReqFinOnce && inActIdMapIO.finish, 0.U,
8686
Mux(inActIdMapIO.alloc.fire(), inActReqAdrAcc + inActReqSizeReg, inActReqAdrAcc)
8787
)
88-
inActReqAdrReg := inActStarAdrReg + inActReqAdrAcc
88+
inActReqAdrWire := inActStarAdrReg + inActReqAdrAcc
8989
weightReqAdrAcc := Mux(weightIdMapIO.finish, 0.U,
9090
Mux(weightIdMapIO.alloc.fire(), weightReqAdrAcc + weightReqSizeReg, weightReqAdrAcc)
9191
)
92-
weightReqAdrReg := weightStarAdrReg + weightReqAdrAcc
92+
weightReqAdrWire := weightStarAdrReg + weightReqAdrAcc
9393
pSumReqAdrAcc := Mux(pSumIdMapIO.finish, 0.U,
9494
Mux(pSumIdMapIO.alloc.fire(), pSumReqAdrAcc + pSumReqSizeReg, pSumReqAdrAcc)
9595
)
96-
pSumReqAdrReg := pSumStarAdrReg + pSumReqAdrAcc
96+
pSumReqAdrWire := pSumStarAdrReg + pSumReqAdrAcc
9797
/** connections of require address */
98-
io.inActIO.address := inActReqAdrReg
99-
io.weightIO.address := weightReqAdrReg
100-
io.pSumIO.address := pSumReqAdrReg
98+
io.inActIO.address := inActReqAdrWire
99+
io.weightIO.address := weightReqAdrWire
100+
io.pSumIO.address := pSumReqAdrWire
101101
}
102102

103103
class EyerissIDMapGenIO(val sourceWidth: Int) extends Bundle {

dla/tests/src/clustertest/ClusterGroupSpecTest.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import chisel3._
44
import chisel3.tester._
55
import chisel3.util.DecoupledIO
66
import chisel3.tester.experimental.TestOptionBuilder._
7-
import chiseltest.internal.WriteVcdAnnotation
7+
import chiseltest.internal.{VerilatorBackendAnnotation, WriteVcdAnnotation}
88
import dla.cluster._
99

1010
import scala.util.Random
@@ -24,7 +24,8 @@ class ClusterGroupSpecTest extends ClusterSpecTestBasic {
2424
}
2525
behavior of "test the spec of Cluster Group"
2626
it should "work well on Cluster Group Controller" in {
27-
test (new ClusterGroupController(debug = true)).withAnnotations(Seq(WriteVcdAnnotation)) { theCGCtrl =>
27+
test (new ClusterGroupController(debug = true))
28+
.withAnnotations(Seq(WriteVcdAnnotation, VerilatorBackendAnnotation)) { theCGCtrl =>
2829
val theTop = theCGCtrl.io
2930
val theDebugIO = theTop.debugIO
3031
val theClock = theCGCtrl.clock
@@ -198,7 +199,9 @@ class ClusterGroupSpecTest extends ClusterSpecTestBasic {
198199
}
199200

200201
it should "work well on reading and writing via inner SRAM" in {
201-
test (new ClusterGroup(true)).withAnnotations(Seq(WriteVcdAnnotation)) { theCG =>
202+
test (new ClusterGroup(true))
203+
.withAnnotations(Seq(WriteVcdAnnotation, VerilatorBackendAnnotation))
204+
{ theCG =>
202205
val theTop = theCG.io
203206
val theClock = theCG.clock
204207
def pokeData(pokeIO: DecoupledIO[UInt], pokeData: List[Int], prefix: String): Unit = {

dla/tests/src/clustertest/PEClusterSpecTest.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package dla.tests.clustertest
33
import chisel3._
44
import chisel3.tester._
55
import chisel3.util.DecoupledIO
6-
import chiseltest.internal.WriteVcdAnnotation
6+
import chiseltest.internal.{VerilatorBackendAnnotation, WriteVcdAnnotation}
77
import chisel3.tester.experimental.TestOptionBuilder._
88
import dla.cluster._
99
import dla.pe.StreamBitsIO
@@ -15,7 +15,9 @@ class PEClusterSpecTest extends ClusterSpecTestBasic {
1515
override val printLogDetails = false
1616
behavior of "test the spec of PE Cluster"
1717
it should "work well on PE inAct Controller" in {
18-
test (new PEClusterInAct(debug = true)) { thePEAct =>
18+
test (new PEClusterInAct(debug = true))
19+
.withAnnotations(Seq(WriteVcdAnnotation, VerilatorBackendAnnotation))
20+
{ thePEAct =>
1921
val theTopIO = thePEAct.io
2022
val theClock = thePEAct.clock
2123
val theTopToCtrlDataIO = theTopIO.inActToArrayData.inActIO // inActRouter number
@@ -98,7 +100,9 @@ class PEClusterSpecTest extends ClusterSpecTestBasic {
98100
}
99101

100102
it should "work well on PE Cluster" in {
101-
test (new PECluster(true)).withAnnotations(Seq(WriteVcdAnnotation)) { thePECluster =>
103+
test (new PECluster(true))
104+
.withAnnotations(Seq(WriteVcdAnnotation, VerilatorBackendAnnotation))
105+
{ thePECluster =>
102106
val theTopIO = thePECluster.io
103107
val theClock = thePECluster.clock
104108
val theCtrlIO = theTopIO.ctrlPath

0 commit comments

Comments
 (0)