VMCU_GROUP - Milo-D/libvmcu-Virtual-MCU-Library GitHub Wiki

Definition

Defined in libvmcu_analyzer.h
typedef enum { ..., VMCU_GROUP_FLOW, ... } VMCU_GROUP

Description

Enumeration of instruction groups. Each instruction belongs to a instruction group. For example, ret belongs to VMCU_GROUP_FLOW.

VMCU_GROUP Description
VMCU_GROUP_MATH_LOGIC math-logic instructions
VMCU_GROUP_SYS_CTRL system control instructions
VMCU_GROUP_TRANSFER data transfer instructions
VMCU_GROUP_FLOW flow control instructions
VMCU_GROUP_BIT bit instructions

Example

#include "libvmcu_analyzer.h" // VMCU_SFR

static void print_instruction(const vmcu_instr_t *instr) {

    printf("%s",  instr->mnem.base);

    if(instr->dest.type != VMCU_OPTYPE_NONE)
        printf(" %s,", instr->mnem.dest);

    if(instr->src.type != VMCU_OPTYPE_NONE)
        printf(" %s", instr->mnem.src);

    printf(" %s\n", instr->mnem.comment);
}

int main(const int argc, const char **argv) {
   
    vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
    vmcu_report_t *report = vmcu_analyze_file("file.hex", m328p);

    for(uint32_t i = 0; i < report->progsize; i++) {

        vmcu_instr_t *instr = &report->disassembly[i];

        if(instr->group == VMCU_GROUP_FLOW)
            print_instruction(instr);
    }   

    vmcu_report_dtor(report);
    vmcu_model_dtor(m328p);

    return 0;
}

Possible Output

jmp 0x48
rcall -9
rjmp -1
ret
call 0x009c
reti

Notes

1 The integer value of a single VMCU_GROUP does not have a special meaning
2 VMCU_GROUP_NONE = -1 (no group = .dw xxxx) \

References

[1] https://ww1.microchip.com/downloads/en/DeviceDoc/AVR-Instruction-Set-Manual-DS40002198A.pdf

⚠️ **GitHub.com Fallback** ⚠️