[][src]Module lc3_vm::hardware

Hardware - A module to simulate hardware of LC-3 (Little Computer - 3).

The hardware module is created to simulate hardware components of the LC-3 (Little Computer - 3) CPU. Main components of the hardware are Memory, Registers and OpCodes.

Modules

instructions

An instr is a command which tells the CPU to do some fundamental task, instrs 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.

memory

Memory : LC-3 has 65,536 memory locations (the maximum that is addressable by a 16-bit unsigned integer 2^16), each of which stores a 16-bit value. This means it can store a total of only 128kb.

register

A register is a slot for storing a single value on the CPU. Registers are like the "workbench" of the CPU. For the CPU to work with a piece of data, it has to be in one of the registers. However, since there are just a few registers, only a minimal amount of data can be loaded at any given time. Programs work around this by loading values from memory into registers, calculating values into other registers, and then storing the final results back in memory.

Functions

execute_program