131 Flashcards
(199 cards)
Define ISA
interface between hardware + software - set of commands a processor can understand/execute
ALU provides… + implements…
registers (store operands + results), status flags (bits organised in flags register as -overflow, zero or negative)
arithmetic + logic operations
How to add 2 bits? How to add 3 bits?
2 - half adder aka S = A XOR B and S = A . B
3 - full adder aka S = Cin XOR (A XOR B) Cout = A.B + Cin . (A XOR B)
What is the problem with ripple-carry adders and how to solve this?
slow as each stage has to wait for carry bit from above
can solve with carry select adders (split problem by adding lower n/2 bits as usual but add upper n/2 bits using 2 full adders where one Cin is 1 and the other 0)
- effectively x2 speed + can split as long as cost/space allows
How does an ALU identify an overflow?
inputs’ sign bits are the same but the result has a different sign
Cin ⊕ Cout = 1 = arithmetic overflow error
How does the ALU perform simple multiplication + division?
Can be done with repetitive adders (slow)
Bit shifting (only works for powers of 2)
- shifts numbers to left(*)/right(/) by n^2 + may be arithmetic, logical, rotate or rotate through carry
What are the types of volatile memory?
dynamic - used for main mem., slow but cheaper
+ static - used for registers/caches, fast but expensive
What is main memory?
each location holds 1 unit of info
identified by address (usually linear 0..n) which typically maps to multiple memory chips - address decoder maps linear addresses to specific location in a specific memory chip
What ways can machine architecture organise mutli-byte words in memory?
big-endian - location (byte) with the lowest memory address holds the most significant byte
little-endiain - location with the lowest memory address holds the least-significant byte
How does static memory store bits
stored bits are organised into multi-bit storage slots called registers
use networks of logic components (NAND gates) to build storage for individual data bits
What does combinatorial vs sequential logic entail?
c = outputs are purely a function of its inputs
s = outputs are a function of its inputs AND its current outputs
involves feedback of the outputs to the inputs which is the hook on which we hang memory
What is a set-reset (S-R) flip-flop?
remembers its current state where Q0 = current + Q = next
high pulse on S -> Q=1(set)
high pulse on R -> Q=0 (reset)
(both S and R can’t be 1)
- has distinct set + reset inputs rather than a single input (could set state if 1 and reset if 0)
- no way of telling the f-f exactly when it should store input data (would like a latch signal to supervise)
What is a clocked D-type flip-flop?
D = 1, L = 1 → Q = 1
Q0 = 1 but D = 0, L= 0 → Q = 1
Change D = 0 to set latch to 0
- no output enable to have closer control of when existing data leaves + new data arrives
What is a master-slave flip-flop?
slave is only readable where output enable is high pulse
if master latch = high → data signal is stored in master but slave is untouched
if master latch = low → data moves to slave
can implement registers using multiple master-slave flip-flops
What is a bus?
bundles of wires that connect elements of VN architecture - one wire per bit
buses need output enable as all share 1 wire + so can’t all be active at once
What do the different buses do?
address bus - runs between CU and main memory to tell memory to access a specific address
- width = amount of addressable memory
data bus - runs between CU and main memory to send data
- width = number of bits that can be read/written to/from memory at once
control bus
some processors may have internal + external buses (external may be narrower to reduce external pins + therefore cost)
Control Unit
“little program” running inside the processor that endlessly executes the fetch-decode cycle - controls sequences + other architectural modules using their respective control lines (e.g latch, output enable, function select, carry + shift L/R)
CU is driven by clock ticks/pulses
How can CU fetch-ex loops be implemented?
as a FSM (hard-wired sequential logic - built directly in terms or NAND gates)
- high performance but expensive + hard to evolve
OR
as microcode (sequence of micro-instructions in a micro-memory)
- flexible but slightly lower performance
What is pipelining?
exploit inherent parallelism inside CU to speed up fetch-ex cycle
if split cycle into n-stages → get n x speedup
speed up may be reduced by hazards that “stall” pipeline + so need “flushing”
What are the hazards associated with pipelining?
- control hazards: occur when a control-transfer instruc. changes the flow of execution
- data hazards: occur when instruc. n depends on a result from previous instruc. or when two parts of the pipeline need access to the same data
- structural hazards: occur when two parts of the pipeline need access to the same piece of hardware
I/O devices
- input = keyboard, mouse, track ball, touch screen, camera, environmental sensor
- output = display, printer, speaker, environmental actuator
- input + output = network interfaces (ethernet, wifi, bluetooth, etc.), disks, audio cards, MIDI devices
The I/O system enables…
attachment of I/O devices to the processor so they can communicate
though challenges w/
- speed-gap: I/O devices are often mechanical so run orders of magnitude slower than the CPU
- device diversity: differences like data-access modes (read-only/write-only/read-and-write, access by individual byte/block and access randomly/sequentially), device specific operations + I/O protocols
What is a device driver?
software plug-ins inside the OS that abstract over device diversity by grouping sets of similar types of devices
- register device with the OS + initialises it
- initiates data transfers to/from a device
- monitors status events from a device
- manages device/system shutdowns so OS doesn’t stop till all unwritten data is stored + device is left in a safe state
Two-fold classification (types) of device + device driver
character devices - send + receive 1 byte at a time - e.g. keyboard
block devices - send + receive multi-byte block at a time - e.g. hard disk