Forum Discussion
Altera_Forum
Honored Contributor
14 years agosfixed to ufixed conversition
Hi all; I have learn about ufixed and sfixed operation. I want to convert -0.129 to sfixed using the code below and its has no problem; signal n1: ufixed (4 downto -4); ... out_A <= ...
Altera_Forum
Honored Contributor
14 years agoyou've got the sizing wrong.
(5 downto -4) * (5 downto -4) would give you a (11 downto -8) result. out_A(i) is (9 downto -10), so it doesnt fit properly. BUT there are the correct number of bits, so you effectivly just divided the result by 4. Secondly - you cannot put the loop outside of the clock branch. Move the for loop into the clocked bit of the process.