2023-06-28 23:43:03 +08:00
|
|
|
package MAC
|
|
|
|
|
|
|
|
|
|
import chisel3._
|
|
|
|
|
import chisel3.util._
|
|
|
|
|
|
2023-07-03 16:25:41 +08:00
|
|
|
import freechips.rocketchip.tilelink._
|
|
|
|
|
import freechips.rocketchip.diplomacy._
|
2023-07-04 15:40:51 +08:00
|
|
|
import org.chipsalliance.cde.config._
|
2023-07-03 16:25:41 +08:00
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-07-04 14:26:24 +08:00
|
|
|
|
2023-06-29 23:28:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-30 20:21:03 +08:00
|
|
|
|
|
|
|
|
|
2023-07-11 17:45:32 +08:00
|
|
|
abstract class MacTileLinkBase(edgeIn: TLEdgeIn, edgeOut: TLEdgeOut) extends Module{
|
2023-07-04 15:40:51 +08:00
|
|
|
|
|
|
|
|
class MacTileLinkSlaveIO extends Bundle{
|
2023-07-11 17:38:18 +08:00
|
|
|
val A = Flipped(Decoupled(new TLBundleA(edgeIn.bundle)))
|
|
|
|
|
val D = Decoupled(new TLBundleD(edgeIn.bundle))
|
2023-07-04 15:40:51 +08:00
|
|
|
}
|
|
|
|
|
|
2023-07-07 21:43:06 +08:00
|
|
|
class MacTileLinkMasterIO extends Bundle{
|
|
|
|
|
val A = Decoupled(new TLBundleA(edgeOut.bundle))
|
|
|
|
|
val D = Flipped(Decoupled(new TLBundleD(edgeOut.bundle)))
|
|
|
|
|
}
|
2023-07-03 16:25:41 +08:00
|
|
|
|
2023-07-11 17:45:32 +08:00
|
|
|
class MacTileLinkIO extends Bundle{
|
2023-07-03 16:25:41 +08:00
|
|
|
|
2023-07-11 17:38:18 +08:00
|
|
|
val tlSlv = new MacTileLinkSlaveIO
|
|
|
|
|
val tlMst = new MacTileLinkMasterIO
|
2023-07-03 16:25:41 +08:00
|
|
|
|
|
|
|
|
// Tx Status signals
|
|
|
|
|
val RetryCntLatched = Input(UInt(4.W)) // Latched Retry Counter
|
|
|
|
|
val RetryLimit = Input(Bool()) // Retry limit reached (Retry Max value +1 attempts were made)
|
|
|
|
|
val LateCollLatched = Input(Bool()) // Late collision occured
|
|
|
|
|
val DeferLatched = Input(Bool()) // Defer indication (Frame was defered before sucessfully sent)
|
|
|
|
|
val CarrierSenseLost = Input(Bool()) // Carrier Sense was lost during the frame transmission
|
|
|
|
|
|
|
|
|
|
// Tx
|
|
|
|
|
val PerPacketCrcEn = Output(Bool()) // Per packet crc enable
|
|
|
|
|
val PerPacketPad = Output(Bool()) // Per packet pading
|
|
|
|
|
|
2023-07-20 10:35:56 +08:00
|
|
|
//Register
|
|
|
|
|
val r_TxEn = Input(Bool()) // Transmit enable
|
|
|
|
|
|
2023-10-08 11:34:36 +08:00
|
|
|
val BlockingTxStatusWrite = Output(Bool())
|
|
|
|
|
|
2023-10-13 15:21:53 +08:00
|
|
|
val TxUsedData = Input(Bool()) // Transmit packet used data
|
|
|
|
|
|
2023-10-12 18:37:12 +08:00
|
|
|
|
2023-10-08 11:34:36 +08:00
|
|
|
val TxValidBytesLatched = Output(UInt(2.W))
|
2023-10-10 16:48:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-08 11:34:36 +08:00
|
|
|
val TxRetrySync = Input(Bool())
|
|
|
|
|
val TxAbortSync = Input(Bool()) // Transmit packet abort
|
|
|
|
|
val TxDoneSync = Input(Bool()) // Transmission ended
|
2023-10-08 15:13:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-12 15:42:49 +08:00
|
|
|
|
2023-10-12 18:37:12 +08:00
|
|
|
val r_RxEn = Input(Bool()) // Receive enable
|
2023-10-08 15:13:35 +08:00
|
|
|
val RxDataLatched2_rxclk = Input(UInt(32.W))
|
|
|
|
|
val WriteRxDataToFifoSync = Input(Bool())
|
|
|
|
|
val RxAbortSync = Input(Bool())
|
|
|
|
|
val LatchedRxLength_rxclk = Input(UInt(16.W))
|
|
|
|
|
val RxStatusInLatched_rxclk = Input(UInt(9.W))
|
|
|
|
|
val ShiftEndedSync = Input(Bool())
|
|
|
|
|
val RxReady = Output(Bool())
|
2023-10-12 15:42:49 +08:00
|
|
|
val rxDeq = new RevBuff_Enq_Bundle
|
|
|
|
|
|
|
|
|
|
|
2023-10-11 18:48:05 +08:00
|
|
|
|
2023-10-13 15:21:53 +08:00
|
|
|
val TxStartFrm_wb = Output(Bool())
|
|
|
|
|
val TxStartFrm_syncb = Input(Bool())
|
|
|
|
|
val TxEndFrm_wb = Output(Bool())
|
|
|
|
|
|
|
|
|
|
val TxData_wb = Output(UInt(32.W))
|
|
|
|
|
val ReadTxDataFromFifo_sync = Input(Bool())
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-12 18:37:12 +08:00
|
|
|
val txEnq = Flipped(new TxBuff_Deq_Bundle)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-06-30 16:00:02 +08:00
|
|
|
|
2023-10-12 18:37:12 +08:00
|
|
|
}
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
2023-10-12 18:37:12 +08:00
|
|
|
|
|
|
|
|
val io = IO(new MacTileLinkIO)
|
2023-06-30 16:00:02 +08:00
|
|
|
|
|
|
|
|
|
2023-10-08 18:27:49 +08:00
|
|
|
val ShiftEndedSyncPluse = io.ShiftEndedSync & ~RegNext(io.ShiftEndedSync, false.B)
|
|
|
|
|
val RxAbortPluse = io.RxAbortSync & ~RegNext(io.RxAbortSync, false.B)
|
|
|
|
|
val WriteRxDataToFifoSyncPluse = io.WriteRxDataToFifoSync & ~RegNext(io.WriteRxDataToFifoSync, false.B)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-11 18:48:05 +08:00
|
|
|
val RxReady = RegInit(false.B); io.RxReady := RxReady
|
2023-06-29 18:29:54 +08:00
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-12 15:42:49 +08:00
|
|
|
val rxDeqCtrlValid = RegInit(false.B)
|
|
|
|
|
io.rxDeq.ctrl.valid := rxDeqCtrlValid
|
|
|
|
|
io.rxDeq.ctrl.bits.LatchedRxLength := RegEnable(io.LatchedRxLength_rxclk, ShiftEndedSyncPluse | RxAbortPluse)
|
|
|
|
|
io.rxDeq.ctrl.bits.RxStatusInLatched := RegEnable(io.RxStatusInLatched_rxclk, ShiftEndedSyncPluse | RxAbortPluse)
|
|
|
|
|
io.rxDeq.ctrl.bits.isRxAbort := RegEnable(RxAbortPluse, false.B, ShiftEndedSyncPluse | RxAbortPluse)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-12 15:42:49 +08:00
|
|
|
when( io.rxDeq.ctrl.fire ){
|
|
|
|
|
rxDeqCtrlValid := false.B
|
|
|
|
|
} .elsewhen( ShiftEndedSyncPluse | RxAbortPluse ){
|
|
|
|
|
rxDeqCtrlValid := true.B
|
|
|
|
|
}
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-11 18:48:05 +08:00
|
|
|
// RxReady generation
|
2023-10-12 15:42:49 +08:00
|
|
|
when(ShiftEndedSyncPluse | RxAbortPluse ){
|
2023-10-11 18:48:05 +08:00
|
|
|
RxReady := false.B
|
2023-10-12 15:42:49 +08:00
|
|
|
} .elsewhen( io.r_RxEn & (io.rxDeq.data.ready) ){
|
2023-10-11 18:48:05 +08:00
|
|
|
RxReady := true.B
|
|
|
|
|
}
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
2023-10-12 15:42:49 +08:00
|
|
|
io.rxDeq.data.bits := io.RxDataLatched2_rxclk
|
|
|
|
|
io.rxDeq.data.valid := WriteRxDataToFifoSyncPluse
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-12 15:42:49 +08:00
|
|
|
assert( (~io.rxDeq.data.valid & ~io.rxDeq.data.ready), "Assert Failed, rx overrun!" )
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-26 21:41:19 +08:00
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-08 18:27:49 +08:00
|
|
|
|
2023-10-11 18:48:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-12 18:37:12 +08:00
|
|
|
val TxStartFrm_wb = RegInit(false.B); io.TxStartFrm_wb := TxStartFrm_wb
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxStatus = RegInit(0.U(4.W)) //[14:11]
|
2023-10-11 18:48:05 +08:00
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when( io.txEnq.req.fire ){
|
2023-10-12 18:37:12 +08:00
|
|
|
TxStartFrm_wb := true.B
|
|
|
|
|
} .elsewhen(io.TxStartFrm_syncb){
|
|
|
|
|
TxStartFrm_wb := false.B
|
|
|
|
|
}
|
2023-10-11 18:48:05 +08:00
|
|
|
|
|
|
|
|
|
2023-10-13 15:21:53 +08:00
|
|
|
when((TxLength === 0.U) & io.TxUsedData){
|
|
|
|
|
TxEndFrm_wb := true.B
|
|
|
|
|
} .elsewhen(TxRetryPulse | TxDonePulse | TxAbortPulse){
|
|
|
|
|
TxEndFrm_wb := false.B
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when( io.txEnq.req.fire ){
|
|
|
|
|
TxStatus :=
|
|
|
|
|
Cat(
|
|
|
|
|
io.txEnq.req.bits.irq, io.txEnq.req.bits.wr, io.txEnq.req.bits.pad, io.txEnq.req.bits.crc
|
|
|
|
|
)
|
|
|
|
|
TxLength := io.txEnq.req.bits.txLength
|
|
|
|
|
LatchedTxLength := io.txEnq.req.bits.txLength
|
2023-10-13 15:21:53 +08:00
|
|
|
} .elsewhen( io.txEnq.data.fire ){
|
|
|
|
|
when( TxLength < 4.U ){
|
|
|
|
|
TxLength := 0.U
|
|
|
|
|
} .otherwise{
|
|
|
|
|
TxLength := TxLength - 4.U // Length is subtracted at the data request
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-11 18:48:05 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val txRespValid := RegInit(false.B)
|
2023-10-11 18:48:05 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
io.txEnq.resp.valid := txRespValid
|
|
|
|
|
io.txEnq.resp.bits :=
|
|
|
|
|
RegEnable(
|
|
|
|
|
Cat(LatchedTxLength, 0.U(1.W), TxStatus, 0.U(2.W), false.B, io.RetryCntLatched, io.RetryLimit, io.LateCollLatched, io.DeferLatched, io.CarrierSenseLost),
|
|
|
|
|
TxRetryPulse | TxDonePulse | TxAbortPulse
|
|
|
|
|
)
|
2023-10-11 18:48:05 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when( io.txEnq.resp.fire ){
|
|
|
|
|
txRespValid := false.B
|
|
|
|
|
} .elsewhen( TxRetryPulse | TxDonePulse | TxAbortPulse ){
|
|
|
|
|
txRespValid := true.B
|
|
|
|
|
}
|
2023-10-11 18:48:05 +08:00
|
|
|
|
2023-10-12 18:37:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
// // Latching READY status of the Tx buffer descriptor
|
|
|
|
|
// when(TxBDRead){ // TxBDReady is sampled only once at the beginning.
|
|
|
|
|
// TxBDReady := txBuffDesc.rd & (txBuffDesc.len > 4.U)
|
|
|
|
|
// } .elsewhen(ResetTxBDReady){ // Only packets larger then 4 bytes are transmitted.
|
|
|
|
|
// TxBDReady := false.B
|
|
|
|
|
// }
|
2023-10-11 18:48:05 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val txEnqReqReady = RegInit(true.B); io.txEnq.req.ready := txEnqReqReady
|
2023-10-11 18:48:05 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val StartTxBDRead = (TxRetryPacket_NotCleared | TxDonePacket | TxAbortPacket) & ~TxBDReady // Reading the Tx buffer descriptor
|
2023-10-11 18:48:05 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when(io.txEnq.req.fire){
|
|
|
|
|
txEnqReqReady := false.B
|
|
|
|
|
} .elsewhen(StartTxBDRead){
|
|
|
|
|
txEnqReqReady := true.B
|
|
|
|
|
}
|
2023-10-11 18:48:05 +08:00
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
// Writing status back to the Tx buffer descriptor
|
|
|
|
|
TxStatusWrite := (TxDonePacket | TxAbortPacket)
|
2023-10-11 18:48:05 +08:00
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
// Status writing must occur only once. Meanwhile it is blocked.
|
|
|
|
|
when(~io.TxDoneSync & ~io.TxAbortSync){
|
|
|
|
|
BlockingTxStatusWrite := false.B
|
|
|
|
|
} .elsewhen(TxStatusWrite){
|
|
|
|
|
BlockingTxStatusWrite := true.B
|
|
|
|
|
}
|
2023-10-11 18:48:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
2023-09-26 21:41:19 +08:00
|
|
|
|
|
|
|
|
|
2023-10-08 18:27:49 +08:00
|
|
|
|
|
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-06-30 14:46:23 +08:00
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
2023-10-11 18:48:05 +08:00
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
io.txEnq.data.ready := ReadTxDataFromFifoSyncPluse & ~tx_fifo.io.empty
|
|
|
|
|
assert( ~(io.txEnq.data.ready & ~io.txEnq.data.valid), "Assert Failed, Tx should never under run!" )
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
io.TxData_wb := io.txEnq.data.bits
|
2023-10-08 15:13:35 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
tx_fifo.io.clear := TxAbortPacket | TxRetryPacket
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-07-07 21:43:06 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxRetryPacket = RegInit(false.B)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxDonePacket = RegInit(false.B)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxAbortPacket = RegInit(false.B)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxBDReady = RegInit(false.B)
|
2023-06-29 18:29:54 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val ReadTxDataFromFifoSyncPluse = io.ReadTxDataFromFifo_sync & ~RegNext(io.ReadTxDataFromFifo_sync, false.B)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxLength = RegInit(0.U(16.W))
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxRetryPulse = io.TxRetrySync & ~RegNext(io.TxRetrySync, false.B)
|
|
|
|
|
val TxDonePulse = io.TxDoneSync & ~RegNext(io.TxDoneSync, false.B)
|
|
|
|
|
val TxAbortPulse = io.TxAbortSync & ~RegNext(io.TxAbortSync, false.B)
|
|
|
|
|
val LatchedTxLength = RegInit(0.U(16.W))
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-09-26 21:41:19 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val BlockingTxStatusWrite = RegInit(false.B); io.BlockingTxStatusWrite := BlockingTxStatusWrite
|
2023-06-29 18:29:54 +08:00
|
|
|
|
|
|
|
|
|
2023-09-26 21:41:19 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxEndFrm_wb = RegInit(false.B); io.TxEndFrm_wb := TxEndFrm_wb
|
2023-09-26 21:41:19 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
// Delayed stage signals
|
|
|
|
|
val r_TxEn_q = RegNext(io.r_TxEn, false.B)
|
2023-09-26 21:41:19 +08:00
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxAbortPacketBlocked = RegInit(false.B)
|
2023-06-29 18:29:54 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when( io.TxAbortSync & (~TxAbortPacketBlocked) ){
|
|
|
|
|
TxAbortPacket := true.B
|
|
|
|
|
} .otherwise{
|
|
|
|
|
TxAbortPacket := false.B
|
2023-06-28 23:43:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when(~io.TxAbortSync & RegNext(io.TxAbortSync, false.B)){
|
|
|
|
|
TxAbortPacketBlocked := false.B
|
|
|
|
|
} .elsewhen(TxAbortPacket){
|
|
|
|
|
TxAbortPacketBlocked := true.B
|
2023-06-28 23:43:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxRetryPacketBlocked = RegInit(false.B)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when( io.TxRetrySync & ~TxRetryPacketBlocked ){
|
|
|
|
|
TxRetryPacket := true.B
|
|
|
|
|
} .otherwise{
|
|
|
|
|
TxRetryPacket := false.B
|
2023-06-28 23:43:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
when(StartTxBDRead){
|
2023-10-13 18:18:02 +08:00
|
|
|
TxRetryPacket_NotCleared := false.B
|
|
|
|
|
} .elsewhen( io.TxRetrySync & ~TxRetryPacketBlocked ){
|
|
|
|
|
TxRetryPacket_NotCleared := true.B
|
2023-06-28 23:43:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when( ~io.TxRetrySync & RegNext(io.TxRetrySync, false.B) ){
|
|
|
|
|
TxRetryPacketBlocked := false.B
|
|
|
|
|
} .elsewhen(TxRetryPacket){
|
|
|
|
|
TxRetryPacketBlocked := true.B
|
2023-06-28 23:43:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
val TxDonePacketBlocked = RegInit(false.B)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when( io.TxDoneSync & ~TxDonePacketBlocked ){
|
|
|
|
|
TxDonePacket := true.B
|
|
|
|
|
}.otherwise{
|
|
|
|
|
TxDonePacket := false.B
|
2023-10-11 18:48:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-13 18:18:02 +08:00
|
|
|
when(~io.TxDoneSync & RegNext(io.TxDoneSync, false.B)){
|
|
|
|
|
TxDonePacketBlocked := false.B
|
|
|
|
|
} .elsewhen(TxDonePacket){
|
|
|
|
|
TxDonePacketBlocked := true.B
|
|
|
|
|
}
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-07-07 21:43:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-07-07 21:43:06 +08:00
|
|
|
|
|
|
|
|
|
2023-10-08 18:27:49 +08:00
|
|
|
|
|
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Marks which bytes are valid within the word.
|
2023-10-08 11:34:36 +08:00
|
|
|
val TxValidBytesLatched = RegInit(0.U(2.W)); io.TxValidBytesLatched := TxValidBytesLatched
|
2023-09-26 21:41:19 +08:00
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-08 18:27:49 +08:00
|
|
|
val LatchValidBytes = ShiftRegisters((TxLength < 4.U) & TxBDReady, 2, false.B, true.B)
|
|
|
|
|
val LatchValidBytesPluse = LatchValidBytes(0) & ~LatchValidBytes(1)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
// Latching valid bytes
|
2023-10-08 18:27:49 +08:00
|
|
|
when(LatchValidBytesPluse){
|
|
|
|
|
TxValidBytesLatched := Mux(TxLength < 4.U, TxLength(1,0), 0.U)
|
2023-06-28 23:43:03 +08:00
|
|
|
} .elsewhen(TxRetryPulse | TxDonePulse | TxAbortPulse){
|
|
|
|
|
TxValidBytesLatched := 0.U
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-06-30 16:00:02 +08:00
|
|
|
val TxIRQEn = TxStatus.extract(3) //[14:11]
|
|
|
|
|
val WrapTxStatusBit = TxStatus.extract(2)
|
2023-06-29 18:29:54 +08:00
|
|
|
io.PerPacketPad := TxStatus.extract(1)
|
|
|
|
|
io.PerPacketCrcEn := TxStatus.extract(0)
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-10-11 18:48:05 +08:00
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
2023-06-29 18:29:54 +08:00
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
2023-10-13 15:21:53 +08:00
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
2023-10-07 16:44:13 +08:00
|
|
|
}
|
2023-06-29 18:29:54 +08:00
|
|
|
|
|
|
|
|
|
2023-10-07 16:44:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-08 15:37:54 +08:00
|
|
|
class MacTileLink(edgeIn: TLEdgeIn, edgeOut: TLEdgeOut) extends MacTileLinkBase(edgeIn, edgeOut)
|
2023-10-07 16:44:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-28 23:43:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|