Docsity

Computer Architecture Principles - Project 2 | CDA 5155, Study Guides, Projects, Research of Electrical and Electronics Engineering

Toggle sidebar
bg1
Project 2
CDA 5155: Fall 2008
Due Date: 11/20/2008 11:59 PM (UF EDGE Students: 11/27/2008 11:59 PM)
Project2 webpage: http://www.cise.ufl.edu/~prabhat/Teaching/cda5155-f08/projects/project2.html
You are not allowed to take or give help in completing this project. Submit the jar/tar version of the directory in
e-Learning website before the deadline. Please include the sentence in quote in your README file: “On my
honor, I have neither given nor received unauthorized aid on this assignment”.
For this project you will create a simulator for a pipelined processor with cache. Your simulator should be
capable of loading a specified MIPS binary file and generate the cycle-by-cycle simulation of the MIPS binary
code. It should also produce/print the contents of registers, buffers, caches and data memories for each cycle.
Exception/interrupt handling during the simulation is not required.
You can use either Java or C/C++ to develop your simulator. Your program MUST compile and execute on
sand.cise.ufl.edu (Solaris) or thunder.cise.ufl.edu (Linux). You MUST provide all the source code files, a Makefile,
and a README file, and any other files to build and run your project. Neither class file (for java), nor .o file (for
C/C++) would be considered as valid part of the submission. The README file must contain the honor code and
any special notes or assumptions (e.g., whether to use sand or thunder) you make about the project that the TA
should take into consideration.
Your MIPS simulator (with executable name as MIPSsim) should provide the following option to users:
MIPSsim –I inputfilename –O outputfilename
Where,
* Inputfilename – The file name of the text version binary input file (e.g., sample.txt).
* Outputfilename – The file name for printing the simulation output (e.g., sample_sim.txt).
The disassembly output is not required.
You are strongly recommended to test your submission. Download your submission, use the CISE SUN OS
machine (sand.cise.ufl.edu) or CISE LINUX machine (thunder.cise.ufl.edu), and test it with following commands.
> jar –xvf filename.jar (or, tar xvf filename.tar)
> cd <dir> (if required)
> make
> (java) MIPSsim –I sample.txt –O sample_sim.txt
pf3
pf4
pf5
pf8

Partial preview of the text

Download Computer Architecture Principles - Project 2 | CDA 5155 and more Study Guides, Projects, Research Electrical and Electronics Engineering in PDF only on Docsity!

Project 2

CDA 5155: Fall 2008 Due Date: 11/20/2008 11:59 PM (UF EDGE Students: 11/27/2008 11:59 PM)

Project2 webpage: http://www.cise.ufl.edu/~prabhat/Teaching/cda5155-f08/projects/project2.html

You are not allowed to take or give help in completing this project. Submit the jar/tar version of the directory in e-Learning website before the deadline. Please include the sentence in quote in your README file: “On my honor, I have neither given nor received unauthorized aid on this assignment”.

For this project you will create a simulator for a pipelined processor with cache. Your simulator should be capable of loading a specified MIPS binary file and generate the cycle-by-cycle simulation of the MIPS binary code. It should also produce/print the contents of registers, buffers, caches and data memories for each cycle. Exception/interrupt handling during the simulation is not required.

You can use either Java or C/C++ to develop your simulator. Your program MUST compile and execute on sand.cise.ufl.edu (Solaris) or thunder.cise.ufl.edu (Linux). You MUST provide all the source code files, a Makefile, and a README file, and any other files to build and run your project. Neither class file (for java), nor .o file (for C/C++) would be considered as valid part of the submission. The README file must contain the honor code and any special notes or assumptions (e.g., whether to use sand or thunder) you make about the project that the TA should take into consideration.

Your MIPS simulator (with executable name as MIPSsim) should provide the following option to users:

MIPSsim –I inputfilename –O outputfilename

Where,

  • Inputfilename – The file name of the text version binary input file (e.g., sample.txt).

  • Outputfilename – The file name for printing the simulation output (e.g., sample_sim.txt).

The disassembly output is not required.

You are strongly recommended to test your submission. Download your submission, use the CISE SUN OS machine (sand.cise.ufl.edu) or CISE LINUX machine (thunder.cise.ufl.edu), and test it with following commands.

jar –xvf filename.jar (or, tar xvf filename.tar)

cd

(if required)

make

(java) MIPSsim –I sample.txt –O sample_sim.txt

Introduction:

In this part, we are going to discuss the implementation of a 4-stage pipeline with a simple cache.

Instruction Format:

The instruction format remains exactly the same as the project 1. Please refer to the documents of Project 1.

Pipeline Description:

The white boxes represent the functional units, the blue boxes represent buffers/queues between the units, the yellow boxes represent registers and the green ones are the memory units. In the remainder of this section, we describe the functionality of each of the units/buffers/memories in detail.

Instruction Fetch (IF):

Instruction Fetch unit can fetch and decode up to two instructions at each cycle (in program order). The unit should check all the following conditions before it can fetch further instructions.

  • If the fetch unit is stalled, no instruction can be fetched at the current cycle. No pre-fetching. The fetch unit can be stalled due to a branch instruction or due to cache miss (as described below).
  • If there is no empty slot in the Pre-issue buffer, no instruction can be fetched at the current cycle.
  • The load instruction must wait until all the previous stores are issued.
  • The stores must be issued in order.

As mentioned earlier, the registers can be written and read in the same cycle. For example, for the following two instructions, the second instruction would be issued at the same cycle the first instruction WB its result.

SLL R10, R1, # LW R3, 172(R10)

Pre-ALU queue:

The Pre-ALU queue has two entries. Each entry can store one instruction with its 2 operands. The queue is managed as FIFO (in-order) queue.

ALU:

The ALU handles all non-memory instructions i.e., all instructions except load and store. All the ALU instructions will take one cycle. The ALU can fetch one instruction each cycle from the Pre-ALU queue and compute it. When an ALU instruction starts execution at ALU unit, it is removed from the Pre-ALU queue. (Therefore the issue unit will see at least one empty slot in Pre-ALU queue in this cycle.) The result will be put into the Post-ALU buffer at the end of each cycle.

ALU can forward the result of the instruction executed in current cycle to the instructions waiting in Pre-ALU queue. For example, assume at the end of some cycle the following instructions are waiting in Pre-Issue Buffer and Pre-ALU queue: Pre-Issue Buffer: Entry 0:[ADD R8, R4, R1] Entry 1:[ADD R7, R1, R6] Entry 2: Entry 3: Pre-ALU Queue: Entry 0:[ADD R4, R2, R1] Entry 1:[ADD R5, R4, R1] Then ADD R5, R4, R1 will get its operand value R4 in the next cycle because of the data forwarding. But ADD R8, R4, R1 cannot get R4 by forwarding because it is not currently in the Pre-ALU queue. Therefore, it should not be issued in the next cycle, although there will be an empty slot in Pre-ALU queue in the next cycle.

Post-ALU buffer:

The Post-ALU buffer has one entry. This entry can store one instruction with destination register id and the result.

Pre-MEM queue:

The Pre-MEM queue has two entries. Each entry can store one instruction with its address and data (if it is write instruction). The queue is managed as FIFO (in-order) queue.

MEM Unit:

The MEM unit handles LW and SW instructions.

For LW instruction, it takes one cycle to finish if it hits in cache and takes two cycles if it misses (i.e., one cycle stall). When a LW instruction finishes, the instruction with destination register id and the data will be written to the Post-MEM buffer.

For SW instruction, it takes one cycle to finish if the block is in the cache otherwise it also takes 2 cycles. When a SW instruction finishes, nothing would be sent to Post-MEM buffer.

When a MEM instruction finishes execution at MEM unit, it is removed from the Pre-MEM queue. (Therefore the slot in Pre-MEM queue occupied by this instruction will not become empty until the end of this cycle from the view point of the issue unit.)

Post-MEM buffer:

The Post-MEM buffer has one entry. This entry can store one instruction with destination register id and data.

WB Unit

WB unit can execute two writebacks in one cycle. It fetches the content of both Post-ALU Buffer (if any) and Post-MEM Buffer (if any) and updates the Register File.

PC:

Program Counter (PC) records the address of the next instruction to fetch. It should be set to 128 at the initialization.

Register File:

There are 32 registers. Assume that there are sufficient read/write ports to support all kinds of read write operations to be finished in one cycle.

Notes on Pipelines:

  1. The simulation finishes when a BREAK instruction is fetched.
  2. No other data forwarding except the one from the output of ALU to Pre-ALU queue.
  3. No delay slot will be used for branch instructions.
  4. Different Instructions takes different stages to be finished. a. NOP, Branch, BREAK, only uses IF stage; b. SW: only IF, Issue, MEM stages; c. LW: IF, Issue, MEM, WB; d. ALU instructions: IF, Issue, ALU, WB.

20 hyphens and a new line

Cycle [value]:

<blank_line>

IF Unit:

Waiting for cache: [address of fetched but missed instruction(s) in this cycle]

Waiting Instruction: [instruction waiting for its operand]

Executed Instruction: [instruction executed in this cycle]

Pre-Issue Buffer:

Entry 0: [instruction]

Entry 1: [instruction]

Entry 2: [instruction]

Entry 3: [instruction]

Pre_ALU Queue:

Entry 0: [instruction]

Entry 1: [instruction]

Post_ALU Buffer:

Entry 0 : [instruction]

Pre_MEM Queue:

Entry 0: [instruction]

Entry 1: [instruction]

Post_MEM Buffer:

Entry 0: [instruction]

< blank_line >

Registers

R00:< tab >< int(R0) >< tab >< int(R1) >..< tab >< int(R7) >

R08:< tab >< int(R8) >< tab >< int(R9) >..< tab >< int(R15) >

R16:< tab >< int(R16) >< tab >< int(R17) >..< tab >< int(R23) >

R24:< tab >< int(R24) >< tab >< int(R25) >..< tab >< int(R31) >

ICache

Waiting for memory:[The line address of current missed cache line]

Line 0: < tab > [(valid bit, dirty bit, tag) (actual line address)<word0,word1>]

.....

Line 3: < tab > [(valid bit, dirty bit, tag) (actual line address)<word0,word1>]

DCache

Waiting for memory:[The line address of current missed cache line]

Line 0: < tab > [(valid bit, dirty bit, tag) (actual line address)<word0,word1>]

.....

Line 3: < tab > [(valid bit, dirty bit, tag) (actual line address)<word0,word1>]

Data

< firstDataAddress >:< tab >< display 8 data words as integers with tabs in between >

..... < continue until the last data word >