Hi,
What is the best way to write a vhdl code for the following encoded logic?
If there is a 4 bit register and you only need to select the first '1' in that register starting from LSB and set all others to zero, how can that be written up in VHDL? I need to do this for a 32 bit register and I cant believe writing up the whole logic (one huge concurrent statement for each bit, especially the MSBs) is the best way to do it. Can anyone here suggest any alternatives?
eg: 1011 needs to be 0001
1100 needs to be 0100
1110 needs to be 0010 etc.
Thanks a lot- any help would be greatly appreciated.
Govinda
What is the best way to write a vhdl code for the following encoded logic?
If there is a 4 bit register and you only need to select the first '1' in that register starting from LSB and set all others to zero, how can that be written up in VHDL? I need to do this for a 32 bit register and I cant believe writing up the whole logic (one huge concurrent statement for each bit, especially the MSBs) is the best way to do it. Can anyone here suggest any alternatives?
eg: 1011 needs to be 0001
1100 needs to be 0100
1110 needs to be 0010 etc.
Thanks a lot- any help would be greatly appreciated.
Govinda