#![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 IclassSmlabbA1;
impl IclassSmlabbA1 {
pub(crate) fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let M = (data >> 6) & 1;
let M_post = M;
let field_20 = (data >> 20) & 1;
let field_20_post = field_20;
let opc = (data >> 21) & 3;
let opc_post = opc;
let N = (data >> 5) & 1;
let N_post = N;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Ra = (data >> 12) & 15;
let Ra_post = Ra;
let Rd = (data >> 16) & 15;
let Rd_post = Rd;
let field_4 = (data >> 4) & 1;
let field_4_post = field_4;
let field_27 = (data >> 23) & 31;
let field_27_post = field_27;
let cond = (data >> 28) & 15;
let cond_post = cond;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let field_7 = (data >> 7) & 1;
let field_7_post = field_7;
if ((M_post == 0) && (N_post == 0)) {
return SmlabbA1::decode(data as u32, decoder);
}
if ((M_post == 1) && (N_post == 0)) {
return SmlabtA1::decode(data as u32, decoder);
}
if ((M_post == 0) && (N_post == 1)) {
return SmlatbA1::decode(data as u32, decoder);
}
if ((M_post == 1) && (N_post == 1)) {
return SmlattA1::decode(data as u32, decoder);
}
unreachable!()
}
}
pub struct SmlabbA1;
impl SmlabbA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::SMLABB
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::Condition(0, false, false)
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let cond = (data >> 28) & 15;
let cond_post = cond;
let Rd = (data >> 16) & 15;
let Rd_post = Rd;
let Ra = (data >> 12) & 15;
let Ra_post = Ra;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let cond_post = cond;
let op_0 = MnemonicCondition::decode(cond_post)?;
let Rd_post = Rd;
let op_1 = Register::decode(Rd_post)?;
let Rn_post = Rn;
let op_2 = Register::decode(Rn_post)?;
let Rm_post = Rm;
let op_3 = Register::decode(Rm_post)?;
let Ra_post = Ra;
let op_4 = Register::decode(Ra_post)?;
let mut instr = Instruction::builder(Code::SMLABB_A1)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.operand(4, op_4)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let cond_pre = instr.op0().as_mnemonic_condition()?.encode();
let Rd_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rm_pre = instr.op3().as_register()?.encode();
let Ra_pre = instr.op4().as_register()?.encode();
let cond = (cond_pre & 15);
let Rd = (Rd_pre & 15);
let Rn = (Rn_pre & 15);
let Rm = (Rm_pre & 15);
let Ra = (Ra_pre & 15);
let mut instr: u32 = 0b00000001000000000000000010000000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 16;
instr |= (Rn & 15) << 0;
instr |= (Rm & 15) << 8;
instr |= (Ra & 15) << 12;
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::MnemonicCondition(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
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.smlabb_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabb_a1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.smlabb_a1, &instr, FormatterQualifier::Wide, false, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlabb_a1, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabb_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlabb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabb_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlabb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabb_a1, &instr, 3)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlabb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabb_a1, &instr, 4)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmlabbA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmlabbA1Encodings {
None
}
pub struct SmlabtA1;
impl SmlabtA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::SMLABT
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::Condition(0, false, false)
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let cond = (data >> 28) & 15;
let cond_post = cond;
let Rd = (data >> 16) & 15;
let Rd_post = Rd;
let Ra = (data >> 12) & 15;
let Ra_post = Ra;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let cond_post = cond;
let op_0 = MnemonicCondition::decode(cond_post)?;
let Rd_post = Rd;
let op_1 = Register::decode(Rd_post)?;
let Rn_post = Rn;
let op_2 = Register::decode(Rn_post)?;
let Rm_post = Rm;
let op_3 = Register::decode(Rm_post)?;
let Ra_post = Ra;
let op_4 = Register::decode(Ra_post)?;
let mut instr = Instruction::builder(Code::SMLABT_A1)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.operand(4, op_4)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let cond_pre = instr.op0().as_mnemonic_condition()?.encode();
let Rd_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rm_pre = instr.op3().as_register()?.encode();
let Ra_pre = instr.op4().as_register()?.encode();
let cond = (cond_pre & 15);
let Rd = (Rd_pre & 15);
let Rn = (Rn_pre & 15);
let Rm = (Rm_pre & 15);
let Ra = (Ra_pre & 15);
let mut instr: u32 = 0b00000001000000000000000011000000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 16;
instr |= (Rn & 15) << 0;
instr |= (Rm & 15) << 8;
instr |= (Ra & 15) << 12;
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::MnemonicCondition(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
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.smlabt_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabt_a1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.smlabt_a1, &instr, FormatterQualifier::Wide, false, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlabt_a1, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabt_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlabt_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabt_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlabt_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabt_a1, &instr, 3)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlabt_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlabt_a1, &instr, 4)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmlabtA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmlabtA1Encodings {
None
}
pub struct SmlatbA1;
impl SmlatbA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::SMLATB
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::Condition(0, false, false)
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let cond = (data >> 28) & 15;
let cond_post = cond;
let Rd = (data >> 16) & 15;
let Rd_post = Rd;
let Ra = (data >> 12) & 15;
let Ra_post = Ra;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let cond_post = cond;
let op_0 = MnemonicCondition::decode(cond_post)?;
let Rd_post = Rd;
let op_1 = Register::decode(Rd_post)?;
let Rn_post = Rn;
let op_2 = Register::decode(Rn_post)?;
let Rm_post = Rm;
let op_3 = Register::decode(Rm_post)?;
let Ra_post = Ra;
let op_4 = Register::decode(Ra_post)?;
let mut instr = Instruction::builder(Code::SMLATB_A1)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.operand(4, op_4)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let cond_pre = instr.op0().as_mnemonic_condition()?.encode();
let Rd_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rm_pre = instr.op3().as_register()?.encode();
let Ra_pre = instr.op4().as_register()?.encode();
let cond = (cond_pre & 15);
let Rd = (Rd_pre & 15);
let Rn = (Rn_pre & 15);
let Rm = (Rm_pre & 15);
let Ra = (Ra_pre & 15);
let mut instr: u32 = 0b00000001000000000000000010100000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 16;
instr |= (Rn & 15) << 0;
instr |= (Rm & 15) << 8;
instr |= (Ra & 15) << 12;
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::MnemonicCondition(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
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.smlatb_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatb_a1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.smlatb_a1, &instr, FormatterQualifier::Wide, false, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlatb_a1, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatb_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlatb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatb_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlatb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatb_a1, &instr, 3)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlatb_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatb_a1, &instr, 4)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmlatbA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmlatbA1Encodings {
None
}
pub struct SmlattA1;
impl SmlattA1 {
pub fn mnemonic(_instr: &Instruction) -> Mnemonic {
Mnemonic::SMLATT
}
pub fn condition(_instr: &Instruction) -> ConditionalInstruction {
ConditionalInstruction::Condition(0, false, false)
}
pub fn size(instr: &Instruction) -> usize {
4
}
pub fn decode(data: u32, decoder: &mut Decoder) -> Result<Instruction> {
let cond = (data >> 28) & 15;
let cond_post = cond;
let Rd = (data >> 16) & 15;
let Rd_post = Rd;
let Ra = (data >> 12) & 15;
let Ra_post = Ra;
let Rm = (data >> 8) & 15;
let Rm_post = Rm;
let Rn = (data >> 0) & 15;
let Rn_post = Rn;
let cond_post = cond;
let op_0 = MnemonicCondition::decode(cond_post)?;
let Rd_post = Rd;
let op_1 = Register::decode(Rd_post)?;
let Rn_post = Rn;
let op_2 = Register::decode(Rn_post)?;
let Rm_post = Rm;
let op_3 = Register::decode(Rm_post)?;
let Ra_post = Ra;
let op_4 = Register::decode(Ra_post)?;
let mut instr = Instruction::builder(Code::SMLATT_A1)
.operand(0, op_0)?
.operand(1, op_1)?
.operand(2, op_2)?
.operand(3, op_3)?
.operand(4, op_4)?
.build();
Ok(instr)
}
pub fn encode(instr: &Instruction, buf: &mut Vec<u8>) -> Result<usize> {
let cond_pre = instr.op0().as_mnemonic_condition()?.encode();
let Rd_pre = instr.op1().as_register()?.encode();
let Rn_pre = instr.op2().as_register()?.encode();
let Rm_pre = instr.op3().as_register()?.encode();
let Ra_pre = instr.op4().as_register()?.encode();
let cond = (cond_pre & 15);
let Rd = (Rd_pre & 15);
let Rn = (Rn_pre & 15);
let Rm = (Rm_pre & 15);
let Ra = (Ra_pre & 15);
let mut instr: u32 = 0b00000001000000000000000011100000;
instr |= (cond & 15) << 28;
instr |= (Rd & 15) << 16;
instr |= (Rn & 15) << 0;
instr |= (Rm & 15) << 8;
instr |= (Ra & 15) << 12;
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::MnemonicCondition(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op1(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op2(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op3(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
todo!()
}
pub fn check_op4(instr: &Instruction, op: &Operand) -> Result<()> {
if let Operand::Register(r) = op {
return Ok(())
}
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.smlatt_a1, &instr)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatt_a1, &instr, 0)?;
fmt.format_qualifier(output, &config.global, &config.instructions.smlatt_a1, &instr, FormatterQualifier::Wide, false, false)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlatt_a1, &instr, FormatterTextKind::Space)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatt_a1, &instr, 1)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlatt_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatt_a1, &instr, 2)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlatt_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatt_a1, &instr, 3)?;
fmt.format_punctuation(output, &config.global, &config.instructions.smlatt_a1, &instr, FormatterTextKind::Comma)?;
fmt.format_operand(output, &config.global, &config.instructions.smlatt_a1, &instr, 4)?;
Ok(())
}
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmlattA1Aliases {
None,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub enum SmlattA1Encodings {
None
}