1
- From c082597fa778343bdb2f8834abc9de835d9d270a Mon Sep 17 00:00:00 2001
1
+ From 56a2f047a9ac33350f2726afa0f3b3f40e43616b Mon Sep 17 00:00:00 2001
2
2
From: liangzhanhao <549830592@qq.com>
3
3
Date: Mon, 14 Sep 2020 19:11:34 +0800
4
4
Subject: [PATCH] feat: integrate VPU which is based on 0.8-release SPEC
@@ -13,10 +13,10 @@ Subject: [PATCH] feat: integrate VPU which is based on 0.8-release SPEC
13
13
src/main/scala/system/Configs.scala | 9 +-
14
14
src/main/scala/tile/BaseTile.scala | 6 +-
15
15
src/main/scala/tile/Core.scala | 8 +
16
- src/main/scala/tile/FPU.scala | 31 + +
17
- src/main/scala/tile/RocketTile.scala | 24 +-
16
+ src/main/scala/tile/FPU.scala | 25 +
17
+ src/main/scala/tile/RocketTile.scala | 23 +-
18
18
src/main/scala/vpuwrapper/VPUWrapper.scala | 53 ++
19
- 12 files changed, 927 insertions(+), 295 deletions(-)
19
+ 12 files changed, 920 insertions(+), 295 deletions(-)
20
20
create mode 100644 src/main/scala/vpuwrapper/VPUWrapper.scala
21
21
22
22
diff --git a/build.sbt b/build.sbt
@@ -1640,7 +1640,7 @@ index 63314dd4e..cbc28dee4 100644
1640
1640
val trace = Vec(coreParams.retireWidth, new TracedInstruction).asOutput
1641
1641
val bpwatch = Vec(coreParams.nBreakpoints, new BPWatch(coreParams.retireWidth)).asOutput
1642
1642
diff --git a/src/main/scala/tile/FPU.scala b/src/main/scala/tile/FPU.scala
1643
- index ee646cc8a..d6d1dd8a1 100644
1643
+ index ee646cc8a..6821b1d2f 100644
1644
1644
--- a/src/main/scala/tile/FPU.scala
1645
1645
+++ b/src/main/scala/tile/FPU.scala
1646
1646
@@ -140,6 +140,11 @@ class FPUCoreIO(implicit p: Parameters) extends CoreBundle()(p) {
@@ -1677,17 +1677,21 @@ index ee646cc8a..d6d1dd8a1 100644
1677
1677
class IntToFPInput(implicit p: Parameters) extends CoreBundle()(p) with HasFPUCtrlSigs {
1678
1678
val rm = Bits(width = FPConstants.RM_SZ)
1679
1679
val typ = Bits(width = 2)
1680
- @@ -736,6 +749,9 @@ class FPU(cfg: FPUParams)(implicit p: Parameters) extends FPUModule()(p) {
1680
+ @@ -733,9 +746,13 @@ class FPU(cfg: FPUParams)(implicit p: Parameters) extends FPUModule()(p) {
1681
+ assert(consistent(wdata))
1682
+ if (enableCommitLog)
1683
+ printf("f%d p%d 0x%x\n", load_wb_tag, load_wb_tag + 32, load_wb_data)
1684
+ + io.wrfr.ready := false.B //add for VPU
1681
1685
}
1682
1686
1683
1687
val ex_rs = ex_ra.map(a => regfile(a))
1684
1688
+
1685
- + io.vpu_data := regfile.read (io.vpu_addr) //add for VPU
1689
+ + io.vpu_data := regfile(io.vpu_addr) //add for VPU
1686
1690
+
1687
1691
when (io.valid) {
1688
1692
when (id_ctrl.ren1) {
1689
1693
when (!id_ctrl.swap12) { ex_ra(0) := io.inst(19,15) }
1690
- @@ -857,12 +873,27 @@ class FPU(cfg: FPUParams)(implicit p: Parameters) extends FPUModule()(p) {
1694
+ @@ -857,12 +874,20 @@ class FPU(cfg: FPUParams)(implicit p: Parameters) extends FPUModule()(p) {
1691
1695
val wdouble = Mux(divSqrt_wen, divSqrt_typeTag, !wbInfo(0).single)
1692
1696
val wdata = box(Mux(divSqrt_wen, divSqrt_wdata, (pipes.map(_.res.data): Seq[UInt])(wbInfo(0).pipeid)), wdouble)
1693
1697
val wexc = (pipes.map(_.res.exc): Seq[UInt])(wbInfo(0).pipeid)
@@ -1696,13 +1700,6 @@ index ee646cc8a..d6d1dd8a1 100644
1696
1700
+ when(io.wrfr.fire()) {
1697
1701
+ regfile(io.wrfr.bits.rd) := io.wrfr.bits.wdata
1698
1702
+ }
1699
- + when(load_wb) {
1700
- + regfile(load_wb_tag) := load_wb_data
1701
- + assert(consistent(wdata))
1702
- + if (enableCommitLog)
1703
- + printf("f%d p%d 0x%x\n", load_wb_tag, load_wb_tag + 32, load_wb_data)
1704
- + io.wrfr.ready := false.B
1705
- + }
1706
1703
+ //add for VPU
1707
1704
+
1708
1705
when ((!wbInfo(0).cp && wen(0)) || divSqrt_wen) {
@@ -1716,7 +1713,7 @@ index ee646cc8a..d6d1dd8a1 100644
1716
1713
when (wbInfo(0).cp && wen(0)) {
1717
1714
io.cp_resp.bits.data := wdata
1718
1715
diff --git a/src/main/scala/tile/RocketTile.scala b/src/main/scala/tile/RocketTile.scala
1719
- index 05b5614ef..0d438c743 100644
1716
+ index 05b5614ef..588f1d93c 100644
1720
1717
--- a/src/main/scala/tile/RocketTile.scala
1721
1718
+++ b/src/main/scala/tile/RocketTile.scala
1722
1719
@@ -13,6 +13,7 @@ import freechips.rocketchip.tilelink._
@@ -1744,11 +1741,12 @@ index 05b5614ef..0d438c743 100644
1744
1741
with HasLazyRoCCModule
1745
1742
with HasICacheFrontendModule {
1746
1743
Annotated.params(this, outer.rocketParams)
1747
- @@ -157,6 +159,20 @@ class RocketTileModuleImp(outer: RocketTile) extends BaseTileModuleImp(outer)
1744
+ @@ -157,7 +159,20 @@ class RocketTileModuleImp(outer: RocketTile) extends BaseTileModuleImp(outer)
1748
1745
// Connect the core pipeline to other intra-tile modules
1749
1746
outer.frontend.module.io.cpu <> core.io.imem
1750
1747
dcachePorts += core.io.dmem // TODO outer.dcachePorts += () => module.core.io.dmem ??
1751
1748
+
1749
+ fpuOpt foreach { fpu => core.io.fpu <> fpu.io }
1752
1750
+ //add for VPU
1753
1751
+ vpuOpt.map{ case vpu => { dcachePorts += vpu.io.dmem }}
1754
1752
+ vpuOpt foreach { vpu => core.io.vpu <> vpu.io.core }
@@ -1761,11 +1759,10 @@ index 05b5614ef..0d438c743 100644
1761
1759
+ vpu.io.fpu.resp.ready := fpu.io.wrfr.ready
1762
1760
+ }
1763
1761
+ //add for VPU
1764
- +
1765
- fpuOpt foreach { fpu => core.io.fpu <> fpu.io }
1766
1762
core.io.ptw <> ptw.io.dpath
1767
1763
1768
- @@ -186,3 +202,9 @@ class RocketTileModuleImp(outer: RocketTile) extends BaseTileModuleImp(outer)
1764
+ // Connect the coprocessor interfaces
1765
+ @@ -186,3 +201,9 @@ class RocketTileModuleImp(outer: RocketTile) extends BaseTileModuleImp(outer)
1769
1766
trait HasFpuOpt { this: RocketTileModuleImp =>
1770
1767
val fpuOpt = outer.tileParams.core.fpu.map(params => Module(new FPU(params)(outer.p)))
1771
1768
}
0 commit comments