Computer Architecture Memory, Math and Logic
Basic Building Blocks Seen: – Memory – Logic & Math
Higher Level Architecture CPU – Central Processing Unit Memory – Programs and Data Input & Output – Keyboards, Mice, Screens Printers, Networks, etc… CPU Memory Input & Output
Busses – Groups of wires that carry a signal 1 wire for each bit Separate busses for different signals
Memory – Collection of bytes – Access byte by address
Memory – Collection of bytes – Access byte by address – Meaning defined by program Byte 0x00 could be: – 74 – J – Red part of a 24-bit color 0x00-0x02 – Part of a 64-bit floating point 0x00-0x07
Memory Hierarchy Memory is – Too slow – Too small – Temporary
Memory Hierarchy Main Memory : medium speed/capacity – RAM
Memory Hierarchy On processor: Small, Ultra Fast memory – Registers – Cache
Memory Hierarchy Secondary Memory : slower, larger, permanent storage – Hard drives – Flash drives
Inside the CPU Registers – Small high speed memory ALU – Arithmetic Logic Unit CU – Control Unit Memory Input & Output
Registers – Special purpose memory in CPU Examples: – PC : Program Counter What memory address has next instruction – IR : Instruction Register What instruction we are working on – ACC : Accumulator Result of what we just did
ALU Arithmetic Logic Unit Can: – Add/Subtract Multiply/divide handled by special purpose hardware – Logic Tests = – Bit Operations Not, OR, AND, shifts,…
ALU cont… Common representation: – 2 main inputs Additional input to pick operation – 1 main output
CU Control Unit – Decoder : reads instructions from IR, sends control signals to control ALU, memory – Clock : synchronizes operations across computer
Machine Code Machine Code : Instruction stored as binary – Bits to represent operation to perform (opcode) value to use (operand)
Sample Code Machine codeFunction Load the value 2 into the Accumulator Load the value 5 into the Accumulator Store the value of the Accumulator in memory location Add the value of memory location 13 to the Accumulator
Fetch-Decode-Execute Fetch – Decode – Execute