Xint64 ?

Hi everybody,

I'm using XPS/EDK with a MicroBlaze design and in my code I need a 64- bit wide variable.

Is it possible in to define something like Xint32 but for 64bit?

I know that the underlying architecture is 32bit wide but some compilers give the opportunity to declare 64bit variables and manage them (as two 32bit variables) in a transparent way to the developer.

Is it possible to do it in EDK? Does exist a workaround to this issue?

P.S. is it possible (also in assembler) to access to the 64bit register used by the processor for the result of the multiplication of two 32bit operands?

Thanks a lot!

Andrea

Reply to
Andrea05
Loading thread data ...

EDK is based on gcc so look what gcc offers for 64 bit ints. Xilinx offers Xint64 (or something along those lines), but I didn't think it was very usable because it really is a struct containing a 32-bit low part and a 32-bit high part. Having the compiler take care of the work is much easier. As far as assembler goes, you can do almost anything in assembly, at least anything that a compiler can do. So yes, you can access that multiplication result registers, which in this case are user defined. There are no 64-bit registers, all are 32-bits. Find the PPC405 reference manual and look for the instructions mullw and mulhw.

---Matthew Hicks

Reply to
Matthew Hicks

Maybe #include and use uint64_t? I far prefer using ISO standard types over vendor-specific types.

That's called open-coding it. GCC normally does that when needed.

I haven't tried, but I suspect it should work.

You get either the low or the high part, depending on whether you use the mul or mulh instructions. If you want both parts, use both instructions.

Reply to
Eric Smith

Andrea05 ha escrito:

I successfully use the following in EDK for PPC405:

typedef unsigned long long ulong64; typedef signed long long slong64;

Regards, Marc

Reply to
jetmarc

Thank you guys, the solution is the one suggested by Marc. Also using Microblaze processor is it possible to define a long long variable (which is the uint64_t type suggested by Eric). I don't know how slow is to use this kind of type but it defenitevely works!

Thanks again, Andrea

Reply to
Andrea05

Hi,

Marc is right but you should use the solution suggested by Eric because that one uses data types established by the C99 standard which makes your code more portable.

Franz

Reply to
Franz Hollerer

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.