csci 211 intro computer organization –consists of gates for logic and or not –processor...
TRANSCRIPT
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
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.
What’s inside
• Everything in the computer is represented with 0’s and 1’s (on-off)– Integers– Characters– Boolean– Float– Instructions (machine language)
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
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
Why not USE assembly
• Tedious
• Error prone
• Slow to write
• Machine dependent
• Good compilers produce fast code already
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
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)
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
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
Register Conventions
• $0 = 0
• $1 – used by the assembler
• $2, $3 – function return values
• $4-$7 – Arguments to a function
• Etc.
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
Instruction Register
• IR– Holds the 32 bit instruction just fetched– Needed for control unit to determine what
control signals to send
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
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)