UQ-PAC / aslp

Partial evaluator for Arm's Architecture Specification Language (ASL)
Other
7 stars 2 forks source link

support non 32-bit length opcodes #89

Closed katrinafyi closed 3 months ago

katrinafyi commented 3 months ago

this retrofits the eval and dis modules to use a bigint for the opcode during the decode phase, supporting pcodes of arbitrary length and (potentially) variable-length opcodes.

once a particular encoding is identified through the decode tree, we convert the bigint to a fixed-width bitvector. this is then passed through to the rest of the evaluation / analysis.

this can be tested with the following ASL file:

__instruction test1
    __encoding test
        __instruction_set TEST
        __opcode 'xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxx'
        __guard TRUE
        __decode

    __execute
        boolean something;

        bits(64) left = Zeros();
        bits(64) right = Zeros();

        if (left == right) then
            something = TRUE;
        else
            something = FALSE;

__decode TEST
    case (0 +: 4) of
        when (_) => __encoding test

run:

dune exec asli -- --no-aarch64 prelude.asl mra_tools/arch/regs.asl mra_tools/types.asl mra_tools/arch//arch.asl tests/test.asl

this 40-bit opcode will now decode successfully: :sem TEST 0xffffeeeeff.