11package system
22
3- import noop ._
3+ import noop .{ Cache , CacheConfig }
44import bus .axi4 .{AXI4 , AXI4Lite }
55import bus .simplebus ._
66import device .AXI4Timer
7-
87import chisel3 ._
98import chisel3 .util ._
109import chisel3 .util .experimental .BoringUtils
10+ import xiangshan .{XSConfig , XSCore }
1111
1212trait HasSoCParameter {
1313 val EnableILA = true
1414 val HasL2cache = true
1515 val HasPrefetch = true
1616}
1717
18- class ILABundle extends Bundle {
19- val WBUpc = UInt (32 .W )
20- val WBUvalid = UInt (1 .W )
21- val WBUrfWen = UInt (1 .W )
22- val WBUrfDest = UInt (5 .W )
23- val WBUrfData = UInt (64 .W )
24- val InstrCnt = UInt (64 .W )
25- }
18+ class ILABundle extends Bundle {}
2619
27- class NOOPSoC (implicit val p : NOOPConfig ) extends Module with HasSoCParameter {
20+ class XSSoc (implicit val p : XSConfig ) extends Module with HasSoCParameter {
2821 val io = IO (new Bundle {
2922 val mem = new AXI4
30- val mmio = ( if (p.FPGAPlatform ) { new AXI4Lite } else { new SimpleBusUC })
23+ val mmio = if (p.FPGAPlatform ) { new AXI4Lite } else { new SimpleBusUC }
3124 val frontend = Flipped (new AXI4 )
3225 val meip = Input (Bool ())
3326 val ila = if (p.FPGAPlatform && EnableILA ) Some (Output (new ILABundle )) else None
3427 })
3528
36- val noop = Module (new NOOP )
29+ val xsCore = Module (new XSCore )
3730 val cohMg = Module (new CoherenceManager )
3831 val xbar = Module (new SimpleBusCrossbarNto1 (2 ))
39- cohMg.io.in <> noop .io.imem.mem
40- noop .io.dmem.coh <> cohMg.io.out.coh
32+ cohMg.io.in <> xsCore .io.imem.mem
33+ xsCore .io.dmem.coh <> cohMg.io.out.coh
4134 xbar.io.in(0 ) <> cohMg.io.out.mem
42- xbar.io.in(1 ) <> noop .io.dmem.mem
35+ xbar.io.in(1 ) <> xsCore .io.dmem.mem
4336
4437 val axi2sb = Module (new AXI42SimpleBusConverter ())
4538 axi2sb.io.in <> io.frontend
46- noop .io.frontend <> axi2sb.io.out
39+ xsCore .io.frontend <> axi2sb.io.out
4740
4841 if (HasL2cache ) {
4942 val l2cacheOut = Wire (new SimpleBusC )
@@ -65,17 +58,16 @@ class NOOPSoC(implicit val p: NOOPConfig) extends Module with HasSoCParameter {
6558 } else {
6659 io.mem <> xbar.io.out.toAXI4()
6760 }
68-
69- noop.io.imem.coh.resp.ready := true .B
70- noop.io.imem.coh.req.valid := false .B
71- noop.io.imem.coh.req.bits := DontCare
61+ xsCore.io.imem.coh.resp.ready := true .B
62+ xsCore.io.imem.coh.req.valid := false .B
63+ xsCore.io.imem.coh.req.bits := DontCare
7264
7365 val addrSpace = List (
7466 (0x40000000L, 0x08000000L), // external devices
7567 (0x48000000L, 0x00010000L) // CLINT
7668 )
7769 val mmioXbar = Module (new SimpleBusCrossbar1toN (addrSpace))
78- mmioXbar.io.in <> noop .io.mmio
70+ mmioXbar.io.in <> xsCore .io.mmio
7971
8072 val extDev = mmioXbar.io.out(0 )
8173 val clint = Module (new AXI4Timer (sim = ! p.FPGAPlatform ))
@@ -87,22 +79,4 @@ class NOOPSoC(implicit val p: NOOPConfig) extends Module with HasSoCParameter {
8779 val meipSync = RegNext (RegNext (io.meip))
8880 BoringUtils .addSource(mtipSync, " mtip" )
8981 BoringUtils .addSource(meipSync, " meip" )
90-
91- // ILA
92- if (p.FPGAPlatform ) {
93- def BoringUtilsConnect (sink : UInt , id : String ) {
94- val temp = WireInit (0 .U (64 .W ))
95- BoringUtils .addSink(temp, id)
96- sink := temp
97- }
98-
99- val dummy = WireInit (0 .U .asTypeOf(new ILABundle ))
100- val ila = io.ila.getOrElse(dummy)
101- BoringUtilsConnect (ila.WBUpc ," ilaWBUpc" )
102- BoringUtilsConnect (ila.WBUvalid ," ilaWBUvalid" )
103- BoringUtilsConnect (ila.WBUrfWen ," ilaWBUrfWen" )
104- BoringUtilsConnect (ila.WBUrfDest ," ilaWBUrfDest" )
105- BoringUtilsConnect (ila.WBUrfData ," ilaWBUrfData" )
106- BoringUtilsConnect (ila.InstrCnt ," ilaInstrCnt" )
107- }
108- }
82+ }
0 commit comments