|
|
|
use crsn::asm::data::{Rd, Wr};
|
|
|
|
|
|
|
|
/// A low level instruction
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub enum ArithOp {
|
|
|
|
Test { a: Rd },
|
|
|
|
Compare { a: Rd, b: Rd },
|
|
|
|
RangeTest { val: Rd, a: Rd, b: Rd },
|
Add ld{32,16,8},sw{32,16,8},clz{,32,16,8},clo{,32,16,8},rng,rev,rbit; rename swap->xch
4 years ago
|
|
|
Rng { dst: Wr, min: Rd, max: Rd },
|
|
|
|
|
|
|
|
Sw32 { dst: Wr, src: Rd },
|
|
|
|
Sw16 { dst: Wr, src: Rd },
|
|
|
|
Sw8 { dst: Wr, src: Rd },
|
|
|
|
Rev { dst: Wr, src: Rd },
|
|
|
|
Rbit { dst: Wr, src: Rd },
|
|
|
|
Clz { dst: Wr, src: Rd },
|
|
|
|
Clz32 { dst: Wr, src: Rd },
|
|
|
|
Clz16 { dst: Wr, src: Rd },
|
|
|
|
Clz8 { dst: Wr, src: Rd },
|
|
|
|
Clo { dst: Wr, src: Rd },
|
|
|
|
Clo32 { dst: Wr, src: Rd },
|
|
|
|
Clo16 { dst: Wr, src: Rd },
|
|
|
|
Clo8 { dst: Wr, src: Rd },
|
|
|
|
|
|
|
|
Add { dst: Wr, a: Rd, b: Rd },
|
|
|
|
Sub { dst: Wr, a: Rd, b: Rd },
|
|
|
|
Mul { dst: Wr, a: Rd, b: Rd },
|
|
|
|
Div { dst: Wr, rem: Wr, a: Rd, div: Rd },
|
|
|
|
// "Mod" is functionally equivalent to "Div" with the result discarded,
|
|
|
|
// but status flags are updated by the remainder
|
|
|
|
Mod { dst: Wr, a: Rd, div: Rd },
|
|
|
|
|
|
|
|
And { dst: Wr, a: Rd, b: Rd },
|
|
|
|
Or { dst: Wr, a: Rd, b: Rd },
|
|
|
|
Xor { dst: Wr, a: Rd, b: Rd },
|
|
|
|
Cpl { dst: Wr, a: Rd },
|
|
|
|
Rol { dst: Wr, a: Rd, n: Rd },
|
|
|
|
// Rotate (with wrap-around)
|
|
|
|
Ror { dst: Wr, a: Rd, n: Rd },
|
|
|
|
Lsl { dst: Wr, a: Rd, n: Rd },
|
|
|
|
// Shift
|
|
|
|
Lsr { dst: Wr, a: Rd, n: Rd },
|
|
|
|
Asr { dst: Wr, a: Rd, n: Rd },
|
|
|
|
}
|