Forum Discussion
Altera_Forum
Honored Contributor
10 years ago16 bits to 8 bits
Hi guys. I want to do multiplication operation. My data a is 8 bits and data B also 8 bits. Then, the width will be 16 bits when I used lpm_mult. Is there any method to reduce the output to 8 b...
Altera_Forum
Honored Contributor
10 years agoYou can just take the 8 MSBs (with rounding if you want). As long as you understand that this number is really X*256 then there is no problem. Ie. You can fit 640 into 8 bits if thats how you understand it. you can even use appropriate range definitions:
signal x : unsigned(15 downto 8); NOTE: the numeric_std library does NOT respect bit position when doing arithmatic. You need to do this yourself by extending the arrays yourself before the functions. The fixed point libraries do keep bit positions however.