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

Due on Thursday, October 7, 2004 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 the LC-1 ISA in LC-3 assembly language. You will use the simulator you write to simulate 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 seven 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 should be commented.

Deliverables

You should turn in two files for this assignment. simulator.asm contains the assembly language code for your simulator. machinecode.asm contains a sample LC-1 machine code program you used to test your simulator. You must use turnin to submit your source files. Here is the Unix command you should use to submit your files:
/cs/bin/turnin submit cs2011 hw5 simulator.asm machinecode.asm