diff options
Diffstat (limited to 'src/isa')
-rw-r--r-- | src/isa/mod.rs | 32 | ||||
-rw-r--r-- | src/isa/opcodes.rs | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/isa/mod.rs b/src/isa/mod.rs new file mode 100644 index 0000000..5e9a7dc --- /dev/null +++ b/src/isa/mod.rs @@ -0,0 +1,32 @@ +pub mod opcodes; + +enum Register { + X0 = 0, + X1 = 1, + X2 = 2, + X3 = 3, + X4 = 4, + X5 = 5, + X6 = 6, + X7 = 7, + X8 = 8, + X9 = 9, + X10 = 10, + X11 = 11, +} + +pub struct Instruction { + word: u32, +} + +impl Instruction { + pub fn new(word: u32) -> Instruction { + Instruction { + word: word, + } + } + + pub fn opcode(&self) -> u32 { + self.word & 0x7F + } +} diff --git a/src/isa/opcodes.rs b/src/isa/opcodes.rs new file mode 100644 index 0000000..0ea7613 --- /dev/null +++ b/src/isa/opcodes.rs @@ -0,0 +1,2 @@ +pub const Branch: u32 = 0x12; +pub const IntegerImmediate: u32 = 0x13; |