Skip to content

Commit c5e6fef

Browse files
committed
feat(li) Moved load immediate to register.rs.
1 parent 09e42b4 commit c5e6fef

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/instruction.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use proc_bitfield::{bitfield, ConvRaw};
22
use crate::num::MaskedU8;
33

4-
pub mod load_immediate;
54
pub mod memory;
65
pub mod mnemonic;
76
pub mod register;
@@ -21,7 +20,7 @@ pub enum Scale { X8, X16, X32, X64 }
2120
pub enum Instruction {
2221
Mnemonic(mnemonic::Operation),
2322

24-
LoadImmediate(load_immediate::Operation),
23+
LoadImmediate(register::LoadImmediateOperation),
2524
BuildVector(register::BuildVectorOperation),
2625
UnBuildVector(register::UnBuildVectorOperation),
2726

@@ -67,7 +66,7 @@ impl Instruction {
6766
let operation = Format::from(encoded).operation();
6867
match operation {
6968
Self::MNEMONIC_CODE => Self::Mnemonic(mnemonic::Format::from(encoded).operation()),
70-
Self::LOAD_IMMEDIATE_CODE => Self::LoadImmediate(load_immediate::Operation::from(encoded)),
69+
Self::LOAD_IMMEDIATE_CODE => Self::LoadImmediate(register::LoadImmediateOperation::from(encoded)),
7170
Self::BUILD_VECTOR_CODE => Self::BuildVector(register::BuildVectorOperation::from(encoded)),
7271
Self::UNBUILD_VECTOR_CODE => Self::UnBuildVector(register::UnBuildVectorOperation::from(encoded)),
7372
Self::READ_MEMORY_CODE => Self::ReadMemory(memory::ReadOperation::from(encoded)),

src/instruction/load_immediate.rs

-10
This file was deleted.

src/instruction/register.rs

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ pub enum File {
1010
Processor
1111
}
1212

13+
bitfield! {
14+
#[derive(Clone, Copy, PartialEq, Eq)]
15+
pub struct LoadImmediateOperation(pub u32): Debug, FromRaw, IntoRaw {
16+
pub segment: u8 @ 5..=6,
17+
pub value: u16 @ 11..=26,
18+
pub base: u8 @ 27..=31
19+
}
20+
}
21+
1322
bitfield! {
1423
#[derive(Clone, Copy, PartialEq, Eq)]
1524
pub struct BuildVectorOperation(pub u32): Debug, FromRaw, IntoRaw {

0 commit comments

Comments
 (0)