aboutsummaryrefslogtreecommitdiff
path: root/src/isa/mod.rs
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2015-12-19 09:27:18 -0500
committerDavid Li <li.davidm96@gmail.com>2015-12-19 09:27:18 -0500
commit8ca42acf1a92ac0d811bbeecf8aed25a8c2d5a30 (patch)
treef824224b73329438bbdd46757294d5991ef2f410 /src/isa/mod.rs
parentfd582a1cbd091576701d12e886d9ad91527320f9 (diff)
Implement RV32I integer-immediate instructions
Diffstat (limited to 'src/isa/mod.rs')
-rw-r--r--src/isa/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/isa/mod.rs b/src/isa/mod.rs
index ebfd4e8..0e3261b 100644
--- a/src/isa/mod.rs
+++ b/src/isa/mod.rs
@@ -110,6 +110,10 @@ impl Instruction {
(self.word >> 25) & 0x7F
}
+ pub fn shamt(&self) -> u32 {
+ (self.word >> 20) & 0x1F
+ }
+
pub fn rs1(&self) -> Register {
Register::from_num((self.word >> 15) & 0x1F)
}