Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

signed conversion

Hi evryone!

I build a simple FIR-Filter as described in the attach code.

When i simulate it with impulse response as data_in, i get that the first result of the filter (data_out) is -8 and not 8 as expected...:(

Does any know why? can explain me?

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    you cannot represent 8 in 4 bits signed, the highest value is 7. "1000" is equal to -8, which is probably whats happening with the to_signed conversion for COEFF0

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi tricky!

    Thanks for your reply and explaination, I fixed it to to_signed(8, 5) and now it works.

    :):)