增加加密特性(未测试)

This commit is contained in:
Ruige Lee
2025-05-22 16:53:42 +08:00
parent d14254f79a
commit 944255978a
4 changed files with 32 additions and 12 deletions

View File

@@ -13,13 +13,20 @@ class AXIS_Bundle(dw: Int) extends Bundle{
class CDROutIO extends Bundle{
val axis = Flipped(Decoupled(new AXIS_Bundle(8)))
val serDat = Output(Bool())
}
val initEncryptor = Flipped(Valid(UInt(128.W)))
}
class CDROut extends Module{
val io: CDROutIO = IO(new CDROutIO)
val encryptor = Module(new Encryptor)
encryptor.io.init := io.initEncryptor
encryptor.io.op.ready := io.axis.fire
def STATE_IDLE = 0.U
def STATE_PREAMBLE = 1.U
def STATE_PAYLOAD = 2.U
@@ -62,10 +69,10 @@ class CDROut extends Module{
when( stateCurr === STATE_PREAMBLE ){
shiftData := MuxCase( ETH_PRE, Array(
( byteCnt === 6.U ) -> ETH_SFD,
( byteCnt === 7.U ) -> Dualb4b5Encoder(io.axis.bits.tdata),
( byteCnt === 7.U ) -> Dualb4b5Encoder( io.axis.bits.tdata ^ Mux( encryptor.io.op.valid, encryptor.io.op.bits, 0.U ) ),
))
} .elsewhen( stateCurr === STATE_PAYLOAD ){
shiftData := Dualb4b5Encoder(io.axis.bits.tdata)
shiftData := Dualb4b5Encoder(io.axis.bits.tdata ^ Mux( encryptor.io.op.valid, encryptor.io.op.bits, 0.U ) )
}
}
}