MIME-Version: 1.0
Server: CERN/3.0
Date: Monday, 16-Dec-96 23:18:18 GMT
Content-Type: text/html
Content-Length: 5480
Last-Modified: Monday, 13-Mar-95 14:33:35 GMT
PS314 Instruction Set Simulator
[Back to CS314 Home Page]
Project 2: PS314 Instruction Set Simulator
Date Assigned: March 2, 1995
Date Due: March 16, 1995
Before a new processor is built, the architects usually implement an
instruction-set simulator. This simulator runs programs written for
the new architecture so that the instruction set can be fine-tuned for
usability and work on software can be started before the hardware is
available.
This assignment involves the implementation of a PS314 instruction-set
simulator in M68K assembly language.
We will give you an M68K assembly language program
which accomplishes
part of this task, and you will add whatever assembly language code is necessary
to make the simulator fully functional.
This project is due Thursday, March 16 at the start of class.
You are encouraged to work in groups of at most two in building this
program.
The completed program should simulate PS314 machine language
instructions stored in a simulated PS314 memory. The simulator
should:
-
Actually only implement PS314 physical memory address 0 through
2^8 - 1. An attempt by a (simulated) PS314 instruction to fetch or store
a memory address in the range 2^8 through 2^15 - 1 should cause an
exception.
-
Memory fetches and stores to addresses in the range 2^15 through
2^16 - 1 should cause input or output to occur. A memory fetch to
an address A in this range should cause A to be printed out in
hexadecimal, followed by a question mark, "?". The simulator should
then accept a 16-bit hexadecimal constant to be input from the
keyboard and should return that input as the fetched word. A memory
store to an address A in this range should cause A to be printed
out in hexadecimal, followed by a colon, ":", and the value to be
stored, also printed in hexadecimal.
-
When started, your PS314 simulator should enter an input loop
which allows values to be entered into the simulated PS314 memory.
The input loop should behave as follows:
Read 2 16-bit hexadecimal constants, one per line. The first will be
a count L (in words), the second will be a legal PS314 memory
address A. Your simulator should then read L hexadecimal 16-bit
constants---one per line---storing the first at memory location A,
the second at A + 1, ... and the last at A + ( L - 1 ).
This should be repeated until a count (L) of 0 is input.
-
The simulator should then start executing instructions from location 0.
-
Once the simulated PS314 processor has executed a HALT instruction,
the simulator should print, in hexadecimal, the contents of registers
D0, ..., D15, PC, status register bits N, Z, V, C, and the
contents of its memory addresses 0 through 2^8 - 1.
-
Since there is no mechanism for creating a reset or I/O device
interrupt in the software simulator, these interrupts need not be
addressed.
What to Modify
Make the following modifications to the PS314 instruction set simulator.
- Remove any bugs which might be lurking in the top-level fetch/execute loop.
- Complete the implementation of any PS314 opcodes which are missing
or not fully implemented.
- Complete the implementation of any Bcc cases which are missing
or not fully implemented.
- Implement the I/O cases in LOAD and STORE.
- Make HALT compliant with the PS314 specification.
- Make sure that the simulator reads from/writes to valid M68k memory locations
in all cases. In particular, look at the implementation of RTI and at the
interruption handler. When could these routines make invalid memory accesses?
Fix any problems that you find. If a bad memory access of this sort
occurs in the interruption handler or in the RTI implementation, print an error message and
halt the simulator.
- Make any other modifications necessary to bring the simulator into compliance
with the PS314 specification.
Mark your modifications in the simulator source code with highly visible
comments. Rows of asterisks accompanied by a word or two explanation of the
type of modification are recommended. A reader should be able to easily distinguish
your modifications from the original source code. Examples:
move.l a4,d4
;***begin: insertion*************************************
move.l d4,d5
;***end: insertion***************************************
rts
and
move.l a4,d4
;***deletion*********************************************
What to Hand In
Please hand in the following in a single envelope marked clearly with your
name(s):
- a hardcopy of the full source of the completed simulator program.
-
a hardcopy of the ouput produced by the Listing/Run option for the
simulator run on the example given in the PS314 Specification.
-
a hardcopy of the output produced by the Run option for the simulator
run on your own additional test cases.
-
a disk containing the assembly language for your PS314 instruction-set
simulator (clearly named).
[Back to CS314 Home Page]