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/prog2/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
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 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. This program will only accept input values that will fit in 32 bits. The 40-bit values are written in Little Endian order to stdout.
Comments and questions should be directed to hatcher@unh.edu