Forum Discussion

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

Signed addition in Nios II

Hi all,

I need to add two numbers in Nios II.

For that i simply add two numbers in Nios II C program.

I have assigned the maximum possible 32 bit positive value .i.e. 0x7FFFFFFF in both.

What i expect is the result should saturate to 0x7FFFFFFF as in the case of micro controllers.

But the Nios II does not do like that.What can be the reason for that?

1 Reply

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

    The result doesn't saturate but Nios overflows and set the overflow status.

    AFAIK this is the normal behaviour on other microprocessors, too. I have worked with a few uP which could saturate the result instead of generating an overflow, but this was always an option you had to explicitly enable.