Microblaze: how to determine remainder after integer division

Hello all,

Fairly new user to Xilinx microblaze here (and first post to this user group). I'm trying to write C-code (within Xilinx Platform Studio) to determine the remainder after an integer division. So if I say

num = 13/10; rem = 13%10;

then num = 1 and rem = 3.

I'm getting an error stating "invalid operands to binary %" when I try to build.

What I surmise is that % is trying to convert to a binary format rather than obtaining the desired remainder result. I would also assume that I need to include the correct header file in order to perform the remainder operation.

However, I'm having trouble determining what math functions are available w/in microblaze and the associated symbols needed to perform desired functions (i.e., how to determine an integer remainder).

When I'm configuring microblaze in fpga hardware, should I use floating point? I can't find any math include file under /microblaze_0/include.

Thanks for the help in figuring this out. I'm sure there's an easy answer...

Reply to
Loading thread data ...

You might want to check if your code compiles fine on an Intel machine. '%' as an operation only makes sense for integers.

If num & rem are int's, then you don't need any headers.

That depends on whether you need the hardware FPU or not. The GNU includes are typically in $XILINX_EDK/gnu


Reply to
Siva Velusamy

Thanks, I figured it out. My c-programming is rusty...I had a different error, that once fixed solved the problem.

Siva Velusamy wrote:

Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.