Add two numbers using nioss2 processor in FPGA

84 Views Asked by At

I'm new to FPGA and nios2. I want to add two integers using niosII. When I going to add two integers I wrote a C code like this.

#include "stdio.h"
#include "io.h"
#include "system.h"
int main()
{
    unsigned int a = 24,b=56,c,ans;

    c=a+b;
    printf("%d\n",c);

    while(1);
    return 0;
}

this code gave me correct answer. Now my question is which processor did the a+b operation? computer or FPGA board?. and is here essential to use custom component to do this operation? are there any inbuilt arithmetic operations in niosII?. Please anyone can give me answer. Thanks in advance.

1

There are 1 best solutions below

0
0___________ On

Now my question is which processor did the a+b operation?

FPGA is not the processor. FPGA chip is just large set of logical units. Those units when programmed using NIOS logic form the processor. Now FPGA chip is the NIOS processor.