Docsity

MIPS VHDL Simulation Assignment for ECE 3055b, Lab Reports of Electrical and Electronics Engineering

Toggle sidebar
bg1
Score:________ Date:_________ Name:________________________Section:_b__
ECE 3055b Lab Assignment #2
TA Signoff & Grades
Part 1______________________________ Part 2______________________________
Due Date Part 1: Thursday, Feb. 3
Due Date Part 2: Thursday, Feb. 17
Note: This assignment has two parts, the first part is simple, you just have to run an
existing VHDL-based MIPS hardware simulation using the new Altera Quartus II CAD
tools and understand the results. The second part, adding Pipelining to the model will
take a significant effort, so be sure to start work early to be able to finish on time. The
Altera Quartus II tools are available in the ECE PC labs or on the web using the link at
http://www.ece.gatech.edu/~hamblen/3055
The MIPS VHDL source files are also available on a link on the class web page at:
http://www.ece.gatech.edu/~hamblen/3055
Note: Get the new files for this Semester from this location only! – see the separate
handout passed out earlier on how to run the new MIPS model using Quartus II.
1. Use VHDL to synthesize the MIPS single clock cycle design in the top-level file
MIPS.VHD. Information on this model can be found in the last chapter of your ECE
2031 textbook. After synthesis and simulation perform the following steps:
Display and print the timing diagram from the simulation. Verify that the information on
the timing diagram shows that the hardware is functioning correctly. Examine the test
program in PROGRAM.MIF. Look at the program counter, instruction bus, register file,
ALU outputs, and control signals on the timing diagram and carefully follow the
execution of each instruction in the test program. Label the important values for each
instruction on the timing diagram and attach a short write-up explaining in detail what the
timing diagram shows relative to each instruction's execution and correct operation.
Return to the simulator and run the simulation again. Examine the ALU output in the
timing diagram window. Zoom in on the ALU output after execution of the third
instruction and see what happens when it changes values. Explain exactly what is
happening at this point. Hint: Real hardware has timing delays.
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
pf3
pf4
pf5

Partial preview of the text

Download MIPS VHDL Simulation Assignment for ECE 3055b and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

Score:________ Date:_________ Name:________________________Section:_ b __

ECE 3055b Lab Assignment

TA Signoff & Grades

Part 1______________________________ Part 2______________________________

Due Date Part 1: Thursday, Feb. 3

Due Date Part 2: Thursday, Feb. 17

Note: This assignment has two parts, the first part is simple, you just have to run an

existing VHDL-based MIPS hardware simulation using the new Altera Quartus II CAD

tools and understand the results. The second part, adding Pipelining to the model will

take a significant effort , so be sure to start work early to be able to finish on time. The

Altera Quartus II tools are available in the ECE PC labs or on the web using the link at

http://www.ece.gatech.edu/~hamblen/

The MIPS VHDL source files are also available on a link on the class web page at:

http://www.ece.gatech.edu/~hamblen/

Note: Get the new files for this Semester from this location only! – see the separate

handout passed out earlier on how to run the new MIPS model using Quartus II.

1. Use VHDL to synthesize the MIPS single clock cycle design in the top-level file

MIPS.VHD. Information on this model can be found in the last chapter of your ECE

2031 textbook. After synthesis and simulation perform the following steps:

Display and print the timing diagram from the simulation. Verify that the information on

the timing diagram shows that the hardware is functioning correctly. Examine the test

program in PROGRAM.MIF. Look at the program counter, instruction bus, register file,

ALU outputs, and control signals on the timing diagram and carefully follow the

execution of each instruction in the test program. Label the important values for each

instruction on the timing diagram and attach a short write-up explaining in detail what the

timing diagram shows relative to each instruction's execution and correct operation.

Return to the simulator and run the simulation again. Examine the ALU output in the

timing diagram window. Zoom in on the ALU output after execution of the third

instruction and see what happens when it changes values. Explain exactly what is

happening at this point. Hint: Real hardware has timing delays.

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. Synthesize 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. This will prevent adding more modules and will not require

extensive changes to the TOP_SPIM module. 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. You may want to change the inverted clock signal on data memory once you

add pipelining.

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 put new machine code in PROGRAM.MIF 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

display internal signals in the simulation, you may also need to make them outputs from

the top-level module. Print out the simulation results. Label the simulation output to

indicate how the instructions move through the pipeline.

Note: This program deliberately does not contain any data or branch hazards. Hardware

for forwarding and branch flushing will be added in later labs.

In mstreumcotiroyn Address I [n 2 s 0 t–ru 1 c 6 ti]on M^ e^ m to^ R e^ g Branch ALUSrc

I [n 1 s 5 t–ru 0 c]tion

Add (^) reAsduldt Write^ Registers register W dartiate d^ Rateaa d 1 d^ Rateaa d 2 R reegaisdter 1 R reegaisdter 2 re^ AsuLlUt l^ Sehft if 2 t R^ e^ g W^ ri te MemRead Control ALU I [n 1 s 5 t–ru 1 c 1 ti]on

EX

M

WB

WB

In^ s tru^ c tio^ n

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 , $ 5

M u x

Add PC Write^0 data R deaatda M u x

WB

EX

M

In mstreumcotiroyn Address M^ e m^ to R^ e^ g ALUOp Branch RegDst ALUSrc

Add (^) reAsduldt W regriitseter W dartiate (^1) re^ AsuLlUt c^ AonLtUrol l^ Sehft if 2 t R^ e^ g W^ ri te

M

WB

In^ s tru^ c tio^ n

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 , $ 7

M u x

Add PC Write^0 data M u x

and (^) Control Registers d^ Rateaa d 1 d^ Rateaa d 2 R reegaisdter 1 R reegaisdter 2 12

X

X

I [n 2 s 0 t–ru 1 c 6 ti]on I [n 1 s 5 t–ru 0 c]tion I [n 1 s 5 t–ru 1 c 1 ti]on

X

X

M^ e m^ W rite MemRead M^ e m^ W rite sub 11

X

X

X

X

M u x

M u 1 x ALUOp RegDst c^ AonLtUrol

M

WB

M u x M u x ALU Address Read Data^ data memory 10

WB

Zero Zero e^ Sxtiegnnd e^ Sxtiegnnd Address m Deamtoary Clock 3 Clock 4

In msterumctoioryn Address I [n 2 s 0 tr–u 1 c 6 ti]on Branch ALUSrc

I [n 1 s 5 t–ru 0 c]tion

Add (^) reAsuddlt Write^ Registers register W darittae d^ Raetaa 1 d d^ Raetaa 2 d R reegaidster 1 R reegaidster 2 re^ AsLuUlt S lehfti f 2 t R^ e^ g W^ ri te MemRead Control ALU I [n 1 s 5 tr–u 1 c 1 ti]on

EX

M

WB

In^ s tru^ c tio^ n

IF/ID ID/EX EX/MEM

ID: or $ 13 , $ 6 , $ 7 EX: and $ 12 ,... MEM: sub $ 11 ,... WB: lw $ 10 ,...

MEM/WB

IF: add $ 14 , $ 8 , $ 9

M u x

Add PC Write^0 data R deaatad M u x

WB

EX

M

In msterumctoioryn Address M^ e^ m to^ R e^ g ALUOp Branch RegDst ALUSrc

Add (^) reAsuddlt 1 re^ AsLuUlt co^ AnLtUrol S lehfti f 2 t R^ e g^ W rite

M

WB

In^ st ru^ c tio^ n

IF/ID ID/EX EX/MEM

ID: add $ 14 , $ 8 , $ 9 EX: or $ 13 ,... MEM: and $ 12 ,... WB: sub $ 11 ,...

MEM/WB

IF: after< 1 >

M u x

Add PC Write^0 data M u x

add (^) Control Registers d^ Raetaa 1 d d^ Raetaa 2 d R reegaidster 1 R reegaidster 2 14

X

X

I [n 2 s 0 tr–u 1 c 6 ti]on I [n 1 s 5 t–ru 0 c]tion I [n 1 s 5 tr–u 1 c 1 ti]on

X

X

M^ e m^ W rite MemRead M^ e^ m W^ r ite or 13

X

X

X

X

M u x

M u 1 x ALUOp RegDst co^ AnLtUrol

M

WB

M u x M u x ALU (^) Read data 12

WB

10 $^5

WB

M^ e^ m to^ R e^ g

W rergitiester W darittae Zero Zero Address m Deamtaory m^ Deamtaory Address e^ Sxtiegnnd e^ Sxtiegnnd Clock 5 Clock 6

WB

EX

M

Ins mtreumctoioryn Address M^ e^ m to^ R e^ g ALUOp Branch RegDst ALUSrc

Add (^) reAsudldt 1 re^ AsuLUlt Zero co^ AnLtUrol l^ Sehft if 2 t R^ e^ g W^ ri te

M

WB

In^ s^ t ru^ c tio^ n

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^0 data M u x

Control Registers d^ Raetaa 1 d d^ Raetaa 2 d R reegaidster 1 R reegaidster 2 I [n 2 s 0 tr–u 1 c 6 ti]on I [n 1 s 5 tr–u 0 c]t ion Sign extend I [n 1 s 5 tr–u 1 c 1 ti]on MemRead M^ e^ m W^ ri te M u x M u x ALU (^) Read data

WB

W regritiester W dartitae m^ Deamtaory Address Clock 9