SoC.scala 746 字节
Newer Older
Z
Zihao Yu 已提交
1 2 3 4
package system

import noop.{NOOP, NOOPConfig}
import bus.axi4.{AXI4, AXI4Lite}
5
import bus.simplebus._
Z
Zihao Yu 已提交
6 7

import chisel3._
8
import chisel3.util.experimental.BoringUtils
Z
Zihao Yu 已提交
9 10 11

class NOOPSoC(implicit val p: NOOPConfig) extends Module {
  val io = IO(new Bundle{
12
    val mem = new AXI4
13
    val mmio = (if (p.FPGAPlatform) { new AXI4Lite } else { new SimpleBusUC })
14
    val mtip = Input(Bool())
Z
Zihao Yu 已提交
15 16 17
  })

  val noop = Module(new NOOP)
18 19 20 21
  val cohMg = Module(new CoherenceInterconnect)
  cohMg.io.in(0) <> noop.io.imem
  cohMg.io.in(1) <> noop.io.dmem
  io.mem <> cohMg.io.out.toAXI4()
Z
Zihao Yu 已提交
22

23
  if (p.FPGAPlatform) io.mmio <> noop.io.mmio.toAXI4Lite()
Z
Zihao Yu 已提交
24
  else io.mmio <> noop.io.mmio
25

Z
Zihao Yu 已提交
26 27
  val mtipSync = RegNext(RegNext(io.mtip))
  BoringUtils.addSource(mtipSync, "mtip")
Z
Zihao Yu 已提交
28
}