Lab: 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

2.      Open PathSim by running its jar file PathSim.jar. Select and copy the snippet of assembly code appearing in the box below and paste it into the Assembly Code textarea of PathSim. You can do some text-editing within this area. 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 textarea. Press the Load Memory button and 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 Register Input. Press the Load button appearing below the Register Input area; 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 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, 0x1c($t1)

 

 

#Data Memory

 

008:00000128

00C:0000a35a

010:0000f696

 

 

#Register Values

09: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