Homework 5
A Simulator for the LC-1: an LC-3 Assembly Language Program

Due Tuesday, December 12, 2006 at 11:59 pm

Outcomes

After successfully completing this assignment, you will be able to...

Before Starting

Read Chapters 9 and 10.

Description of Problem

(This is adapted from a programming assignment written by Yale Patt, University of Texas at Austin.)

In this assignment, you will write a simulator for a new "machine", the LC-1, in LC-3 assembly language. You will use the simulator you write to simulate the execution of a program written in LC-1 machine language.

The LC-1 ISA

The LC-1 is an accumulator-based architecture. Since there is only one register, there is no need to explicitly specify the accumulator in an LC-1 instruction. The LC-1 ISA specifies eight instructions, described below. Three bits in the instruction, bits <15:13>, are used to represent the opcode. The remaining 13 bits, bits <12:0>, may be used to represent a 13-bit address. The addressing mode is direct. The memory space being simulated contains 2^^13 locations, and the addressibility is 16 bits. The LC-1 ISA has one condition register which is modified by two of the seven instructions: ADD and LOAD. The condition register is set when a negative value is stored in the accumulator, otherwise, it is cleared.

LC-1 Instruction Set

Design Considerations

Documentation Guidelines

Follow the same documentation guidelines as you did for HW4. In addition, subroutines should come with their own documentation including a list of inputs and outputs, and a brief description of the subroutine's purpose.

Each instruction in the LC-1 test program(s) should be commented.

Deliverables

You should turn in at least two files for this assignment. simulator.asm contains the assembly language code for your simulator. The remaining file(s) contain sample LC-1 machine code program(s) you used to test your simulator. You may choose the names for these files, but make sure they end in .asm. You must use web-based turnin to submit your source files.