Guest
Consider the case below. I have a list of 8 bit values and the enable
vector that indicates which values are valid. Unfortunately, more then
one value
can become valid. One way I can solve this problem is by using
priority decoder shown in the code snippet below, but it is 16 level
decode which will
kill my timing. Can anyone think of more efficient way of doing this?
Thank you very much!!!!
// start of pseudo-code
wire [7:0] val_in_0, val_in_1, val_in_2, val_in_3, ....... ,
val_in_15;
wire [15:0] val_valid[15:0]; // one or more bits can be set
wire [7:0] val_out[7:0]
always @ *
if (val_valid[0])
val_out = val_in_0;
else if (number_valid[1])
val_out = val_in_1;
else if (number_valid[2])
val_out = val_in_2;
..
..
..
..
else if (number_valid[15])
val_out = val_in_15;
else
val_out = error;
vector that indicates which values are valid. Unfortunately, more then
one value
can become valid. One way I can solve this problem is by using
priority decoder shown in the code snippet below, but it is 16 level
decode which will
kill my timing. Can anyone think of more efficient way of doing this?
Thank you very much!!!!
// start of pseudo-code
wire [7:0] val_in_0, val_in_1, val_in_2, val_in_3, ....... ,
val_in_15;
wire [15:0] val_valid[15:0]; // one or more bits can be set
wire [7:0] val_out[7:0]
always @ *
if (val_valid[0])
val_out = val_in_0;
else if (number_valid[1])
val_out = val_in_1;
else if (number_valid[2])
val_out = val_in_2;
..
..
..
..
else if (number_valid[15])
val_out = val_in_15;
else
val_out = error;