SoC.scala 860 字节
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
    val meip = Input(Bool())
Z
Zihao Yu 已提交
16 17 18
  })

  val noop = Module(new NOOP)
19 20 21 22
  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 已提交
23

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

Z
Zihao Yu 已提交
27
  val mtipSync = RegNext(RegNext(io.mtip))
Z
Zihao Yu 已提交
28
  val meipSync = RegNext(RegNext(io.meip))
Z
Zihao Yu 已提交
29
  BoringUtils.addSource(mtipSync, "mtip")
Z
Zihao Yu 已提交
30
  BoringUtils.addSource(meipSync, "meip")
Z
Zihao Yu 已提交
31
}