csci 211 intro computer organization –consists of gates for logic and or not –processor...

16
CSCI 211 Intro • Computer Organization – Consists of gates for logic • And • Or • Not – Processor – Memory – I/O interface

Upload: richard-page

Post on 04-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

CSCI 211 Intro

• Computer Organization– Consists of gates for logic

• And• Or• Not

– Processor– Memory– I/O interface

Page 2: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Instructions

• Instructions are in memory– Fetch instruction, then execute it

• Fetch execute cycle

– More detailed• Fetch instruction• Fetch operands• Execute instruction• Save result• Determine next instruction

Page 3: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Processor Components

• Datapath– Hardware that electrons flow through to

accomplish an instruction

• Control– Tells hardware what to do and when to do it.

• Registers– Small amount of memory (32 4-byte for MIPS)

that can be operated upon.

Page 4: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

What’s inside

• Everything in the computer is represented with 0’s and 1’s (on-off)– Integers– Characters– Boolean– Float– Instructions (machine language)

Page 5: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Languages

• Machine Language– Just 0’s and 1’s– Very hard to program

• Assembly– Symbolic for machine language– Easy to create a program to translate from

assembly language to machine language (almost 1 to 1)

– Keeps track of variables’ addresses

Page 6: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Why Learn Assembler

• Understand what the machine does– Helps you to be a better guesser

• Needed to write a compiler (431)• Needed to build CPUs• Faster to execute• To determine timing• Gives you the power to access anything• Maintaining older systems

Page 7: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Why not USE assembly

• Tedious

• Error prone

• Slow to write

• Machine dependent

• Good compilers produce fast code already

Page 8: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

MIPS CPU

• Used in many systems– SGI workstations– Sony PS2– Dish Network set top box– Tivo DVR– Pioneer Plasma TV– HP Color laser printer– Many more

Page 9: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

MIPS Layout

• Control

• Register file (32 registers with 32 bits each)

• ALU

• Program Counter (PC)

• Memory – 32 bit address (232 bytes addressable = 4Gb)

• Instruction register (IR)

Page 10: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Control Unit

• Sends the proper control signals to each component to accomplish instruction

• Input to the control unit– Instruction– Cycle number – which step of the instruction

Page 11: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Register File

• A group of registers

• Input– Which register (5 bits)– Read or Write– 32 bit value (for write)– Outputs a 32 bit value for read

Page 12: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Register Conventions

• $0 = 0

• $1 – used by the assembler

• $2, $3 – function return values

• $4-$7 – Arguments to a function

• Etc.

Page 13: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Other components• ALU

– Performs arithmetic and logic (and, or, shift)

• PC– Program counter – address of next instruction

• Memory– 32 bit address– Addresses a byte (8 bits)– Some instructions use word (4 bytes),

halfword (2 bytes), or byte operands– All instructions are 4 bytes (on MIPS)

• PC=PC+4

Page 14: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Instruction Register

• IR– Holds the 32 bit instruction just fetched– Needed for control unit to determine what

control signals to send

Page 15: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Instruction Format

• Opcode– First 6 bits

• 3 Formats– R type

• Opcode all 0’s• Three 5-bit fields for registers (2 for operand, 1 for

result)• 5-bit shift amount (for shift instructions)• 6-bit function code

Page 16: CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface

Other formats

• I Type– Two 5-bit register numbers– 16-bit value as the third operand

• J type– Jump instructions– 26 bit address field (64M)