?? categoryselect.v
字號:
/*******************************************************************/
/* This module implements the category selection circuit */
/* of the Entropy encoder */
/*******************************************************************/
module categoryselect( Coefficient,
RunlengthIn,
DCin,
ACin,
EOBin,
EOB2in,
ZRLin,
Clock,
Reset,
Enable,
Category,
CoefficientOut,
RunLengthOut,
DCOut,
ACOut,
EOBOut,
EOB2out,
ZRLOut
);
// MODULE INPUTS
input [11:0] Coefficient; // Coefficient from ZRLC stage
input [3:0] RunlengthIn; // Run length from ZRLC stage
input Clock; // Clock signal
input Reset; // Low asserted System-wide reset
input DCin; // DC status signal
input ACin; // AC status signal
input EOBin; // EOB status signal
input ZRLin; // ZRL status signal
input EOB2in; // BlkEnd status signal
input Enable; // System-wide enable signal
// MODULE OUTPUTS
output DCOut; // DC status signal out
output ACOut; // AC status signal out
output EOBOut; // EOB status signal out
output ZRLOut; // ZRL status signal out
output EOB2out; // BlkEnd status signal out
output [10:0] CoefficientOut; // Coefficient output
output [3:0] RunLengthOut; // Run length output
output [3:0] Category; // Evaluated category
reg DCOut;
reg ACOut;
reg EOBOut;
reg ZRLOut;
reg EOB2out;
reg [10:0] CoefficientOut;
reg [3:0] RunLengthOut;
reg [3:0] Category;
// clocked always block implementing assignments to registers.
always @(posedge Clock or negedge Reset)
begin
if(!Reset)
begin
CoefficientOut <= 0;
RunLengthOut <= 0;
DCOut <= 0;
ACOut <= 0;
EOBOut <= 0;
ZRLOut <= 0;
EOB2out <= 0;
end
else if(Enable)
begin
CoefficientOut <= Coefficient;
RunLengthOut <= RunlengthIn;
DCOut <= DCin;
ACOut <= ACin;
EOBOut <= EOBin;
ZRLOut <= ZRLin;
EOB2out <= EOB2in;
//The following if-else block models a 2:1 multiplexer. The nested
//if else statements within the if-else block models the priority
//encoders for generating the category from the coefficient. The
//first set of if-else statements model an active-low input encoder
//for negative coefficients. The second set of if-else statements
//model an active high input encoder for positive coefficients.
if (Coefficient [11] == 1'b1)
begin
if(Coefficient [10] == 1'b0)
Category <= 11;
else if(Coefficient [9] == 1'b0)
Category <= 10;
else if(Coefficient [8] == 1'b0)
Category <= 9;
else if(Coefficient [7] == 1'b0)
Category <= 8;
else if(Coefficient [6] == 1'b0)
Category <= 7;
else if(Coefficient [5] == 1'b0)
Category <= 6;
else if(Coefficient [4] == 1'b0)
Category <= 5;
else if(Coefficient [3] == 1'b0)
Category <= 4;
else if(Coefficient [2] == 1'b0)
Category <= 3;
else if(Coefficient [1] == 1'b0)
Category <= 2;
else if(Coefficient [0] == 1'b0)
Category <= 1;
else
Category <= 0;
end
else
begin
if(Coefficient [10] == 1'b1)
Category <= 11;
else if(Coefficient [9] == 1'b1)
Category <= 10;
else if(Coefficient [8] == 1'b1)
Category <= 9;
else if(Coefficient [7] == 1'b1)
Category <= 8;
else if(Coefficient [6] == 1'b1)
Category <= 7;
else if(Coefficient [5] == 1'b1)
Category <= 6;
else if(Coefficient [4] == 1'b1)
Category <= 5;
else if(Coefficient [3] == 1'b1)
Category <= 4;
else if(Coefficient [2] == 1'b1)
Category <= 3;
else if(Coefficient [1] == 1'b1)
Category <= 2;
else if(Coefficient [0] == 1'b1)
Category <= 1;
else
Category <= 0;
end
end
end
endmodule
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -