Entity arith_firstone
Block Diagram of arith_firstone
Computes from an input word, a word of the same size that has, at most, one bit set. The output contains a set bit at the position of the rightmost set bit of the input if and only if such a set bit exists in the input.
A typical use case for this computation would be an arbitration over requests with a fixed and strictly ordered priority. The terminology of the interface assumes this use case and provides some useful extras:
Set tin <= '0' (no input token) to disallow grants altogether. Read tout (unused token) to see whether or any grant was issued. Read bin to obtain the binary index of the rightmost detected one bit.
The index starts at zero (0) in the rightmost bit position.
This implementation uses carry chains for wider implementations.
Name |
Type |
Default |
Description |
---|---|---|---|
N |
positive |
Length of Token Chain |
Name |
Type |
Direction |
Description |
---|---|---|---|
tin |
std_logic |
in |
|
rqst |
std_logic_vector |
in |
|
grnt |
std_logic_vector |
out |
|
tout |
std_logic |
out |
|
bin |
std_logic_vector |
out |
Binary Grant Index |