-
Notifications
You must be signed in to change notification settings - Fork 45
MARIE Instruction Set (with Opcodes)
Jason N edited this page Feb 11, 2025
·
9 revisions
In MARIE, each instruction is 16 bits long with the first 4 bits representing the opcode and the remaining 12 bits are being used to represent the address.
For example the instruction CLEAR
, the Opcode is A in HEX and 1010 in binary so the instruction will look something like `1010............`
Type | Instruction | Hex Opcode | Summary |
---|---|---|---|
Arithmetic | Add X | 3 | Adds value in AC at address X into AC, AC ← AC + M[X] |
Subt X | 4 | Subtracts value in AC at address X into AC, AC ← AC - M[X] | |
AddI X | B | Add Indirect: Use the value at X as the actual address of the data operand to add to AC |
|
Data Transfer | Load X | 1 | Loads Contents of Address X into AC |
LoadImmi X | A | Load Immediate: Load the 12-bit unsigned value X into the AC, AC ← X | |
Clear | Alias for LoadImmi 0, AC ← 0 | ||
Store X | 2 | Stores Contents of AC into Address X | |
I/O | Input | 5 | Request user to input a value |
Output | 6 | Prints value from AC | |
Branch | Jump X | 9 | Jumps to Address X |
Skipcond (C) | 8 | Skips the next instruction based on C: if (C) = - 000: Skips if AC < 0 - 400: Skips if AC = 0 - 800: Skips if AC > 0 - 0C00: Skips if AC ≠ 0 |
|
Subroutine | JnS X | 0 | Jumps and Store: Stores value of PC at address X then jumps to X+1 |
JumpI X | C | Uses the value at X as the address to jump to | |
Indirect Addressing | LoadI | D | Loads value from indirect address into AC e.g. LoadI addresspointer Gets address value from addresspointer, loads value at the address into AC |
StoreI | E | Stores value in AC at the indirect address. e.g. StoreI addresspointer Gets value from addresspointer, stores the AC value into the address |
|
Halt | 7 | End the program |
MARIE.js Wiki | License
Copyright © 2018 Jason Nguyen, Saurabh Joshi, Eric Jiang, Felix Salim, Guido Tack, Monash University
Copyright © 2018 Jason Nguyen, Saurabh Joshi, Eric Jiang, Felix Salim, Guido Tack, Monash University
Documentation
MARIE Instructions Set with Opcode
Register Transfer Language (RTL)
More Reading
The Essentials of Computer Organization and Architecture-Chapter 4.2
Tutorials
MARIE.js Documentation