Skip to content
Tactiverge

Section 08 of 10 · 17 entries

Computer architecture

What happens inside a processor: registers, clocks, memory, caches, pipelines and interrupts.

Entries in Computer architecture

  1. Address spaceThe address space is the range of addresses a processor can generate. With n address bits and byte addressing, it can reach 2^n bytes.addressable bytes = 2^n
  2. ALU (arithmetic logic unit)The ALU is the part of a processor that performs arithmetic (add, subtract) and logic (AND, OR, XOR, shifts) on values from registers, and sets status flags such as zero and carry.result = op(A, B)
  3. Amdahl's lawAmdahl's law says the overall speed-up from improving part of a task is limited by the fraction of time that part takes.speed-up = 1 / ((1 − p) + p / s)
  4. Average memory access time (AMAT)Average memory access time is the cache hit time plus the miss rate multiplied by the miss penalty.AMAT = t_hit + miss rate × t_miss_penalty
  5. Bus and link bandwidthBandwidth is how much data a bus or link can move per second. For a UART each byte usually costs 10 bit times: one start bit, eight data bits and one stop bit.UART bytes/s = baud / 10 (8N1)
  6. Clock speed, cycles and CPIExecution time equals the number of instructions times the average cycles per instruction (CPI) divided by the clock frequency.t = N_instr × CPI / f_clock
  7. EndiannessEndianness is the order in which the bytes of a multi-byte value are stored in memory or sent over a link: little-endian puts the least significant byte first, big-endian the most significant.little-endian bytes of 0xAABBCCDD: DD CC BB AA
  8. Fetch–decode–execute cycleA processor runs a program by repeatedly fetching the instruction at the program counter, decoding what it means, executing it and moving the program counter on.loop: IR ← memory[PC]; PC ← PC + size; decode IR; execute
  9. Instruction set architecture (ISA)The ISA is the contract between software and hardware: the instructions, registers, data types and addressing modes a processor promises to support.instruction width = opcode bits + operand field bits
  10. InterruptsAn interrupt is a hardware signal that makes the processor pause the main program, run a short interrupt service routine (ISR), and then resume where it left off.CPU load from interrupts = rate × (ISR cycles) / f_clock
  11. Memory hierarchy and cachesComputers use a hierarchy of memories from tiny fast registers and caches to large slow main memory and storage; a cache keeps recently used data close to the processor.hit rate = hits / accesses
  12. Memory-mapped I/OWith memory-mapped I/O, peripheral control and data registers appear at fixed memory addresses, so the processor talks to hardware with ordinary load and store instructions.register address = peripheral base + offset
  13. Pipeline hazards and forwardingA hazard is a situation where the next instruction cannot proceed on schedule. Data hazards happen when an instruction needs a result an earlier one has not finished producing.classic 5-stage, no forwarding: RAW on adjacent instructions → 2 bubblesinteractive demo
  14. PipeliningPipelining splits instruction execution into stages and overlaps them, so that while one instruction executes the next is being decoded and the one after is being fetched.unpipelined: n × k cyclesinteractive demo
  15. RAM, flash and EEPROMRAM is fast, volatile working memory that loses its contents without power; flash and EEPROM are non-volatile and keep data, but are slower to write and wear out after many write cycles.lifetime ≈ endurance (cycles) / writes per unit time
  16. RegistersRegisters are a small number of very fast storage locations inside the processor that hold the values it is working on right now.register file size = number of registers × word size
  17. Word sizeA processor's word size is the number of bits it naturally handles in one operation: its register width and usually its main data path.unsigned range = 0 to 2^n − 1