Simple computer emulator with a limited instruction set. 16-bit address memory subsystem with 64-bit instruction format.
Computer Architecture:
- 16-bit memory subsystem with 16-bit (65535) address
- 64-bit instruction format
- 17 different instructions
- fetch/decode/execute cycle
Instruction set:
- Arithmetic
- ADD Add value from memory to AC
- ADI Add immediate value to AC
- SUB Subtract value from memory from AC
- SBI Subtract immediate value from AC
- MUL Multiply value from memory with AC
- DIV Divide AC by value from memory
- REM Remainder of division of AC by value from memory
- Data movement
- LDA Load accumulator from memory
- STA Store accumulator value to memory
- Program flow control
- JMP Jump to target address
- BNE Branch to target address if operand 1 != operand 2
- BEQ Branch to target address if operand 1 == operand 2
- Others
- SLT Set target address to 1 if operand 2 < operand 3
- SLI Set target address to 1 if operand 2 (immediate value) < operand 3 (immediate value)
- LET Set target address to 1 if operand 2 ≤ operand 3
- CLA Clear accumulator
- EOP End of program and stops the computer
- undefined When no instruction detected, move on to next instruction
Initial test programs:
- Data movement testing (✓)
- Arithmetic instruction testing (✓)
- Program flow control + miscellaneous testing (✓)
Showcase programs:
- calculates (and print out) the squares of all the integers between 0 and 99 (✓)
- calculates (and print out) all the prime numbers between 1 and 1000 (✓)