4b5b 8b10b接线完成
This commit is contained in:
@@ -3,13 +3,19 @@ package BACK
|
||||
import chisel3._
|
||||
import chisel3.util._
|
||||
|
||||
class Encode_Bundle extends Bundle{
|
||||
val dataIn = Input(UInt(8.W))
|
||||
val isEnable = Input(Bool())
|
||||
val dataOut = Output(UInt(10.W))
|
||||
}
|
||||
|
||||
class Decode_Bundle extends Bundle{
|
||||
val dataIn = Input(UInt(10.W))
|
||||
val dataOut = Output(UInt(8.W))
|
||||
}
|
||||
|
||||
class b8b10Encode extends Module with RequireAsyncReset{
|
||||
val io = IO(new Bundle{
|
||||
val dataIn = Input(UInt(8.W))
|
||||
val isEnable = Input(Bool())
|
||||
val dataOut = Output(UInt(10.W))
|
||||
})
|
||||
val io = IO(new Encode_Bundle)
|
||||
|
||||
val rd = RegInit(false.B)
|
||||
|
||||
@@ -49,19 +55,6 @@ class b8b10Encode extends Module with RequireAsyncReset{
|
||||
(io.dataIn(4,0) === "b11111".U) -> Mux( rd, "b101011".U(6.W), "b010100".U(6.W) )
|
||||
))
|
||||
|
||||
val b3b4LookUp = Mux1H(Seq(
|
||||
(io.dataIn(7,5) === "b000".U) -> Mux( b5b6RD, "b1011".U(4.W), "b0100".U(4.W) ),
|
||||
(io.dataIn(7,5) === "b001".U) -> "b1001".U(4.W),
|
||||
(io.dataIn(7,5) === "b010".U) -> "b0101".U(4.W),
|
||||
(io.dataIn(7,5) === "b011".U) -> Mux( b5b6RD, "b1100".U(4.W), "b0011".U(4.W) ),
|
||||
(io.dataIn(7,5) === "b100".U) -> Mux( b5b6RD, "b1101".U(4.W), "b0010".U(4.W) ),
|
||||
(io.dataIn(7,5) === "b101".U) -> "b1010".U(4.W),
|
||||
(io.dataIn(7,5) === "b110".U) -> "b0110".U(4.W),
|
||||
(io.dataIn(7,5) === "b111".U) -> MuxCase( Mux( b5b6RD, "b1110".U(4.W), "b0001".U(4.W) ),
|
||||
((io.dataIn(4,0) === 17.U || io.dataIn(4,0) === 18.U || io.dataIn(4,0) === 20.U) & ~b5b6RD) -> "b0111".U(4.W), // 17, 18, 20 are special cases
|
||||
((io.dataIn(4,0) === 11.U || io.dataIn(4,0) === 13.U || io.dataIn(4,0) === 14.U) & b5b6RD) -> "b1000".U(4.W), // 11, 13, 14 are special cases
|
||||
)
|
||||
))
|
||||
|
||||
val b5b6RD = Mux1H(Seq(
|
||||
(io.dataIn(4,0) === "b00000".U) -> ~rd,
|
||||
@@ -71,7 +64,7 @@ class b8b10Encode extends Module with RequireAsyncReset{
|
||||
(io.dataIn(4,0) === "b00100".U) -> ~rd,
|
||||
(io.dataIn(4,0) === "b00101".U) -> rd,
|
||||
(io.dataIn(4,0) === "b00110".U) -> rd,
|
||||
(io.dataIn(4,0) === "b00111".U) -> rd
|
||||
(io.dataIn(4,0) === "b00111".U) -> rd,
|
||||
(io.dataIn(4,0) === "b01000".U) -> ~rd,
|
||||
(io.dataIn(4,0) === "b01001".U) -> rd,
|
||||
(io.dataIn(4,0) === "b01010".U) -> rd,
|
||||
@@ -98,6 +91,20 @@ class b8b10Encode extends Module with RequireAsyncReset{
|
||||
(io.dataIn(4,0) === "b11111".U) -> ~rd,
|
||||
))
|
||||
|
||||
val b3b4LookUp = Mux1H(Seq(
|
||||
(io.dataIn(7,5) === "b000".U) -> Mux( b5b6RD, "b1011".U(4.W), "b0100".U(4.W) ),
|
||||
(io.dataIn(7,5) === "b001".U) -> "b1001".U(4.W),
|
||||
(io.dataIn(7,5) === "b010".U) -> "b0101".U(4.W),
|
||||
(io.dataIn(7,5) === "b011".U) -> Mux( b5b6RD, "b1100".U(4.W), "b0011".U(4.W) ),
|
||||
(io.dataIn(7,5) === "b100".U) -> Mux( b5b6RD, "b1101".U(4.W), "b0010".U(4.W) ),
|
||||
(io.dataIn(7,5) === "b101".U) -> "b1010".U(4.W),
|
||||
(io.dataIn(7,5) === "b110".U) -> "b0110".U(4.W),
|
||||
(io.dataIn(7,5) === "b111".U) -> MuxCase( Mux( b5b6RD, "b1110".U(4.W), "b0001".U(4.W) ), Array(
|
||||
((io.dataIn(4,0) === 17.U || io.dataIn(4,0) === 18.U || io.dataIn(4,0) === 20.U) & ~b5b6RD) -> "b0111".U(4.W), // 17, 18, 20 are special cases
|
||||
((io.dataIn(4,0) === 11.U || io.dataIn(4,0) === 13.U || io.dataIn(4,0) === 14.U) & b5b6RD) -> "b1000".U(4.W), // 11, 13, 14 are special cases
|
||||
))
|
||||
))
|
||||
|
||||
val b3b4RD = Mux1H(Seq(
|
||||
(io.dataIn(7,5) === "b000".U) -> ~b5b6RD,
|
||||
(io.dataIn(7,5) === "b001".U) -> b5b6RD,
|
||||
@@ -126,42 +133,39 @@ class b8b10Encode extends Module with RequireAsyncReset{
|
||||
|
||||
|
||||
class b8b10Decode extends Module with RequireAsyncReset{
|
||||
val io = IO(new Bundle{
|
||||
val dataIn = Input(UInt(10.W))
|
||||
val dataOut = Output(UInt(8.W))
|
||||
})
|
||||
val io = IO(new Decode_Bundle)
|
||||
|
||||
|
||||
val b5b6LookUp = Mux1H(Seq(
|
||||
(io.dataIn(9,4) === "b100111".U(6.W) || io.dataIn(9,4) === "b011000".U(6.W) ) -> "b00000".U,
|
||||
(io.dataIn(9,4) === "b011101".U(6.W) || io.dataIn(9,4) === "b100010".U(6.W) ) -> "b00001".U,
|
||||
(io.dataIn(9,4) === "b101101".U(6.W) || io.dataIn(9,4) === "b010010".U(6.W) ) -> "b00010".U,
|
||||
(io.dataIn(9,4) === "b110001".U(6.W),) -> "b00011".U,
|
||||
(io.dataIn(9,4) === "b110001".U(6.W)) -> "b00011".U,
|
||||
(io.dataIn(9,4) === "b110101".U(6.W) || io.dataIn(9,4) === "b001010".U(6.W) ) -> "b00100".U,
|
||||
(io.dataIn(9,4) === "b101001".U(6.W),) -> "b00101".U,
|
||||
(io.dataIn(9,4) === "b011001".U(6.W),) -> "b00110".U,
|
||||
(io.dataIn(9,4) === "b101001".U(6.W)) -> "b00101".U,
|
||||
(io.dataIn(9,4) === "b011001".U(6.W)) -> "b00110".U,
|
||||
(io.dataIn(9,4) === "b111000".U(6.W) || io.dataIn(9,4) === "b000111".U(6.W) ) -> "b00111".U,
|
||||
(io.dataIn(9,4) === "b111001".U(6.W) || io.dataIn(9,4) === "b000110".U(6.W) ) -> "b01000".U,
|
||||
(io.dataIn(9,4) === "b100101".U(6.W),) -> "b01001".U,
|
||||
(io.dataIn(9,4) === "b010101".U(6.W),) -> "b01010".U,
|
||||
(io.dataIn(9,4) === "b110100".U(6.W),) -> "b01011".U,
|
||||
(io.dataIn(9,4) === "b001101".U(6.W),) -> "b01100".U,
|
||||
(io.dataIn(9,4) === "b101100".U(6.W),) -> "b01101".U,
|
||||
(io.dataIn(9,4) === "b011100".U(6.W),) -> "b01110".U,
|
||||
(io.dataIn(9,4) === "b100101".U(6.W)) -> "b01001".U,
|
||||
(io.dataIn(9,4) === "b010101".U(6.W)) -> "b01010".U,
|
||||
(io.dataIn(9,4) === "b110100".U(6.W)) -> "b01011".U,
|
||||
(io.dataIn(9,4) === "b001101".U(6.W)) -> "b01100".U,
|
||||
(io.dataIn(9,4) === "b101100".U(6.W)) -> "b01101".U,
|
||||
(io.dataIn(9,4) === "b011100".U(6.W)) -> "b01110".U,
|
||||
(io.dataIn(9,4) === "b010111".U(6.W) || io.dataIn(9,4) === "b101000".U(6.W) ) -> "b01111".U,
|
||||
(io.dataIn(9,4) === "b011011".U(6.W) || io.dataIn(9,4) === "b100100".U(6.W) ) -> "b10000".U,
|
||||
(io.dataIn(9,4) === "b100011".U(6.W),) -> "b10001".U,
|
||||
(io.dataIn(9,4) === "b010011".U(6.W),) -> "b10010".U,
|
||||
(io.dataIn(9,4) === "b110010".U(6.W),) -> "b10011".U,
|
||||
(io.dataIn(9,4) === "b001011".U(6.W),) -> "b10100".U,
|
||||
(io.dataIn(9,4) === "b101010".U(6.W),) -> "b10101".U,
|
||||
(io.dataIn(9,4) === "b011010".U(6.W),) -> "b10110".U,
|
||||
(io.dataIn(9,4) === "b100011".U(6.W)) -> "b10001".U,
|
||||
(io.dataIn(9,4) === "b010011".U(6.W)) -> "b10010".U,
|
||||
(io.dataIn(9,4) === "b110010".U(6.W)) -> "b10011".U,
|
||||
(io.dataIn(9,4) === "b001011".U(6.W)) -> "b10100".U,
|
||||
(io.dataIn(9,4) === "b101010".U(6.W)) -> "b10101".U,
|
||||
(io.dataIn(9,4) === "b011010".U(6.W)) -> "b10110".U,
|
||||
(io.dataIn(9,4) === "b111010".U(6.W) || io.dataIn(9,4) === "b000101".U(6.W) ) -> "b10111".U,
|
||||
(io.dataIn(9,4) === "b110011".U(6.W) || io.dataIn(9,4) === "b001100".U(6.W) ) -> "b11000".U,
|
||||
(io.dataIn(9,4) === "b100110".U(6.W),) -> "b11001".U,
|
||||
(io.dataIn(9,4) === "b010110".U(6.W),) -> "b11010".U,
|
||||
(io.dataIn(9,4) === "b100110".U(6.W)) -> "b11001".U,
|
||||
(io.dataIn(9,4) === "b010110".U(6.W)) -> "b11010".U,
|
||||
(io.dataIn(9,4) === "b110110".U(6.W) || io.dataIn(9,4) === "b001001".U(6.W) ) -> "b11011".U,
|
||||
(io.dataIn(9,4) === "b001110".U(6.W),) -> "b11100".U,
|
||||
(io.dataIn(9,4) === "b001110".U(6.W)) -> "b11100".U,
|
||||
(io.dataIn(9,4) === "b101110".U(6.W) || io.dataIn(9,4) === "b010001".U(6.W) ) -> "b11101".U,
|
||||
(io.dataIn(9,4) === "b011110".U(6.W) || io.dataIn(9,4) === "b100001".U(6.W) ) -> "b11110".U,
|
||||
(io.dataIn(9,4) === "b101011".U(6.W) || io.dataIn(9,4) === "b010100".U(6.W) ) -> "b11111".U,
|
||||
|
||||
Reference in New Issue
Block a user