Tuesday, 24 November 2015 Schedule for rest of semester: Today: - - PowerPoint PPT Presentation

tuesday 24 november 2015
SMART_READER_LITE
LIVE PREVIEW

Tuesday, 24 November 2015 Schedule for rest of semester: Today: - - PowerPoint PPT Presentation

Tuesday, 24 November 2015 Schedule for rest of semester: Today: quick look at Chapter 4--the datapath Monday, Nov 30: lab time for project work Tuesday, Dec 1: review sheets for exam Thursday, Dec 3: review; project reports


slide-1
SLIDE 1

Tuesday, 24 November 2015

Schedule for rest of semester: ■ Today: quick look at Chapter 4--the datapath ■ Monday, Nov 30: lab time for project work ■ Tuesday, Dec 1: review sheets for exam ■ Thursday, Dec 3: review; project reports ■ Monday, Dec 7: COOKIES!, project reports

slide-2
SLIDE 2

Executing a MIPS Program

Recall: programs consist of a set of

  • instructions. In MIPS, each instruction is a 32-

bit word. Instructions are stored in an area of memory separate from the data area. A special register called the “program counter”

  • r PC contains the address of the next

instruction.

slide-3
SLIDE 3

Executing a MIPS Program

All calculations take place in the ALU, or Arithmetic Logic Unit. These calculations use the registers. All of the logic needed to perform addition, subtraction, “or”, “and”, comparisons,

  • etc. is contained in the ALU.

Data stored in memory must be transferred back and forth between the registers and memory in order to perform calculations with it.

slide-4
SLIDE 4

Steps to Execute a MIPS Instruction

■ Fetch an instruction from memory address stored in the PC and add 4 to the PC (advance to next instruction) ■ Decode the instruction ■ Execute the instruction:

■ If it’s a load, fetch operand from memory to register ■ If it’s a store, store result from register to memory ■ Everything else: carry out the instruction in registers

slide-5
SLIDE 5

Decoding Instructions

Recall instruction formats (chapter 2). We

  • nly looked at R-format (for register
  • perations); there are two others (I-format for

immediate instructions; J-format for jump instructions). To decode an instruction we look at the leftmost 6 bits (the op code). E.g., “000000” indicates an R-format instruction (to determine which one, we look at the rightmost 6 bits).

slide-6
SLIDE 6

First Approximation to Datapath

Most of these lines actually represent 32

  • ne-bit values
slide-7
SLIDE 7

First Approximation to Datapath

Here is where we “add 4” to the program counter, advancing to the next instruction.

slide-8
SLIDE 8

First Approximation to Datapath

In the case of a jump instruction, we must alter the PC by adding an “offset” (which is contained in the jump instruction)

slide-9
SLIDE 9

First Approximation to Datapath

A “load” instruction requires several steps: first, calculate the memory address

slide-10
SLIDE 10

First Approximation to Datapath

Then transfer data from memory to a register

slide-11
SLIDE 11

What Is “Calculate an Address”?

In a MIPS instruction there is not enough room to hold an entire address; instead, the instruction contains an OFFSET that must be added to the base address of the data memory in order to compute the actual address.

slide-12
SLIDE 12

First Approximation to Datapath

A “store” instruction also requires several steps: first, calculate the memory address

slide-13
SLIDE 13

First Approximation to Datapath

Then transfer data from a register to memory

slide-14
SLIDE 14

First Approximation to Datapath

An “la” instruction (“load address”) first calculates the memory address

slide-15
SLIDE 15

First Approximation to Datapath

And then loads that address to a register. No memory access is needed.

slide-16
SLIDE 16

A More Detailed Look

■ Can’t just join

wires together

■ Use multiplexers

slide-17
SLIDE 17

A More Detailed Look