Skip to content

Commit b0af5e0

Browse files
committed
feat(vector) Implemented vector operation formats.
1 parent 526cf13 commit b0af5e0

File tree

5 files changed

+58
-5
lines changed

5 files changed

+58
-5
lines changed

examples/counter.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
extern crate arrseq_lightning;
2+
3+
use arrseq_lightning::instruction::{Instruction, memory};
4+
use arrseq_lightning::instruction::register::Register;
5+
use arrseq_lightning::num::Size;
6+
7+
fn main() {
8+
let program = [
9+
Instruction::Memory {
10+
operation: memory::Operation::AddressedCopy,
11+
size: Size::X8,
12+
register: Register::new(0),
13+
address: memory::Address::Immediate {
14+
mode: memory::Mode::Absolute,
15+
immediate: 0
16+
}
17+
}
18+
];
19+
}

src/instruction.rs

+35-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ pub enum DualSizedRegisterOperation {
2222

2323
}
2424

25+
#[derive(Debug, Clone, Copy, PartialEq)]
26+
pub enum DualArithmetic {}
27+
28+
#[derive(Debug, Clone, Copy, PartialEq)]
29+
pub enum TriArithmetic {}
30+
31+
#[derive(Debug, Clone, Copy, PartialEq)]
32+
pub enum QuadArithmetic {}
33+
2534
#[derive(Debug, Clone, Copy, PartialEq)]
2635
pub enum Instruction {
2736
Nothing,
@@ -33,12 +42,37 @@ pub enum Instruction {
3342
DualSizedRegister {
3443
operation: DualSizedRegisterOperation,
3544
size: num::Size, registers: [Register; 2] },
45+
DualArithmetic {
46+
operation: DualArithmetic,
47+
vector: bool, size: num::Size,
48+
registers: [Register; 2] },
49+
TriArithmetic {
50+
operation: TriArithmetic,
51+
vector: bool, size: num::Size,
52+
registers: [Register; 3] },
53+
QuadArithmetic {
54+
operation: QuadArithmetic,
55+
vector: bool, size: num::Size,
56+
registers: [Register; 4] },
57+
LoadImmediate {
58+
immediate: u16, segment: num::MaskedU8<0x03> },
3659
Branch {
3760
operation: branch::Operation,
3861
condition: Option<Flag>, hint: branch::Hint,
3962
address: branch::Address },
4063
Memory {
4164
operation: memory::Operation,
4265
size: num::Size, register: Register,
43-
address: memory::Address }
66+
address: memory::Address },
67+
LoadVector {
68+
vector: Register,
69+
components: [Option<Register>; 4],
70+
persist: bool },
71+
ReorderVector {
72+
vector: Register,
73+
components: [num::MaskedU8<0x03>; 4],
74+
persist: bool },
75+
SplitVector {
76+
vector: Register,
77+
components: [Option<Register>; 4] }
4478
}

src/instruction/memory.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use crate::num;
33

44
#[derive(Debug, Clone, Copy, PartialEq)]
55
pub enum Operation {
6-
6+
CopyRegister,
7+
CopyAddressed
78
}
89

910
#[derive(Debug, Clone, Copy, PartialEq)]

src/instruction/register.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
use crate::num;
22

3-
pub const REGISTER_MASK: u8 = 0x03;
3+
pub const REGISTER_MASK: u8 = 0x0F;
44
pub type Register = num::MaskedU8<REGISTER_MASK>;

src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616

1717
pub mod instruction;
1818
pub mod num;
19-
pub mod operation;
20-
pub mod state;
19+
pub mod operation;

0 commit comments

Comments
 (0)