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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Dec 6 17:15:23 GMT 2023


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

--- Comment #27 from Dmitry Selyutin <ghostmansd at gmail.com> ---
I'm currently writing the basic classes which represent pseudocode nodes, and
also started implementing the first simple visitor which produces the
pseudocode given the root node. Ignore the contents, they are a complete
nonsense.

tree = Module([
    If(
        test=BinaryOp(
            left=Symbol("RA"),
            op=LtU(),
            right=Symbol("RB"),
        ),
        body=Block([
            Assign(
                lvalue=Symbol("RT"),
                rvalue=BinaryOp(
                    left=Symbol("RA"),
                    op=Add(),
                    right=Symbol("RB"),
                ),
            ),
            AssignIEA(
                lvalue=Symbol("NIA"),
                rvalue=Call([
                    Symbol("RA"),
                    Call([Symbol("RB")]),
                ]),
            ),
        ]),
        orelse=Block([
            AssignIEA(
                lvalue=Symbol("NIA"),
                rvalue=Symbol("CIA"),
            ),
        ]),
    ),
])
for (level, line) in util.pcode(tree):
    stmt = ((" " * (level * 4)) + line)
    print(stmt)

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


More information about the libre-soc-bugs mailing list