PULP Community

Full Version: How to get in64_t working as well as C++ builds
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,

I'm currently working on my Master's thesis where I need to implement a software algorithm using 36 bit integers. My first approach was using the int64_t C type to represent my number. While it all worked fine on my local machine the algorithm broke in the Pulpissimo simulator.

After a while of debugging I figured out that the int64_t type does not work for me. To get started I modified `pulp-rt-examples/hello/test.c` to the code printed below, which is also a small example showing the issue that int64_t types always return the same value. I'm not sure whether this is a bug or I need to reconfigure something.

Do you have any idea how to solve this? Maybe I need to activate some compile flag or is there some 64-bit extension that I could easily add to the processor core?

I saw that the compiler does also support C++ so I wanted to give this a try but I couldn't find an example project to see how I can get the C++ compiler running. Simply changing the file extension from *.c to *.cpp did not work unfortunately.

Thank you very much Smile

BR
Dominik


Code:
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
 // Everything works when changing
 // int64_t to int32_t
 int64_t foo = 42;

 // Prints 0 instead of 42
 printf("\r\n%ld\r\n", foo);

 return 0;
}
I think the issue is that PULPissimo uses a 32bit core (RV32). Not very sure why you are using PULPissimo, is the idea to extend the processor from 32b to 36b? if it is only SW, I am not sure why you are doing this on PULP. Maybe I am missing something?
(06-30-2021, 02:07 PM)kgf Wrote: [ -> ]I think the issue is that PULPissimo uses a 32bit core (RV32). Not very sure why you are using PULPissimo, is the idea to extend the processor from 32b to 36b? if it is only SW,  I am not sure why you are doing this on PULP. Maybe I am missing something?

Thanks for your reply.

No I don't want to change the width of the processor from 32b to 36b. It's just that the algorithm needs 36b and I'm not sure how I can calculate with 36b on a 32b processor. AFAIK on x86 ISA there is an int64_t type available though it's only a 32b processor. Therefore I thought that I could also use int64_t for my values in this case.

In the end the SW should be profiled and some slow components will be placed into their own HW accelerator. But before that I need to get the SW running.

I could use some real 64b processor but my university has some existing HW accelerators for the PULPissimo therefore I would like to use the same platform such that I can easily reuse them.