[Libre-soc-bugs] [Bug 980] Implement C-based Power ISA pseudocode compiler

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Jan 14 06:34:57 GMT 2024


https://bugs.libre-soc.org/show_bug.cgi?id=980

--- Comment #94 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Jacob Lifshay from comment #93)

> all assignments need to set ok too,

yes.

> in the simulator copy_assign_rhs does
> that by calling SelectableInt's constructor:
> https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/
> decoder/helpers.py;h=918a409eaf8e57762d7c67f692e6bd16d75dccba;
> hb=97f603213814159f6da349735f7a2a07d72c42cf#l78

thanks for finding that.

> so, for now, you likely only need to ensure anything that writes to an
> oppc_int is a function call, where ok = true can be put.

basically.

> later, not as part of this bug, we will need to support more than just
> oppc_int, e.g. the bfp_* code uses a rational number as the mantissa
> (SelectableMSB0Fraction, which likely needs more than 64 bits in both
> numerator and denominator), and a BFPState struct.

typecast and operator overloads provide globals and other state.

c++ wrapper #includes *the c code*,
(#include "autogenerated_compiler_output.c" - this is a trick from spike)
and the end result is total redirection even of ctx.

dmitry note from the above that global variables in the c code
(such as XLEN) are *perfectly fine* because when "wrapped" in
a "using namespace" c++ context on the exact same autogenerated
c code gets redirected.

trying that with ctx->XLEN is much harder to do in a c++ template/wrapper
whereas just XLEN (in the autogenerated output) can be
"#defined to ctx->THE_REAL_XLEN" for plain c, and made a
member of the #including wrapper/template class in c++

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list