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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Fri Dec 8 17:45:21 GMT 2023


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

--- Comment #32 from Dmitry Selyutin <ghostmansd at gmail.com> ---
Supported more nodes, I'm not saying all nodes are already implemented, but
many are.

tree = Module(
    description=String("Subtract From"),
    form=Form.XO,
    mnemonics=Mnemonics([
        Mnemonic(
            name=String("subf"),
            dynamic_operands=DynamicOperands([
                DynamicOperand("RT"),
                DynamicOperand("RA"),
                DynamicOperand("RB"),
            ]),
            static_operands=StaticOperands([
                StaticOperand(key=String("OE"), value=Int(0)),
                StaticOperand(key=String("Rc"), value=Int(0)),
            ]),
        ),
        Mnemonic(
            name=String("subf."),
            dynamic_operands=DynamicOperands([
                DynamicOperand("RT"),
                DynamicOperand("RA"),
                DynamicOperand("RB"),
            ]),
            static_operands=StaticOperands([
                StaticOperand(key=String("OE"), value=Int(0)),
                StaticOperand(key=String("Rc"), value=Int(1)),
            ]),
        ),
        Mnemonic(
            name=String("subfo"),
            dynamic_operands=DynamicOperands([
                DynamicOperand("RT"),
                DynamicOperand("RA"),
                DynamicOperand("RB"),
            ]),
            static_operands=StaticOperands([
                StaticOperand(key=String("OE"), value=Int(1)),
                StaticOperand(key=String("Rc"), value=Int(0)),
            ]),
        ),
        Mnemonic(
            name=String("subfo."),
            dynamic_operands=DynamicOperands([
                DynamicOperand("RT"),
                DynamicOperand("RA"),
                DynamicOperand("RB"),
            ]),
            static_operands=StaticOperands([
                StaticOperand(key=String("OE"), value=Int(1)),
                StaticOperand(key=String("Rc"), value=Int(1)),
            ]),
        ),
    ]),
    alterations=Alterations([
        Alteration(
            registers=Registers([
                String("CR0"),
            ]),
            condition=Condition(key=String("Rc"), value=Int(1)),
        ),
        Alteration(
            registers=Registers([
                String("SO"),
                String("OV"),
                String("OV32"),
            ]),
            condition=Condition(key=String("OE"), value=Int(1)),
        ),
    ]),
    code=Code([
        Assign(
            lvalue=String("RT"),
            rvalue=BinaryOp(
                left=BinaryOp(
                    left=UnaryOp(
                        op=Not(),
                        expr=String("RA"),
                    ),
                    op=Add(),
                    right=String("RB"),
                ),
                op=Add(),
                right=Int(1),
            ),
        ),
    ]),
)
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