This document describes the simulator for the IAS computer.
The simulator may be run on any CIS Linux machine via:
~cs611/bin/iasim
The simulator will print a console prompt to stdout and will accept console commands from stdin.
The following commands may be used at the console:
For example, to run the factorial program (~cs611/public/IAS/fact.asm) you would first run the assembler and then use the following sequence of console commands:
set mem 0 0x78000 set mq 7 set pc 0 in fact.obj run set pc 2 in in.ias out out.ias run off
The first command sets memory word 0 to hold an INCARD instruction in bits 0-19 and all zeroes in bits 20-39. This INCARD instruction has an address field of 0 and it will be used to read the object file for the factorial program into memory starting at location 0.
The INCARD instruction uses the contents of MQ to indicate how many cards to read. The assembler prints how many cards it produces when it translates an assembly language file into an object file. For the factorial program, seven cards are produced so we must set MQ to hold seven.
Next the PC is set to zero. This will cause the INCARD instruction to execute when the run command is subsequently used.
Then the in command is used to connect the object file for the factorial program to the simulator's card reader. The INCARD instruction will therefore read the object file for the factorial program.
Now, the run command is used. This causes the INCARD instruction to execute, which loads the factorial program's object file into memory. This will overwrite memory word 0 with the first word from the object file. This first word contains 0x0000000054 (84), which is the length of the object file. The machine will next try to execute bits 20-39 of the zero word, but these bits are all zero, so the machine will halt with an "illegal instruction" error.
At this point the factorial program is loaded into memory. Now the PC is set to 2, to skip over the object files two header words. Then the factorial input file and output file are connected to the card reader and the card punch. Then the factorial program can be run.
When the factorial program halts, then the off command is used to terminate the simulator.
With complicated load and execute sequences like this, of course,
the easiest thing to do is to enter the console commands into
a file (say, fact.run) and then run the simulator by
redirecting the console commands from the file:
~cs611/bin/iasim <fact.run
The following list of console commands (due to Justin Stern, CS611 Fall 2002) automatically determines the length of the object file:
echo set mq 1 set mem 0 0x78000 in file.obj run set pc 2 set mem 1 0x0000c set mem 2 0x180010a000 set mem 3 0xfffff30028 run show mq set mem 0 0x78000 in file.obj set pc 0 run set pc 2 set mq 0 run
You can use this sequence with different programs by simply editing the two occurences of the object file name. (See if you can figure out how this works!)
Data files can be created for connecting to the IAS card reader
by using the following program:
~cs611/bin/punchcards
The punchcards program reads ASCII decimal or hex values from stdin and writes the corresponding IAS 40-bit words to stdout to represent IAS cards. An IAS card contains 12 words, so this program will pad the last card out with zeros. The 40-bit values are written in Little Endian order to stdout.
IAS card files can be displayed in human-readable form by using the
following program:
~cs611/bin/cardimage
The cardimage program reads a file containing IAS cards and displays each card on a line using hex to represent the 4-bit "characters" punched on the card. The first word on the card is printed leftmost on the line printed for the card. Within a word the high order bits are printed first (leftmost).
Comments and questions should be directed to hatcher@unh.edu