Where you can run it:

The DLX simulator dlxsim and compiler dlxcc are on the CSIF DECs, at

~matloff/Pub/DLX/bin

If you want to compile it somewhere else:

If you wish to run DLX on some other machine, say your Linux box, here is how to compile it. You "should" be able to simply do the following:

On the CSIF DECs and the ACS SUNs, this actually works! However, on Linux and other SUNs, for instance, there is quite a bit of trouble, especially in the tcl/ directory. This can be fixed by doing an include of and in main.c and in some modules in tcl/. If you don't want graceful termination of the program in the event of an exception or whatever, you can try zeroing out some of the missing constants the compiler complains about.

In the Linux case, the following used to work (but now, in new Linux versions, there seem to be additional problems): Add "#include " to main.c; copy /usr/include/bsd/sgtty.h to sgtty, and in io.h comment out the two lines which undefine ioctl, replace by bsd_ioctl, and change the include to '#include "sgtty.h"'; add to tcl/tclCmdAH.c "#include ", comment out from tcl/tclCmdAH.c lines 564-566, i.e. "if (deadPid == pid)..."; tcl/tclGlob.c in line 23, where sprintf() should have type int; and in gcc.c add "#define USG" right before "#ifdef USG".

Producing a C source for DLX:

Write your code as usual, but keep in mind that most C library functions and OS system calls are not available. For example, printf() IS available but scanf() is not.

Compiling a C source for DLX:

Just invoke dlxcc on your .c file, which will produce a .s assembly language file which will be input to the simulator.

To run the simulator:

Type "dlxsim" and then at the "(dlxsim)" prompt, type "load" followed by the name of the .s file. (It does not seem to work to put the .s file on the command line.)

If you are just interested in executing the program, type

(dlxsim) load .s_file_name
(dlxsim) step _main
(dlxsim) go
(If you did not generate the .s file from a .c source, omit the "step _main"). A message will appear,

TRAP #0 received

It does appear that large programs do not run on DLX. This includes large-sized global arrays, say of 100,000, and moderate-sized local arrays, say 10,000.

If you are just interested in getting a cycle count and memory address trace, you can do that as follows:

(dlxsim) load .s_file_name
(dlxsim) step _main
(dlxsim} trace on outfile_name
(dlxsim) go
(dlxsim) stats all
(dlxsim) q
(Again, if you did not generate the .s file from a .c source, omit the "step _main").

The cycle count will print out, and the address trace will be in outfile_name, in din format, say for use in dinero.

Note that programs compiled from C will not begin at their first memory location. If, say, the code begins at 0x120, do

step 0x120
to get started. Or, if the .s was compiled from .c rather than written directly, type
stop at _main
go
The functions _printf, etc. get called as native routines. (Remember, there is no OS!) Make sure gcc-gnulib is in the bin directory, together with dlxcc!

To "link" two or more .s files, compiled separately, simply put them on the same line in a `load' command in dlxsim. Be sure to note the role of the .global directive.

When using the asm command in dlxsim, you must enclose the instruction in quote marks.

I have written up a brief introduction to the DLX architecture.

Op codes are listed in the asm.c source file (search on "opcodes"). One still must do a bit of detective work, though, since the organization of that array is not so clear.