added debug print states or rtl
This commit is contained in:
25
hw/rtl/libs/VX_encoder_onehot.v
Normal file
25
hw/rtl/libs/VX_encoder_onehot.v
Normal file
@@ -0,0 +1,25 @@
|
||||
`include "VX_define.vh"
|
||||
|
||||
module VX_encoder_onehot #(
|
||||
parameter N = 6
|
||||
) (
|
||||
input wire [N-1:0] onehot,
|
||||
output reg valid,
|
||||
output reg [`LOG2UP(N)-1:0] value
|
||||
);
|
||||
integer i;
|
||||
|
||||
always @(*) begin
|
||||
valid = 1'b0;
|
||||
value = {`LOG2UP(N){1'bx}};
|
||||
for (i = 0; i < N; i++) begin
|
||||
if (onehot[i]) begin
|
||||
valid = 1'b1;
|
||||
value = `LOG2UP(N)'(i);
|
||||
break;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
Reference in New Issue
Block a user