Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
428f6716
Commit
428f6716
authored
Sep 30, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
movz movn
parent
bf45a2ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
MIPS.sol
contracts/MIPS.sol
+9
-2
No files found.
contracts/MIPS.sol
View file @
428f6716
...
...
@@ -24,6 +24,7 @@ contract MIPS {
IMIPSMemory public immutable m;
uint32 constant public REG_OFFSET = 0xc0000000;
uint32 constant public REG_ZERO = REG_OFFSET;
uint32 constant public REG_PC = REG_OFFSET + 0x20*4;
uint32 constant public REG_HI = REG_OFFSET + 0x21*4;
uint32 constant public REG_LO = REG_OFFSET + 0x22*4;
...
...
@@ -67,7 +68,7 @@ contract MIPS {
// decode
// register fetch
uint32 storeAddr =
0xFFFFFFFF
;
uint32 storeAddr =
REG_ZERO
;
uint32 rs;
uint32 rt;
if (opcode != 2 && opcode != 3) { // J-type: j and jal have no register fetch
...
...
@@ -169,8 +170,14 @@ contract MIPS {
storeAddr = REG_PC;
}
if (opcode == 0 && func == 0xa) { // movz
if (rt != 0) storeAddr = REG_ZERO;
} else if (opcode == 0 && func == 0xb) { // movn
if (rt == 0) storeAddr = REG_ZERO;
}
// write back
if (storeAddr !=
0xFFFFFFFF
) {
if (storeAddr !=
REG_ZERO
) {
// does this ever not happen? yes, on untaken beq/bne
stateHash = m.WriteMemory(stateHash, storeAddr, val);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment