Lab A: Observing Data Flow within the Data Path Simulator (PathSim)

Goal:

With the completion of this lab you will understand the values placed on lines in the data path for the R-type instructions as discussed in sections 4.1 through 4.4

Steps

  1. Use your browser to open the data path simulator PathSim.html. The page is resident in the folder PathSim\DataPathSimulator along with other required html and jar files. Note: the simulator was verified with Firefox 3.0 and Internet Explorer 7.0 running on Windows XP. For Vista users, you may find that IE 7.0 has an issue with running a Java Applet. Although PathSim works properly with this environment, IE may produce the error message "java.lang.NullPointerException: null pData" when you close IE. Again, the problem is not with PathSim but with IE (others have reported the same error when running other applets).

2.      Select and copy the snippet of assembly code appearing in the box below and paste it into the Instruction Input box in PathSim. The Instruction Input box is a text box and, therefore, you can do some text-editing within the box. Next, assemble the set of instructions by pressing the Assemble button. The snippet of code is written intentionally with two syntax errors. Thus, when you assemble the code, an alert box will popup, showing a line containing an error. The PathSim assembler is a “first error and out” assembler and, therefore, you will only see one error at a time. Now, fix the first error and (re-)assemble the edited code. Since there is another error in the code, you will see another alert box showing the second error. Fix the second error, assemble the edited code and it should now assemble successfully. If another error should appear and on the last line, it is due to a missing end-of-line marker. PathSim expects that ALL lines are terminated with an end-of-line.

3.      Select and copy the three lines of words with addresses given after the comment #Data Memory and paste it into the Data Input box. Press the Load button within the Data Input box; the data should load successfully. If not, check to see that there are no empty lines nor spaces within the text. Also, make sure the third line is terminated with an end-of-line marker.

4.      Select and copy the one word with register number appearing after the comment #Register Values and paste it into the Register Input box. Press the Load button within the Register Input box; the word should load successfully into the specified register. If not, make sure that the line is terminated with an end-of-line marker and there are not empty lines nor spaces.

5.      Place the mouse over the rectangle marked PC shown in the data path diagram and left-click the mouse. Left-clicking on PC steps through the machine instructions that were assembled from the snippet of assembly code, one instruction per click. As you step through the code, place the mouse over data lines shown in the data path diagram and left-click the mouse. A popup box will appear showing the value which is on that line. Observe the values placed on data lines as you step through each instruction. Record only the values as indicated in the tables given at the end of this document. But make sure you also understand how the values are established for all instructions.

6.      Close the browser and PathSim after you have stepped through each of the machine instructions and recorded your observed values. You have completed this lab exercise.


 

#Assembly Code

 

  lw  $a0, 0($t1)

  lw  $a1, 4($t1)

  lw  $a2 8($t1)

  add $t2, $a0, $a1

  sub $t3, $a0, $a4

  and $t4, $a0, $a2

  or  $t5, $a1, $a2

  sw  $t5, 1c($t1)

 

 

#Data Memory

 

8:00000128

C:0000a35a

10:0000f696

 

 

#Register Values

9:00000008

 

 

 


Name_________________________________

 

 

lw $a2, 8($t1)

 

Mux

Registers

Sign Ext

Mux

Alu Cont

ALU

Input

I[20-16]

I{25-21]

I{15-0]

ReadData2

I[5-0]

ReadData1

 

 

 

 

 

 

Input

I[15-11]

I[20-16]

 

From SignExt

 

From Mux

 

 

 

 

Input

 

WriteReg

 

 

 

Input

WriteData

 

Control

RegDst

RegWrite

ALUSrc

ALUOp

ALUControl

 

 

 

 

 

Output

WriteReg

ReadData1

 (no label)

 (no label)

ALUControl

Zero

 

 

 

 

 

 

Output

 

ReadData2

 

 

 

ALUResult

 

 

 

 

 

add $t2, $a0, $a1

 

Mux

Registers

Sign Ext

Mux

Alu Cont

ALU

Input

I[20-16]

I{25-21]

I{15-0]

ReadData2

I[5-0]

ReadData1

 

 

 

 

 

 

Input

I[15-11]

I[20-16]

 

From SignExt

 

From Mux

 

 

 

 

Input

 

WriteReg

 

 

 

Input

WriteData

 

Control

RegDst

RegWrite

ALUSrc

ALUOp

ALUControl

 

 

 

 

 

Output

WriteReg

ReadData1

 (no label)

 (no label)

ALUControl

Zero

 

 

 

 

 

 

Output

 

ReadData2

 

 

 

ALUResult

 

 

 

 

sub $t3, $a0, $a1

 

Mux

Registers

Sign Ext

Mux

Alu Cont

ALU

Input

I[20-16]

I{25-21]

I{15-0]

ReadData2

I[5-0]

ReadData1

 

 

 

 

 

 

Input

I[15-11]

I[20-16]

 

From SignExt

 

From Mux

 

 

 

 

Input

 

WriteReg

 

 

 

Input

WriteData

 

Control

RegDst

RegWrite

ALUSrc

ALUOp

ALUControl

 

 

 

 

 

Output

WriteReg

ReadData1

 (no label)

 (no label)

ALUControl

Zero

 

 

 

 

 

 

Output

 

ReadData2

 

 

 

ALUResult

 

 

 


 

 

and $t4, $a0, $a2

 

Mux

Registers

Sign Ext

Mux

Alu Cont

ALU

Input

I[20-16]

I{25-21]

I{15-0]

ReadData2

I[5-0]

ReadData1

 

 

 

 

 

 

Input

I[15-11]

I[20-16]

 

From SignExt

 

From Mux

 

 

 

 

Input

 

WriteReg

 

 

 

Input

WriteData

 

Control

RegDst

RegWrite

ALUSrc

ALUOp

ALUControl

 

 

 

 

 

Output

WriteReg

ReadData1

 (no label)

 (no label)

ALUControl

Zero

 

 

 

 

 

 

Output

 

ReadData2

 

 

 

ALUResult

 

 

 

 

 

 

or  $t5, $a1, $a2

 

Mux

Registers

Sign Ext

Mux

Alu Cont

ALU

Input

I[20-16]

I{25-21]

I{15-0]

ReadData2

I[5-0]

ReadData1

 

 

 

 

 

 

Input

I[15-11]

I[20-16]

 

From SignExt

 

From Mux

 

 

 

 

Input

 

WriteReg

 

 

 

Input

WriteData

 

Control

RegDst

RegWrite

ALUSrc

ALUOp

ALUControl

 

 

 

 

 

Output

WriteReg

ReadData1

 (no label)

 (no label)

ALUControl

Zero

 

 

 

 

 

 

Output

 

ReadData2

 

 

 

ALUResult

 

 

 

 

 

sw $t5, 1c($t1)

 

Mux

Registers

Sign Ext

Mux

Alu Cont

ALU

Input

I[20-16]

I{25-21]

I{15-0]

ReadData2

I[5-0]

ReadData1

 

 

 

 

 

 

Input

I[15-11]

I[20-16]

 

From SignExt

 

From Mux

 

 

 

 

Input

 

WriteReg

 

 

 

Input

WriteData

 

Control

RegDst

RegWrite

ALUSrc

ALUOp

ALUControl

 

 

 

 

 

Output

WriteReg

ReadData1

 (no label)

  (no label)

ALUControl

Zero

 

 

 

 

 

 

Output

 

ReadData2

 

 

 

ALUResult