[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 7 23:10:49 GMT 2024


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

--- Comment #56 from Dmitry Selyutin <ghostmansd at gmail.com> ---
(In reply to Dmitry Selyutin from comment #52)
> As I'm extremely lazy with the manual checks, I have the following (crazy?)
> idea on how to test that the parsing is correct.
> 1. The new code can produce a valid AST tree after parsing.
> 2. The new code can convert an AST tree back into the pseudocode.
> 3. The old code can convert a pseudocode into a Python code.
> 4. If we do pycode(pseudocode(parse(mdwn))) and things still work, it means
> our AST is correct.

Apart of bug #1247, the only difference we have so far after conversion is
this:

     @inject()
     def op_setbc(self, CR, RT):
-        RT = copy_assign_rhs(1 if eq(CR[BI + 32], 1) else 0)
+        if eq(CR[BI + 32], 1):
+            RT = copy_assign_rhs(1)
+        else:
+            RT = copy_assign_rhs(0)
         return (CR, RT,)

There are several cases of this behavior (3 in total). This can be "fixed" via
introducing a custom tree => pseudocode conversion. I don't consider this to be
a real issue. Moreover, I think the updated version is cleaner and maps better
to a language-agnostic code generation.

Any objections?

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


More information about the libre-soc-bugs mailing list