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
9ecfbb6d
Commit
9ecfbb6d
authored
Sep 30, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
broken lwl and lwr support
parent
5c37ca06
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
MIPS.sol
contracts/MIPS.sol
+9
-3
No files found.
contracts/MIPS.sol
View file @
9ecfbb6d
...
...
@@ -73,7 +73,6 @@ contract MIPS {
storeAddr = REG_OFFSET + ((insn >> 9) & 0x7C);
} else if (opcode < 0x20) {
// rt is SignExtImm
uint32 SignExtImm = insn&0xFFFF | (insn&0x8000 != 0 ? 0xFFFF0000 : 0);
if (opcode == 0xC || opcode == 0xD) {
// ZeroExtImm
rt = insn&0xFFFF;
...
...
@@ -81,9 +80,12 @@ contract MIPS {
// SignExtImm
rt = SE(insn&0xFFFF, 16);
}
} else if (opcode >= 0x28) {
// store rt
} else if (opcode >= 0x28
|| opcode == 0x22 || opcode == 0x26
) {
// store rt
value with store
rt = m.ReadMemory(stateHash, REG_OFFSET + ((insn >> 14) & 0x7C));
// store actual rt with lwl and lwr
storeAddr = REG_OFFSET + ((insn >> 14) & 0x7C);
}
}
...
...
@@ -167,11 +169,15 @@ contract MIPS {
return SE((mem >> (24-(rs&3)*8)) & 0xFF, 8);
} else if (opcode == 0x21) { // lh
return SE((mem >> (16-(rs&2)*8)) & 0xFFFF, 16);
} else if (opcode == 0x22) { // lwl
return mem&0xFFFF0000 | rt&0xFFFF;
} else if (opcode == 0x23) { return mem; // lw
} else if (opcode == 0x24) { // lbu
return (mem >> (24-(rs&3)*8)) & 0xFF;
} else if (opcode == 0x25) { // lhu
return (mem >> (16-(rs&2)*8)) & 0xFFFF;
} else if (opcode == 0x26) { // lwr
return rt&0xFFFF0000 | mem&0xFFFF;
} else if (opcode&0x3c == 0x28) { return rt; // sb, sh, sw
} else if (opcode == 0xf) { return rt<<16; // lui
}
...
...
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