WDLXTUT.DOC

(333 KB) Pobierz
Û¥-@-€*I*7™G2Â2ÂÂ4Â4Â4Â4Â4Ð4‚R5R5R5R5^5z5R5–5Sé5dM6c6c6c6c6c6c6c6e6e6e6e6e6e6ƒ64·6sƒ6Â4ƒ6ƒ6‘•WinDLX Tutorial
A first example


Contents

VERZEICHNIS \oWinDLX Tutorial	1
Contents	2
Introduction	3
Installation	3
A complete example	4
Starting and configuring WinDLX	4
Loading testprograms	5
Simulating	5
Pipeline window	5
Code window	6
Clock Cycle Diagram window	6
Breakpoint window	7
Register window	8
Statistics window	8
Further experiments	9


Introduction

The DLX processor (pronounced "DeLuXe") is a pipelined processor used as an example in J. Hennessy's and D. Patterson's Computer Architecture - A quantitative approach. This tutorial describes a session using WinDLX, a Windows-based simulator, that shows how DLX's pipeline works. 

The example used in this tutorial is very simple and is not meant to show all aspects of WinDLX. It should act only as a first introduction to the use of the application. When you have completed it, please refer to the help files; you can at every stage of a session get context-sensitive help by pressing F1. During this example, though, this will probably not be necessary.

Though every step of the example will be discussed in detail, basic knowledge in the use of Windows must be required. It must be assumed that you know how to start Windows, scroll using scrollbars, execute a double click or bring a window uppermost on the screen. The exact appearance of your screen cannot be foretold (e. g. Is a special icon covered by a window or not?), so you must be able to "tidy up" your screen without help.

You will need Windows 3.0 or higher for this simulation.
Installation

WinDLX consists of the files windlx.exe and windlx.hlp. Together with these you should have got some assembler code files with the extension .s. In this manual fact.s and input.s will be needed.

If you are familiar with the installation of Windows applications, you might as well skip now to the next chapter, A complete example, after making sure that fact.s and input.s are copied into the WinDLX directory.

To install WinDLX to Windows 3.1, please execute the following steps:
1.	Create a directory for WinDLX, e. g. C:\WINDLX.
2.	Copy all the WinDLX files you have got, at least windlx.exe, windlx.hlp, fact.s and input.s to the WinDLX directory.
3.	If you have not already done this, enter Windows now.
4.	Assuming that you use the German version of Windows, double click on Windows Setup in "Hauptgruppe".
5.	Select Optionen and Anwendungsprogramme einrichten.
6.	Select Sie ein Anwendungsprogramm angeben lassen, click OK and enter the WinDLX directory and the filename, e. g. C:\WINDLX\WINDLX.EXE.

Windows will then automatically install WinDLX to the group "Anwendungen"; the icon looks like this:

EINBETTEN MSDraw   \* FormatVerbinden


A complete example

This chapter uses the assembler file fact.s in WinDLX assembler. The program calculates the factorial of a number you can enter on the keyboard. The file input.s will be required for this, too.

Starting and configuring WinDLX

WinDLX is started - like every Windows application - by double clicking on the WinDLX icon. A window (denoted main window in the future) with six icons appears. Double clicking on these icons will pop up child windows. Each of these windows will be explained and used later.




















To make sure the simulation is reset, click on the File menu and click Reset all. A window pops up and you will have to confirm your intention by clicking the OK button in the "Reset DLX" window.OKOK

WinDLX is capable of working with several configurations. You can change the structure and time requirements of the pipeline, the memory size and several parameters that control the simulation. Let us choose the standard settings; click Configuration / Floating Point Stages (read that as: click Configuration to open the menu, then click on Floating Point Stages) and make sure that the following settings are given:


Count

Delay

Addition Units:
1

2






Multiplication Units:
1

5






Division Units:
1

19


If necessary, change the settings by clicking in the appropriate field and editing the given numbers. When you are finished, click OK to return to the main window.

By clicking Configuration / Memory Size the size of the simulated processor's memory can be set. This should be 0x8000. Again, OK goes back to the main window.

Three more options in the Configuration menu can be chosen: Symbolic addresses, Absolute Cycle Count and Enable Forwarding should all be set, that is, a small hook should be shown beside it. If this is not the case, click on the option. 

Loading testprograms

In order to be able to start the simulation, at least one program must be loaded into the main memory. To accomplish this, select File / Load Code or Data. A list of assembler programs in the directory appears in a window. 

As mentioned earlier, fact.s calculates the factorial of an integer number. input.s contains a subprogram which reads the standard input (the keyboard) and stores the integer in the general purpose register 1 of the DLX processor. To load these two files into the memory, do the following:

SONDZEICHEN 183 \f "Symbol" \s 10 \h	click on fact.s
SONDZEICHEN 183 \f "Symbol" \s 10 \h	click the select button
SONDZEICHEN 183 \f "Symbol" \s 10 \h	click on input.s
SONDZEICHEN 183 \f "Symbol" \s 10 \h	click the select button
SONDZEICHEN 183 \f "Symbol" \s 10 \h	click the load button

The sequence of selection of the files is essential as it defines the order of appearance in the memory. Confirm the message File(s) loaded successfully. Reset DLX? by clicking OK. The files are now loaded into the memory. 

After these preparations the simulation is ready to begin.

Simulating

When looking now at the main window, you should see six icons, named (not necessarily in that order)  "Register", "Code", "Pipeline", "Clock Cycle Diagram", "Statistics" and "Breakpoints". Clicking any of these icons will pop up a new window (a "child" window). The characteristics and the use of each of these windows will be introduced during the simulation.

Pipeline window
Let us first take a look at the inner structure of the DLX processor. To do this, double click on the icon Pipeline. The appearing child window shows a schematic representation of DLX' five-stage pipeline. You should enlarge this window as much as possible, so that instructions held in the various pipe stages can be shown in the schematic. 







The picture shows the five pipeline stages of the DLX processor and the units for floating point operations (addition / subtraction, multiplication and division). 

Code window
The next window we will look at is the Code window. When double clicking the icon, you will see a three column representation of the memory, showing from the left to the right an address (symbolic or in numbers), a hex number giving the machine code representation of the command and the assembler command. 

$TEXT		0x20011000		addi r1,r0,0x1000
main+0x4		0x0c00003c		jal InputUnsigned

It is time to start the simulation now, so click Execution in the main window. In the appearing pull down menu, click Single Cycle. Pressing F7 has the same effect.

You will note that the first line in the window with the address $TEXT is now coloured yellow. Pressing F7 advances the simulation for one time step; this changes the first line's colour to orange and the next line is coloured yellow. These colours show the pipeline stage the command is in. If you have closed the pipeline window, please re-open Pipeline again (double click on the icon). If the window is large enough, you can see that the command jal InputUnsigned is in the IF stage and the preceding command addi r1, r0, 0x1000 is in the second stage, ID. The other blocks are marked with a cross, showing that no sensible information is processed in them.

Pressing F7 again will re-arrange the colours in the code window, introducing red for the third pipeline stage intEX. The next F7, however, will change the picture: the yellow line appears farther down and is probably now the only coloured line in the code window. Examining the pipeline window will show that IF, intEX and MEM are used but ID is not. Why?

Clock Cycle Diagram window
Another window will show further information. Iconize all child windows and open the Clock Cycle Diagram window. It contains a representation of the timing behaviour of the pipeline. 



You can see that the simulation is now in the 4th cycle, the first command is in the MEM stage, the second in intEX and the fourth in IF. The third command, however, is denoted as "aborted". The reason for this: The second command, jal, is an unconditional branch. This fact is known only after the 3rd cycle, when jal has been decoded. During this cycle the command movi2fp (following after jal) has already been fetched, but the next executed command will be at another address. Therefore the execution of movi2fp must be aborted, leaving a "bubble" in the pipeline.

The branch address of jal is named "InputUnsigned". To find out the actual value of this symbolic address, click Memory in the main window and Symbols. The appearing window shows the correspondence between the used symbols and the actual numbers. Select "name" in the "Sort:" area to have them sorted by name rather than by value.  "G" after the value denotes a global, "L" ...
Zgłoś jeśli naruszono regulamin