Skip to content

Latest commit

 

History

History
25 lines (14 loc) · 1.67 KB

File metadata and controls

25 lines (14 loc) · 1.67 KB

A simple LC-3 virtual machine that simulates the hardware

A simple vm that can run assembly language program for the lc3 computer

memmory

it has 65536 memmory locations each of which stores a 16-bit value

Registers

The LC-3 has 10 total registers, each of which is 16 bits. Most of them are general purpose, but a few have designated roles. - 8 general purpose registers (R0-R7) - 1 program counter (PC) register - 1 condition flags (COND) register

The general purpose registers can be used to perform any program calculations. The program counter is an unsigned integer which is the address of the next instruction in memory to execute. The condition flags tell us information about the previous calculation.

Instruction set

An instruction is a command which tells the CPU to do some fundamental task, such as add two numbers. Instructions have both an opcode which indicates the kind of task to perform and a set of parameters which provide inputs to the task being performed.

Each opcode represents one task that the CPU “knows” how to do. There are just 16 opcodes in LC-3. Everything the computer can calculate is some sequence of these simple instructions. Each instruction is 16 bits long, with the left 4 bits storing the opcode. The rest of the bits are used to store the parameters.

click here to read more about LC-3 arc

click here to read more about LC-3 instruction set

click here for the lc-3 instructions manual

This project was built using the concepts from "Write your Own Virtual Machine By: Justin Meiners and Ryan Pendleton"