Forum Discussion
Altera_Forum
Honored Contributor
14 years agoAdding and resizing in one step
Hi,
Is there a way to add two unsigned numbers and extract only the x most significant bits from it in one step? I want something like this: sum <= resize(number1 + number2,4) Instead of: temp <= number1 + number2 sum <= temp(7 downto 4) The existing resize function in numeric_std drops the msb's, I want the lsb's dropped. Thanks in advance!11 Replies
- Altera_Forum
Honored Contributor
Sorry for my late reply on this. Thank you all for discussing this item!
I will go further with josyb's constuct, I didn't know you could use it like this. --- Quote Start ---
--- Quote End ---sum <= unsigned(n1 + n2)(7 downto 4) ;