forked from Github_Repos/cvw
Change priority encoder to avoid extra assignment
This commit is contained in:
parent
ff9f1e5e72
commit
6dd7591ceb
@ -36,6 +36,7 @@ module priority_encoder #(parameter BINARY_BITS = 3) (
|
|||||||
|
|
||||||
localparam ONE_HOT_BITS = 2**BINARY_BITS;
|
localparam ONE_HOT_BITS = 2**BINARY_BITS;
|
||||||
|
|
||||||
|
/*
|
||||||
genvar i, j;
|
genvar i, j;
|
||||||
generate
|
generate
|
||||||
for (i = 0; i < ONE_HOT_BITS; i++) begin
|
for (i = 0; i < ONE_HOT_BITS; i++) begin
|
||||||
@ -46,5 +47,16 @@ module priority_encoder #(parameter BINARY_BITS = 3) (
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
endgenerate
|
endgenerate
|
||||||
|
*/
|
||||||
|
|
||||||
|
logic [BINARY_BITS-1:0] binary_comb;
|
||||||
|
|
||||||
|
always_comb begin
|
||||||
|
binary_comb = 0;
|
||||||
|
for (int i = 0; i < ONE_HOT_BITS; i++)
|
||||||
|
if (one_hot[i]) binary_comb = i;
|
||||||
|
end
|
||||||
|
|
||||||
|
assign binary = binary_comb;
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user