1package top 2 3import chisel3._ 4import chipsalliance.rocketchip.config 5import device._ 6import freechips.rocketchip.amba.axi4.{AXI4EdgeParameters, AXI4MasterNode, AXI4Xbar} 7import freechips.rocketchip.diplomacy.{AddressSet, InModuleBody, LazyModule, LazyModuleImp} 8 9class SimMMIO(edge: AXI4EdgeParameters)(implicit p: config.Parameters) extends LazyModule { 10 11 val node = AXI4MasterNode(List(edge.master)) 12 13 val flash = LazyModule(new AXI4Flash(Seq(AddressSet(0x10000000L, 0xfffffff)))) 14 val uart = LazyModule(new AXI4UART(Seq(AddressSet(0x40600000L, 0xf)))) 15 val vga = LazyModule(new AXI4VGA( 16 sim = false, 17 fbAddress = Seq(AddressSet(0x50000000L, 0x3fffffL)), 18 ctrlAddress = Seq(AddressSet(0x40001000L, 0x7L)) 19 )) 20 val sd = LazyModule(new AXI4DummySD(Seq(AddressSet(0x40002000L, 0xfff)))) 21 val intrGen = LazyModule(new AXI4IntrGenerator(Seq(AddressSet(0x40070000L, 0x0000ffffL)))) 22 23 val axiBus = AXI4Xbar() 24 25 uart.node := axiBus 26 vga.node :*= axiBus 27 flash.node := axiBus 28 sd.node := axiBus 29 intrGen.node := axiBus 30 31 axiBus := node 32 33 val io_axi4 = InModuleBody { 34 node.makeIOs() 35 } 36 37 def connectToSoC(soc: HaveAXI4PeripheralPort) = { 38 io_axi4 <> soc.peripheral 39 } 40 41 lazy val module = new LazyModuleImp(this){ 42 val io = IO(new Bundle() { 43 val uart = new UARTIO 44 val interrupt = new IntrGenIO 45 }) 46 io.uart <> uart.module.io.extra.get 47 io.interrupt <> intrGen.module.io.extra.get 48 } 49 50} 51