1package top 2 3import chisel3._ 4import chisel3.util._ 5 6import bus.simplebus._ 7import device._ 8 9class DeviceHelper extends BlackBox { 10 val io = IO(new Bundle { 11 val clk = Input(Clock()) 12 val reset = Input(Bool()) 13 val reqValid = Input(Bool()) 14 val reqWen = Input(Bool()) 15 val reqAddr = Input(UInt(64.W)) 16 val reqWdata = Input(UInt(64.W)) 17 val reqWmask = Input(UInt(8.W)) 18 val respRdata = Output(UInt(64.W)) 19 }) 20} 21 22class SimMMIO extends Module { 23 val io = IO(new Bundle { 24 val rw = Flipped(new SimpleBusUC) 25 }) 26 27 val devAddrSpace = List( 28 (0x40600000L, 0x10L), // uart 29 (0x40700000L, 0x10L) // timer 30 ) 31 32 val xbar = Module(new SimpleBusCrossbar(1, devAddrSpace)) 33 xbar.io.in(0) <> io.rw 34 35 val uart = Module(new AXI4UART) 36 val timer = Module(new AXI4Timer) 37 uart.io.in <> xbar.io.out(0).toAXI4Lite() 38 timer.io.in <> xbar.io.out(1).toAXI4Lite() 39 40 //val helper = Module(new DeviceHelper) 41 //val helperIO = xbar.io.out(0) 42 //helper.io.clk := clock 43 //helper.io.reset := reset.asBool 44 //helper.io.reqValid := helperIO.req.valid 45 //helper.io.reqWen := helperIO.isWrite() 46 //helper.io.reqAddr := helperIO.req.bits.addr 47 //helper.io.reqWdata := helperIO.req.bits.wdata 48 //helper.io.reqWmask := helperIO.req.bits.wmask 49 //helperIO.resp.bits.rdata := helper.io.respRdata 50 //helperIO.resp.bits.cmd := 0.U 51 //helperIO.resp.bits.user := 0.U 52 53 //helperIO.req.ready := true.B 54 //helperIO.resp.valid := RegNext(helperIO.req.valid) 55} 56