Docsity

Georgia Tech ECE3055: Pipelining Assignment 2, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE3055 Prof. H.-H. S. Lee
Georgia Tech Page 1 of 8
ECE3055 Fall 2006
Programming Assignment 2
Pipelining
Assigned: Oct 18, 2006 Signoff Nov 8, 2006 prior to class
Score: ____________ Date:___________ Name:__________________________________
TA Signoff: ________________________________________________________________
This assignment has two parts, the first part is simple, you just have to run an existing VHDL-
based MIPS hardware simulation using a HDL simulation tool โˆ’ ModelSim and understand the
results. The second part, adding Pipelining to the model may take a significant effort for some of
you. Note that the grading (TA check-off) of this assignment is completely based on your
implementation of the Pipelining part. ModelSim is available in the ECE PC labs, Sun Solaris
labs. You can also download a Starter version from the web. Please go to our course web and
follow the instructions to acquire the software and installation guide.
Before you start working on this project, you need to download the provided MIPS VHDL source
files from our class web page at the following and click Assignments on the left panel.
http://www.ece.gatech.edu/~leehs/ECE3055/
1. Create a Project file in ModelSim and compile the MIPS single cycle datapath design.
Information on this model was covered in our class lecture and also described in the
textbook. After compilation, please perform the following steps:
Display the waveform (timing diagram) from the simulation. Prior to advance your
simulation by Run command, you need to set the master clock and assert the reset signal
to clear the PC to the default starting PC (0x00000000). Then you need to de-assert the
reset signal to start the normal operation of the machine. Verify that the information on
the timing diagram shows that the hardware is functioning correctly. The instructions
and data memory have been programmed with default values in IFETCH.VHD and
DMEMORY.VHD. Look at the program counter, instruction, register file, ALU outputs,
and control signals on the waveform and carefully follow the execution of each
instruction in the default program. During this exercise, you need to learn how to read
values of waveform for signals from different VHDL files, how to debug the VHDL code
via breakpoint, how to use commands such as โ€œstepโ€ or โ€œexamineโ€. (These commands
can be entered using the Transcript sub-window at the bottom.)
pf3
pf4
pf5
pf8

Partial preview of the text

Download Georgia Tech ECE3055: Pipelining Assignment 2 and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

Georgia Tech Page 1 of 8

ECE3055 Fall 2006

Programming Assignment 2

Pipelining

Assigned: Oct 18, 2006 Signoff Nov 8, 2006 prior to class

Score: ____________ Date:___________ Name:__________________________________

TA Signoff : ________________________________________________________________

This assignment has two parts, the first part is simple, you just have to run an existing VHDL-

based MIPS hardware simulation using a HDL simulation tool โˆ’ ModelSim and understand the

results. The second part, adding Pipelining to the model may take a significant effort for some of

you. Note that the grading (TA check-off) of this assignment is completely based on your

implementation of the Pipelining part. ModelSim is available in the ECE PC labs, Sun Solaris

labs. You can also download a Starter version from the web. Please go to our course web and

follow the instructions to acquire the software and installation guide.

Before you start working on this project, you need to download the provided MIPS VHDL source

files from our class web page at the following and click Assignments on the left panel.

http://www.ece.gatech.edu/~leehs/ECE3055/

1. Create a Project file in ModelSim and compile the MIPS single cycle datapath design.

Information on this model was covered in our class lecture and also described in the

textbook. After compilation, please perform the following steps:

Display the waveform (timing diagram) from the simulation. Prior to advance your

simulation by Run command, you need to set the master clock and assert the reset signal

to clear the PC to the default starting PC (0x00000000). Then you need to de-assert the

reset signal to start the normal operation of the machine. Verify that the information on

the timing diagram shows that the hardware is functioning correctly. The instructions

and data memory have been programmed with default values in IFETCH.VHD and

DMEMORY.VHD. Look at the program counter, instruction, register file, ALU outputs,

and control signals on the waveform and carefully follow the execution of each

instruction in the default program. During this exercise, you need to learn how to read

values of waveform for signals from different VHDL files, how to debug the VHDL code

via breakpoint, how to use commands such as โ€œstepโ€ or โ€œexamineโ€. (These commands

can be entered using the Transcript sub-window at the bottom.)

Georgia Tech Page 2 of 8

2. Pipeline the MIPS VHDL simulation. Test your VHDL model by running a simulation of

the example program on page 396 using the hardware shown in Figure 6.27 in Computer

Organization and Design The Hardware/Software Interface. To minimize changes,

pipeline registers must be placed in the VHDL module that generates the input to the

pipeline. As an example, all of the pipeline registers that store control signals must be

placed in the control module. Compile and check the control module first, since it is

simple to see if it works correctly when you add the pipeline flip-flops. Use the following

notation to add new latched signals, add a "D_" in front of the signal name to indicate it

is the input to a D flip-flop used in a pipeline register. Signals that go through two D flip-

flops would be "DD_" and three would be "DDD_". As an example, instruction would be

the registered version of the signal, D_ instruction. This will minimize the changes needed

in the top level module since the global signal names used to connect modules will not

change.

Add pipeline registers to the existing modules that generate the inputs to the pipeline

registers shown in the text. Add signal and process statements to model the pipeline

modules โ€“ see the PC in the IFETCH.VHD module for an example of how this can work

(the PC is already pipelined). A few muxes may have to be moved to different modules.

In DMEMORY.VHD, the data memory address and data inputs are already pipelined

inside the altsyncram function used for data memory (this is why it has a clock input).

You will need to take this into account when you pipeline your design. High speed

memory writes almost always require a clock and the design in the book skips over this

point โ€“ since they do not have their design running on real hardware.

The control module should contain all of the control pipeline registers โ€“ 1, 2, or 3 stages

of pipeline registers for control signals. Some control signals must be reset to zero, so use

a D flip-flop with a synchronous reset for these pipeline registers. This generates a flip-

flop with a Clear input that will be tied to Reset. Critical pipeline registers with control

signals such as regwrite or memwrite should be cleared at reset so that the pipeline starts

up correctly. The MIPS instruction sll $0, $0, 0 is all zeros in machine code and does not

modify any values in registers or memory. It is used to initialize the IF/ID pipeline at

reset.

You will need to replace the instruction definitions in INST_MEM with your new

machine code for the test program. Put an initial data value of 0x55555555 in โ€œword 21โ€

and 0xAAAAAAAA in โ€œword 25โ€ for your programs memory test data (used by lw

instructions in test program). Initialize other data locations to all 0โ€™s.

Sections 6.2 and 6.3 of Computer Organization and Design The Hardware/Software

Interface contain additional background information on pipelining. Note that the VHDL

input signal, function_opcode in EXECUTE.VHD can be tied to the low six-bits of the

pipelined instruction sign-extend field as shown in the textโ€™s diagrams. Your simulation

should show the major busses just as in part one. You can add other signals as needed. To

Georgia Tech Page 4 of 8

Instruction memory

Instruction [20โ€“ 16]

MemtoReg

ALUOp

Branch

RegDst

ALUSrc

Instruction [15โ€“ 0]

M

u x

Add

Add result

Registers Write register

Write data

Read data 1

Read data 2

Read register 1

Read register 2

Sign extend

M

u x 1

ALU

result

Zero

ALU

control

Shift left 2 RegWrite

MemRead

Control

ALU

Instruction [15โ€“ 11]

EX
M
WB
M
WB
WB

Instruction

IF/ID ID/EX EX/MEM

ID: before<1> EX: before<2> MEM: before<3> WB: before<4>

MEM/WB

IF: lw $10, 20($1)

M

u x

Add

PC

Data memory

Address

Write data

Read data M u x

WB
EX
M

Instruction memory

MemtoReg

ALUOp

Branch

RegDst

ALUSrc

M

u x

Add Add result

Write register

Write data

M

u x 1

ALU

result

Zero

ALU

control

Shift left 2 RegWrite

ALU
M
WB
WB

Instruction

IF/ID ID/EX EX/MEM

ID: lw $10, 20($1) EX: before<1> MEM: before<2> WB: before<3>

MEM/WB

IF: sub $11, $2, $

M

u x

Add

PC

Write data

Read data M u x

lw Control

Registers

Read data 1

Read data 2

Read register 1

Read register 2

X
X

Instruction [20โ€“ 16]

Instruction [15โ€“ 0] (^) Sign extend

Instruction [15โ€“ 11]

$X
X

MemWrite

MemRead

MemWrite

Data memory

Address

Address

Address

Clock 2

Clock 1

Georgia Tech Page 5 of 8

Instruction memory

Address

Instruction [20โ€“ 16]

MemtoReg

Branch

ALUSrc

Instruction [15โ€“ 0]

Add

Add result

Registers Write register

Write data

Read data 1

Read data 2

Read register 1

Read register 2 ALU result

Shift left 2 RegWrite

MemRead

Control

ALU

Instruction [15โ€“ 11]

EX
M
WB
WB

Instruction

IF/ID ID/EX EX/MEM

ID: sub $11, $2, $3 EX: lw $10,... MEM: before<1> WB: before<2>

MEM/WB

IF: and $12, $4, $

M

u x

Add

PC

Write data

Read data M u x

WB
EX
M

Instruction memory

Address

MemtoReg

ALUOp

Branch

RegDst

ALUSrc

Add Add result

Write register

Write data (^1)

ALU

result

ALU

control

Shift left 2 RegWrite

M
WB

Instruction

IF/ID ID/EX EX/MEM

ID: and $12, $2, $3 EX: sub $11,... MEM: lw $10,... WB: before<1>

MEM/WB

IF: or $13, $6, $

M

u x

Add

PC

Write data

M

u x

and Control

Registers

Read data 1

Read data 2

Read register 1

Read register 2

X
X

Instruction [20โ€“ 16]

Instruction [15โ€“ 0]

Instruction [15โ€“ 11]

X
X

MemWrite

MemRead

MemWrite

sub

X
X
X
X
M

u x

M

u x 1

ALUOp

RegDst

ALU

control

M
WB
M

u x

M

u x

ALU

Address Read data Data memory

WB

Zero

Zero

Sign extend

Sign extend

Data memory

Address

Clock 3

Clock 4

Georgia Tech Page 7 of 8

Instruction memory

Address

Instruction [20โ€“ 16]

Branch

ALUSrc

Instruction [15โ€“ 0]

Add

Add result

Registers Write register

Write data

ALU

result

Shift left 2 RegWrite

MemRead

Control

ALU

Instruction [15โ€“ 11]

Sign extend

EX
M
WB

Instruction

IF/ID ID/EX EX/MEM

ID: after<1> EX: add $14,... MEM: or $13,... WB: and $12,...

MEM/WB

IF: after<2>

M

u x

Add

PC

Write data

Read data M u x

WB
EX
M

Instruction memory

Address

MemtoReg

ALUOp

Branch

RegDst

ALUSrc

Add Add result

ALU

result

Zero

ALU

control

Shift left 2 RegWrite

M
WB

Instruction

IF/ID ID/EX EX/MEM

ID: after<2> EX: after<1> MEM: add $14,... WB: or $13,...

MEM/WB

IF: after<3>

M

u x

Add

PC

Write data

M

u x

Control

Registers

Read data 1

Read data 2

Read register 1

Read register 2

Instruction [20โ€“ 16]

Instruction [15โ€“ 0] (^) Sign extend

Instruction [15โ€“ 11]

MemWrite

MemRead

MemWrite

M

u x

M

u x 1

ALUOp

RegDst

ALU

control

M
WB
M

u x

M

u x

ALU

Read data

WB
WB

MemtoReg

Write register

Write data

Read data 1

Read data 2

Read register 1

Read register 2 Zero

Data memory

Address

Data memory

Address

Clock 7

Clock 8

Georgia Tech Page 8 of 8

WB
EX
M

Instruction memory

Address

MemtoReg

ALUOp

Branch

RegDst

ALUSrc

Add Add result

ALU

result

Zero

ALU

control

Shift left 2 RegWrite

M
WB

Instruction

IF/ID ID/EX EX/MEM

ID: after<3> EX: after<2> MEM: after<1> WB: add $14,...

MEM/WB

IF: after<4>

M

u x

Add

PC

Write data

M

u x

Control

Registers

Read data 1

Read data 2

Read register 1

Read register 2

Instruction [20โ€“ 16]

Instruction [15โ€“ 0] (^) Sign extend

Instruction [15โ€“ 11]

MemRead

MemWrite

M

u x

M

u x

ALU

Read data

WB

Write register

Write data

Data memory

Address

Clock 9