完成对4b5b,8b10b的覆盖测试

This commit is contained in:
RuigeLee
2025-09-08 21:45:00 +08:00
parent 561f394b16
commit a6a546a0f9
3 changed files with 34 additions and 3 deletions

View File

@@ -17,7 +17,9 @@ class Decode_Bundle extends Bundle{
class b8b10Encode extends Module with RequireAsyncReset{ class b8b10Encode extends Module with RequireAsyncReset{
val io = IO(new Encode_Bundle) val io = IO(new Encode_Bundle)
val rd = RegInit(false.B) val rdTest = IO(Output(Bool())) //测试使用
dontTouch(rdTest)
val rd = RegInit(false.B); rdTest := rd
val b5b6LookUp = Mux1H(Seq( val b5b6LookUp = Mux1H(Seq(

View File

@@ -87,7 +87,7 @@ class SimCDR extends Module with RequireAsyncReset{
val isUsing8b10b = true.B val isUsing8b10b = false.B
when( isUsing8b10b ){ when( isUsing8b10b ){
@@ -106,6 +106,34 @@ class SimCDR extends Module with RequireAsyncReset{
b8b10Decoder.io.dataIn := 0.U b8b10Decoder.io.dataIn := 0.U
} }
// val coverData = RegInit(VecInit(Seq.fill(512){false.B}))
// when( record.io.enq.fire ){
// for( i <- 0 until 256 ){
// when( record.io.enq.bits === i.U ){
// when( b8b10Encoder.rdTest ){
// coverData(i) := true.B
// } .otherwise{
// coverData(256+i) := true.B
// }
// }
// }
// }
val coverData = RegInit(VecInit(Seq.fill(256){false.B}))
when( record.io.enq.fire ){
for( i <- 0 until 256 ){
when( record.io.enq.bits === i.U ){
coverData(i) := true.B
}
}
}
val coverage = PopCount(coverData.asUInt)
when( io.isSuccess ){
printf( cf"Coverage: ${coverage}\n")
}
} }

View File

@@ -43,8 +43,9 @@ module SimCDRTb(
wire success; wire success;
wire failed; wire failed;
integer seed = 666;
always @(posedge clock) begin always @(posedge clock) begin
data <= $random; data <= $random(seed);
end end