tum-ei-eda / M2-ISA-R

CoreDSL2 Parser with backend to generate simulation code for the ETISS instruction set simulator
https://tum-ei-eda.github.io/M2-ISA-R/
Apache License 2.0
5 stars 6 forks source link

m2isar.backends.etiss.instruction_writer: Generatation of literals > 64bit #26

Open PhilippvK opened 5 months ago

PhilippvK commented 5 months ago

C does only provide literal suffices for up to 64 bit large constants (ULL).

We sometimes need bitmasks which are 65 bits or larger: 0x1ffffffffffffffff

The only workaround I have in mind for this is building the literal in an etiss_int128 temp variable manually...

wysiwyng commented 5 months ago

We could add generation code that splits a > 64 bit literal into two 64 bit literals and combines them back together. Alternatively, a hacky solution would be this: https://stackoverflow.com/a/33331273.

wysiwyng commented 5 months ago

In C++ this exists: https://en.cppreference.com/w/cpp/language/user_literal. Irrelevant for us unfortunately as the JIT is only C.