prim_zero_counter
Count leading or trailing zeros in in_i.
COUNT_LEADING of 1 counts leading zeros; 0 counts trailing zeros. empty_o is high when every bit of in_i is zero. CntWidth is clog2(WIDTH) and must not be overwritten.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
WIDTH | int unsigned | 2 | Width of the input vector. |
COUNT_LEADING | bit | 1'b0 | 0 counts trailing zeros; 1 counts leading zeros. |
CntWidth | int unsigned | WIDTH > 1 ? $clog2(WIDTH) : 1 | Width of count_o; dependent, do not change. |
Ports
| Name | Direction | Type | Description |
|---|---|---|---|
in_i | input | logic [WIDTH-1:0] | Vector whose zeros are counted. |
count_o | output | logic [CntWidth-1:0] | Leading or trailing zero count. |
empty_o | output | logic | High when every bit of in_i is zero. |