instruction<7..4>)
are the op code. The bottom four bits (instruction<3..0>
) are the operand.
All values are padded with zero. So the address would be 00000000+instruction<3..0>
Opcode | Ben Nmeonic | Dan Nmeonic | Operand | Description |
---|---|---|---|---|
0000 | NOP | NOP | Do Nothing | |
0001 | LDA | Load | Source Memory Address | Load the data from memory into the A register |
0010 | ADD | Add | Memory Address | Add the contents of memory to the contents of the A register and store it into the A register. |
0011 | SUB | Subtract | Memory Address | Subtract the contents of membory from the contents of the A register and store it into the A register. |
0100 | STA | Store | Destination Memory Address | Store the contents of the A register at the destination address in memory |
0101 | LDI | LoadI | a 4 bit number | Load the A reister with the 4 bit immediate. The top bits are 0 |
0110 | JMP | Jump | Instruction Addres | Jump to the specified address. |
0111 | JC | JumpC | Instruction Address | Jump if the carry bit is set |
1000 | JZ | JumpZ | Instruction Address | Jump if the value of the A register is zero. |
1001 | NOP | NOP | ||
1010 | NOP | NOP | ||
1011 | NOP | NOP | ||
1100 | NOP | NOP | ||
1101 | NOP | NOP | ||
1110 | OUT | Output | Display the value (as an integer) stored in the A register | |
1111 | HLT | Halt | Stop Operation |
IR ← MPC]PC ← PC + 1
- BUS ← PC
- MAR ← BUS
- enable memory load
- BUS ← MDR
- IR ← BUS
- Enable PC increment
Acc ← Acc + M[IR<3..0>]
- fetch
- BUS ← IR<3..0>
- MAR ← BUS
- enable memory load
- BUS ← MDR
- B ← BUS
- ALU OP ADD
- BUS ← ALU
- Acc ← BUS
Acc ← Acc - M[IR<3..0>]
- fetch
- BUS ← IR<3..0>
- MAR ← BUS
- enable memory load
- BUS ← MDR
- B ← BUS
- ALU OP SUBTRACT
- BUS ← ALU
- Acc ← BUS
Acc ← M[IR<3..0>]
- BUS ← IR<3...0>
- MAR ← BUS
- enable memory load
- BUS ← MDR
- Acc ← BUS
M[IR<3..0>] ← Acc
- BUS ← IR<3..0>
- MAR ← BUS
- BUS ← Acc
- MDR ← BUS
- enable memory store
Acc ← IR<3..0>
- BUS ← IR<3..0>
- Acc ← bus
PC ← IR<3..0>
- BUS ← IR<3..0>
- PC ← BUS
if overflow PC ← IR<3..0>overflow : BUS ← IR<3..0> overflow : PC ← BUS
if Acc == 0 PC ← IR<3..0>ACC=0: BUS ← IR<3..0> ACC=0: PC ← BUS