Instructions for DLX Software on Glue

DLX is the name of a simple RISC ISA.   It is a simplified version of the MIPS architecture, and is quite similar to it.  While the architecture is simple, it accurately portrays many aspects of many modern RISC ISAs.   The DLX instruction set is summarized in a one-page pdf file also found on the course website.

You will need use a simulator for DLX called dlxsim.  dlxsim has been installed in a publicly-visible directory in glue, so all of you should be able to use it.

To have access to DLX software:

Make a link to DLX by typing the following in your home directory in glue:

    ln -s /afs/glue/class/old/enee/759c/dlx dlx

Subsequently you should be able to go to the above dlx directory by directly typing 'cd dlx' in your home directory.

To set your execution and man paths correctly, put in the following two lines at the end of the file called .cshrc.mine in your home directory.  If the file does not exist, create it.  Type or paste the text exactly as below.  Make sure there is an end-of-line character at the end of each line.
 

    setenv MANPATH /afs/glue/class/old/enee/759c/dlx/man:$MANPATH

    setenv PATH /afs/glue/class/old/enee/759c/dlx/bin:$PATH

Logout and then login again so that you see the paths.

 

To use dlxsim to simulate a DLX assembly program:

More Details about dlxsim is found in dlxsim manual on the class website.  Please view and print out that document using Adobe acrobat reader.  Read that document carefully to learn about DLXSIM.  In that document:

For homeworks or projects that involve writing or understanding DLX assembly programs, sections 1 and 2 will be useful.  For homeworks or projects that involve modifying the DLX simulator, you will have to read all three sections, but with an emphasis on section 3.

 

Example DLX Assembly Language programs:

There is an example program under the directory ~/dlx/test/dummy.s and many other examples in order to help you get acquainted with dlx assembly language. Each also has an associated C file from which the assembly file was produced using the DLX compiler, DLXCC.  For example, dummy.s was produced by compiling dummy.c in the same directory.

Dummy.s: This program calculates the average of two float numbers 3.5 and 5.0. It consists of a _main function that calls a function average.  Execution in dlxsim always starts at _main when invoked as 'go _main'. Look at the program to see how it works, first in its .c form, and then in its .s form.

Try simulating dummy.s in dlxsim using the directions above, and see the result.  Try setting some breakpoints using the instructions in the dlxsim manual.  This will help you get familiar with breakpoints.  View the values of some registers using the appropriate dlxsim commands. View some statistics as well.

 

To write a new DLX Assembly Language program:

To write a new DLX assembly program, first, look at an example DLX assembly program as described above.  Second, look at the DLX instruction set summary (1-page) described on the course's DLX webpage.  Third, to learn the format and semantics of the DLX instructions in detail, read the DLX instruction set description (7 pages).  Fourth, to learn about the assembler directives in DLX, read section 1 (pages 6-7) of the DLXSIM manual.  Knowing the instruction set and assembler directives, you should now be able to write new DLX programs.

You may notice that the .s files in ~/dlx/test/ (such has hello.s -- see hello.c to understand it) have a bunch of instructions at the beginning and end of each procedure that access the stack pointer, frame pointer and return address, and save and restore registers.  These are needed for procedures that are called from other procedures to create and use the stack properly.  For a program which has only _main, you can leave these instructions out since _main is never called from another procedure.  (Although for uniformity the compiler-produced examples in ~/dlx/test/  have the stack code for _main as well).

 

To modify the DLX simulator:

Copy the directory ~/dlx/dlxsim/ and all its contents into a separate folder under your home directory. Call it whatever you want like mydlxsim.

Before making any modification to DLXSIM: 

You are now ready to modify DLX.  Make the modifications required by your project and recompile using the last two bullets above.  To understand the internal structure of the DLXSIM software, you may find it helpful to read section 3 of the DLXSIM manual.