#![allow(non_snake_case)]
#![allow(unused)]
use crate::error::Result;
use crate::utils::*;
use super::super::formatter::*;
use super::super::instruction::*;
use super::super::operand::*;
use super::super::consts::*;
use super::super::config::*;
use super::super::decoder::*;
pub(crate) struct IclassCpsA1As;
impl IclassCpsA1As {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let field_5 = (data >> 5) & 1;
let field_5_post = field_5;
let A = (data >> 8) & 1;
let A_post = A;
let imod = (data >> 18) & 3;
let imod_post = imod;
let field_31 = (data >> 20) & 4095;
let field_31_post = field_31;
let field_15 = (data >> 10) & 63;
let field_15_post = field_15;
let E = (data >> 9) & 1;
let E_post = E;
let mode = (data >> 0) & 31;
let mode_post = mode;
let op = (data >> 16) & 1;
let op_post = op;
let M = (data >> 17) & 1;
let M_post = M;
let I = (data >> 7) & 1;
let I_post = I;
let F = (data >> 6) & 1;
let F_post = F;
if ((imod_post == 0) && (M_post == 1)) {
return CpsA1As::decode(data as u32, decoder);
}
if ((imod_post == 3) && (M_post == 0)) {
return CpsidA1As::decode(data as u32, decoder);
}
if ((imod_post == 3) && (M_post == 1)) {
return CpsidA1Asm::decode(data as u32, decoder);
}
if ((imod_post == 2) && (M_post == 0)) {
return CpsieA1As::decode(data as u32, decoder);
}
if ((imod_post == 2) && (M_post == 1)) {
return CpsieA1Asm::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct CpsA1As;
impl CpsA1As {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CPS
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::None
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let A = (data >> 8) & 1;
let A_post = A;
let I = (data >> 7) & 1;
let I_post = I;
let F = (data >> 6) & 1;
let F_post = F;
let mode = (data >> 0) & 31;
let mode_post = mode;
let mode_post = mode;
let op_0 = mode_post as u32;
let mut instr = Instruction::builder(Code::CPS_A1_AS)
.operand(0, op_0)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let mode_pre = instr.op0().as_unsigned_immediate()? as u32;
let mode_pre = mode_pre;
let mode = (mode_pre & 31);
let mut instr: u32 = 0b11110001000000100000000000000000;
instr |= (mode & 31) << 0;
let bytes = instr.to_le_bytes();
let len = bytes.len();
buf.extend(bytes);
Ok(len)
}
pub fn encode_block(instr: &mut Instruction, buf: &mut Vec<u8>, labels: &std::collections::HashMap<u64, u64>) -> Result<usize> {
Self::encode(instr, buf)
}
pub fn check_op0(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if !(0..=31).contains(i) {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=31).contains(i) {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op6(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn format(instr: &Instruction, fmt: &mut impl Formatter, output: &mut impl FormatterOutput, config: &Config) -> Result<()> {
fmt.format_mnemonic(output, &config.global, &config.instructions.cps_a1_as, &instr)?;
fmt.format_qualifier(output, &config.global, &config.instructions.cps_a1_as, &instr, FormatterQualifier::Wide, false, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cps_a1_as, &instr, FormatterTextKind::Space)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cps_a1_as, &instr, FormatterTextKind::NumSign)?;
fmt.format_operand(output, &config.global, &config.instructions.cps_a1_as, &instr, 0)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsA1AsAliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsA1AsEncodings {
None
}
pub struct CpsidA1As;
impl CpsidA1As {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CPSID
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::None
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let A = (data >> 8) & 1;
let A_post = A;
let I = (data >> 7) & 1;
let I_post = I;
let F = (data >> 6) & 1;
let F_post = F;
let mode = (data >> 0) & 31;
let mode_post = mode;
let op_0 = Iflags::decode(A, I, F);
let mut instr = Instruction::builder(Code::CPSID_A1_AS)
.operand(0, op_0)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let (A, I, F) = instr.op0().as_iflags()?.encode();
let mut instr: u32 = 0b11110001000011000000000000000000;
instr |= (A & 1) << 8;
instr |= (I & 1) << 7;
instr |= (F & 1) << 6;
let bytes = instr.to_le_bytes();
let len = bytes.len();
buf.extend(bytes);
Ok(len)
}
pub fn encode_block(instr: &mut Instruction, buf: &mut Vec<u8>, labels: &std::collections::HashMap<u64, u64>) -> Result<usize> {
Self::encode(instr, buf)
}
pub fn check_op0(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Iflags(_) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op6(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn format(instr: &Instruction, fmt: &mut impl Formatter, output: &mut impl FormatterOutput, config: &Config) -> Result<()> {
fmt.format_mnemonic(output, &config.global, &config.instructions.cpsid_a1_as, &instr)?;
fmt.format_qualifier(output, &config.global, &config.instructions.cpsid_a1_as, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cpsid_a1_as, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.cpsid_a1_as, &instr, 0)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsidA1AsAliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsidA1AsEncodings {
None
}
pub struct CpsidA1Asm;
impl CpsidA1Asm {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CPSID
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::None
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let A = (data >> 8) & 1;
let A_post = A;
let I = (data >> 7) & 1;
let I_post = I;
let F = (data >> 6) & 1;
let F_post = F;
let mode = (data >> 0) & 31;
let mode_post = mode;
let op_0 = Iflags::decode(A, I, F);
let mode_post = mode;
let op_1 = mode_post as u32;
let mut instr = Instruction::builder(Code::CPSID_A1_ASM)
.operand(0, op_0)?
.operand(1, op_1)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let (A, I, F) = instr.op0().as_iflags()?.encode();
let mode_pre = instr.op1().as_unsigned_immediate()? as u32;
let mode_pre = mode_pre;
let mode = (mode_pre & 31);
let mut instr: u32 = 0b11110001000011100000000000000000;
instr |= (A & 1) << 8;
instr |= (I & 1) << 7;
instr |= (F & 1) << 6;
instr |= (mode & 31) << 0;
let bytes = instr.to_le_bytes();
let len = bytes.len();
buf.extend(bytes);
Ok(len)
}
pub fn encode_block(instr: &mut Instruction, buf: &mut Vec<u8>, labels: &std::collections::HashMap<u64, u64>) -> Result<usize> {
Self::encode(instr, buf)
}
pub fn check_op0(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Iflags(_) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if !(0..=31).contains(i) {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=31).contains(i) {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op6(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn format(instr: &Instruction, fmt: &mut impl Formatter, output: &mut impl FormatterOutput, config: &Config) -> Result<()> {
fmt.format_mnemonic(output, &config.global, &config.instructions.cpsid_a1_asm, &instr)?;
fmt.format_qualifier(output, &config.global, &config.instructions.cpsid_a1_asm, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cpsid_a1_asm, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.cpsid_a1_asm, &instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cpsid_a1_asm, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cpsid_a1_asm, &instr, FormatterTextKind::NumSign)?;
fmt.format_operand(output, &config.global, &config.instructions.cpsid_a1_asm, &instr, 1)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsidA1AsmAliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsidA1AsmEncodings {
None
}
pub struct CpsieA1As;
impl CpsieA1As {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CPSIE
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::None
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let A = (data >> 8) & 1;
let A_post = A;
let I = (data >> 7) & 1;
let I_post = I;
let F = (data >> 6) & 1;
let F_post = F;
let mode = (data >> 0) & 31;
let mode_post = mode;
let op_0 = Iflags::decode(A, I, F);
let mut instr = Instruction::builder(Code::CPSIE_A1_AS)
.operand(0, op_0)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let (A, I, F) = instr.op0().as_iflags()?.encode();
let mut instr: u32 = 0b11110001000010000000000000000000;
instr |= (A & 1) << 8;
instr |= (I & 1) << 7;
instr |= (F & 1) << 6;
let bytes = instr.to_le_bytes();
let len = bytes.len();
buf.extend(bytes);
Ok(len)
}
pub fn encode_block(instr: &mut Instruction, buf: &mut Vec<u8>, labels: &std::collections::HashMap<u64, u64>) -> Result<usize> {
Self::encode(instr, buf)
}
pub fn check_op0(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Iflags(_) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op6(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn format(instr: &Instruction, fmt: &mut impl Formatter, output: &mut impl FormatterOutput, config: &Config) -> Result<()> {
fmt.format_mnemonic(output, &config.global, &config.instructions.cpsie_a1_as, &instr)?;
fmt.format_qualifier(output, &config.global, &config.instructions.cpsie_a1_as, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cpsie_a1_as, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.cpsie_a1_as, &instr, 0)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsieA1AsAliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsieA1AsEncodings {
None
}
pub struct CpsieA1Asm;
impl CpsieA1Asm {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::CPSIE
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::None
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let A = (data >> 8) & 1;
let A_post = A;
let I = (data >> 7) & 1;
let I_post = I;
let F = (data >> 6) & 1;
let F_post = F;
let mode = (data >> 0) & 31;
let mode_post = mode;
let op_0 = Iflags::decode(A, I, F);
let mode_post = mode;
let op_1 = mode_post as u32;
let mut instr = Instruction::builder(Code::CPSIE_A1_ASM)
.operand(0, op_0)?
.operand(1, op_1)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let (A, I, F) = instr.op0().as_iflags()?.encode();
let mode_pre = instr.op1().as_unsigned_immediate()? as u32;
let mode_pre = mode_pre;
let mode = (mode_pre & 31);
let mut instr: u32 = 0b11110001000010100000000000000000;
instr |= (A & 1) << 8;
instr |= (I & 1) << 7;
instr |= (F & 1) << 6;
instr |= (mode & 31) << 0;
let bytes = instr.to_le_bytes();
let len = bytes.len();
buf.extend(bytes);
Ok(len)
}
pub fn encode_block(instr: &mut Instruction, buf: &mut Vec<u8>, labels: &std::collections::HashMap<u64, u64>) -> Result<usize> {
Self::encode(instr, buf)
}
pub fn check_op0(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Iflags(_) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::SignedImmediate(i) = op {
if !(0..=31).contains(i) {
todo!()
}
return Ok(())
}
if let Operand::UnsignedImmediate(i) = op {
if !(0..=31).contains(i) {
todo!()
}
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op5(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn check_op6(instr: &Instruction, op: &Operand) -> Result<()> {
todo!()
}
pub fn format(instr: &Instruction, fmt: &mut impl Formatter, output: &mut impl FormatterOutput, config: &Config) -> Result<()> {
fmt.format_mnemonic(output, &config.global, &config.instructions.cpsie_a1_asm, &instr)?;
fmt.format_qualifier(output, &config.global, &config.instructions.cpsie_a1_asm, &instr, FormatterQualifier::Wide, true, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cpsie_a1_asm, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.cpsie_a1_asm, &instr, 0)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cpsie_a1_asm, &instr, FormatterTextKind::Comma)?;
fmt.format_punctuation(output, &config.global, &config.instructions.cpsie_a1_asm, &instr, FormatterTextKind::NumSign)?;
fmt.format_operand(output, &config.global, &config.instructions.cpsie_a1_asm, &instr, 1)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsieA1AsmAliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum CpsieA1AsmEncodings {
None
}