Files
eb001/src/main/scala/backBoard/shin/MasterParser.scala

100 lines
2.0 KiB
Scala
Raw Normal View History

2025-04-24 17:31:44 +08:00
// package BACK
2025-04-02 16:40:25 +08:00
2025-04-24 17:31:44 +08:00
// import chisel3._
// import chisel3.util._
2025-04-02 16:40:25 +08:00
2025-04-24 17:31:44 +08:00
// class MasterParserIO extends Module{
// val downOut = Decoupled(new AXIS_Bundle(8))
// val upIn = Flipped( Decoupled(new AXIS_Bundle(8)) )
2025-04-02 16:40:25 +08:00
2025-04-24 17:31:44 +08:00
// val sram_r = Flipped(new ShareSRAMIO)
// val sram_w = Flipped(new ShareSRAMIO)
2025-04-02 16:40:25 +08:00
2025-04-24 17:31:44 +08:00
// val req = Valid(new Bundle{
// val length = UInt(12.W)
// })
// val rsp = Valid(new Bundle{
// val isError = Bool()
// val length = UInt(12.W)
// })
2025-04-02 16:40:25 +08:00
2025-04-24 17:31:44 +08:00
// }
2025-04-02 16:40:25 +08:00
2025-04-24 17:31:44 +08:00
// abstract class MasterParserBase extends Module{
// val io: MasterParserIO = IO(new MasterParserIO)
2025-04-02 16:40:25 +08:00
2025-04-24 17:31:44 +08:00
// val sendCnt = Reg(UInt(11.W))
// val sendLen = Reg(UInt(11.W))
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// val reqReady = RegInit(true.B)
// val sendAddr = Reg(UInt(12.W))
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// io.req.ready := reqReady
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// when( io.req.fire ){
// reqReady := false.B
// } .elsewhen( io.downOut.fire & sendCnt === sendLen ){
// reqReady := true.B
// }
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// when( io.req.fire ){
// sendLen := io.req.bits.length
// sendCnt := 0.U
// } .elsewhen( io.downOut.fire ){
// sendCnt := sendCnt + 1.U
// }
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// when( reqReady ){
// sendAddr := 0.U
// } .elsewhen( io.downOut.fire ){
// sendAddr := sendAddr + 1.U
// }
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// io.sram_r.enr :=
// io.req.fire | io.downOut.fire
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// io.sram_r.addr := Mux( io.req.fire, io.req.bits.addr, sendCnt )
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// io.downOut.valid := ~reqReady
// io.downOut.bits.tdata := io.req.bits.datar
// io.downOut.bits.tuser := false.B
// io.downOut.bits.tlast := sendCnt === sendLen
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// val recAddr = Reg(UInt(12.W))
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// io.upIn.ready := true.B
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// io.sram_w.enw := io.upIn.fire
// io.sram_w.addr := recAddr
// io.sram_w.dataw := io.upIn.bits.tdata
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// when( io.upIn.fire ){
// when( io.upIn.bits.tlast ){
// recAddr := 0.U
// } .otherwise{
// recAddr := recAddr + 1.U
// }
// }
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// io.rsp.valid := io.upIn.fire & io.upIn.bits.tlast
// io.rsp.bits.isError := io.upIn.fire & io.upIn.bits.tuser
// io.rsp.bits.length := recAddr
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// }
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// class MasterParser extends MasterParserBase{
2025-04-16 16:49:42 +08:00
2025-04-24 17:31:44 +08:00
// }