Added AVR8 instruction mnemonic enum

This commit is contained in:
Nav
2023-09-10 13:53:00 +01:00
parent 3c532bd934
commit 3203635397
3 changed files with 165 additions and 0 deletions

View File

@@ -10,9 +10,21 @@ namespace Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder
{
struct Instruction
{
enum class Mnemonic: std::uint8_t
{
ADC, ADD, ADIW, AND, ANDI, ASR, BCLR, BLD, BRBC, BRBS, BRCC, BRCS, BREAK, BREQ, BRGE, BRHC, BRHS, BRID,
BRIE, BRLO, BRLT, BRMI, BRNE, BRPL, BRSH, BRTC, BRTS, BRVC, BRVS, BSET, BST, CALL, CBI, CBR, CLC, CLH,
CLI, CLN, CLR, CLS, CLT, CLV, CLZ, COM, CP, CPC, CPI, CPSE, DEC, DES, EICALL, EIJMP, ELPM, EOR, FMUL,
FMULS, FMULSU, ICALL, IJMP, IN, INC, JMP, LAC, LAS, LAT, LD, LDD, LDI, LDS, LPM, LSL, LSR, MOV, MOVW,
MUL, MULS, MULSU, NEG, NOP, OR, ORI, OUT, POP, PUSH, RCALL, RET, RETI, RJMP, ROL, ROR, SBC, SBCI, SBI,
SBIC, SBIS, SBIW, SBR, SBRC, SBRS, SEC, SEH, SEI, SEN, SER, SES, SET, SEV, SEZ, SLEEP, SPM, ST, STD, STS,
SUB, SUBI, SWAP, TST, WDR, XCH,
};
const std::string& name;
std::uint32_t opcode;
std::uint8_t byteSize;
Mnemonic mnemonic;
bool canChangeProgramFlow;
std::optional<std::uint32_t> data;
@@ -36,6 +48,7 @@ namespace Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder
const std::string& name,
std::uint32_t opcode,
std::uint8_t byteSize,
Mnemonic mnemonic,
bool canChangeProgramFlow,
std::optional<std::uint32_t> data = std::nullopt,
std::optional<std::uint8_t> sourceRegister = std::nullopt,
@@ -52,6 +65,7 @@ namespace Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder
: name(name)
, opcode(opcode)
, byteSize(byteSize)
, mnemonic(mnemonic)
, canChangeProgramFlow(canChangeProgramFlow)
, data(data)
, sourceRegister(sourceRegister)

View File

@@ -161,6 +161,9 @@ namespace Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder
* @tparam wordSize
* The word size of the instruction. AVR8 instructions are either 1 or 2 words.
*
* @tparam mnemonic
* The instruction's mnemonic.
*
* @tparam canChangeProgramFlow
* Whether the instruction **can** change program flow.
*
@@ -228,6 +231,7 @@ namespace Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder
FixedString instructionName,
std::uint32_t expectedOpcode,
int wordSize,
Instruction::Mnemonic mnemonic,
bool canChangeProgramFlow,
OptionalInstructionParameter sourceRegisterParameter = std::nullopt,
OptionalInstructionParameter destinationRegisterParameter = std::nullopt,
@@ -454,6 +458,7 @@ namespace Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder
instructionName,
expectedOpcode,
wordSize,
mnemonic,
canChangeProgramFlow,
sourceRegisterParameter,
destinationRegisterParameter,
@@ -518,6 +523,7 @@ namespace Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder
SelfType::name,
opcode,
byteSize,
mnemonic,
canChangeProgramFlow
);

File diff suppressed because it is too large Load Diff