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:
config.gcc dlx make cp dlxcc cc1 cpp ../binNote that the Makefile says you should not define CC as gcc, and that if your system lacks the alloca() system call, you should uncomment a line in the Makefile that compiles that function for you. Also, if your system lacks vfork(), put this near the top of the gcc.c file:
#define vfork fork
Then simply add the bin/ directory to your path.
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
In the Linux case, the following used to work (but now, in new Linux
versions, there seem to be additional problems): Add "#include
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
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:
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
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.
(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
(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").
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!