IAE Academy

The whole Computer Organization and Architecture formula sheet, to print

46 formulas in 5 topics, each with when to use it. Each is explained in the topic notes.

Instruction sets and addressing modes

Read the notes

BITS NEEDED TO ENCODE N DISTINCT ITEMS

Smallest with . Applies to an opcode field ( instructions), a register field ( registers) or an address field ( addressable locations).

EXPANDING OPCODES: W-BIT INSTRUCTIONS, A-BIT ADDRESS FIELDS

, , are the numbers of two-, one- and zero-address instructions. The two-address format has a -bit opcode; each unused two-address code gives one-address codes, and each unused one-address code gives zero-address codes. Assumes every instruction is exactly bits, every address field is bits, and .

DISPLACEMENT-TYPE ADDRESSING

is the index register (indexed), the base register (base) or the PC (PC-relative); is the displacement field. For PC-relative, is signed.

PC-RELATIVE BRANCH TARGET

is the address of the instruction AFTER the branch (branch address + branch length), unless a question says the branch's own address is used. is the signed displacement in bytes, unless the ISA scales it.

RANGE OF AN N-BIT TWO'S-COMPLEMENT DISPLACEMENT

Range in displacement units relative to the base PC. If the displacement counts instructions of bytes, multiply by to get the byte range.

ALU design and the control unit: hardwired and microprogrammed

Read the notes

FULL ADDER EQUATIONS

One bit-slice of any adder. Both outputs need all three inputs to be stable.

SUBTRACTION AND OVERFLOW (2'S COMPLEMENT)

An adder/subtractor passes each through an XOR gate with a mode line and sets : adds and subtracts. signals signed (2's complement) overflow. For unsigned numbers, after an addition means the result does not fit in bits. After a subtraction done as , means (no borrow).

RIPPLE-CARRY ADDER WORST-CASE DELAY

is one FA's carry delay and is its sum delay, measured from when its carry-in is stable (its , are already stable). If one figure is given for both outputs, both times equal . The delay grows linearly with .

GENERATE, PROPAGATE AND SUM

: bit produces a carry whatever is. : bit passes an incoming carry on to . Some texts use . The carry equations below still hold with that choice, but the sum can then no longer be formed as .

CARRY RECURRENCE AND ITS LOOK-AHEAD EXPANSION

Each expanded carry is a two-level AND-OR expression in the 's, 's and , so every carry is ready 2 gate delays after the , signals, whatever its position. The cost is fan-in: has product terms and its largest AND gate has inputs.

SINGLE-LEVEL CLA DELAY (CONVENTION ABOVE)

This is independent of only because fan-in is assumed unlimited. If a question counts an XOR as more than one gate delay, substitute its figure in the first and last terms.

BLOCK (GROUP) GENERATE AND PROPAGATE FOR A 4-BIT BLOCK

Fan-in limits force wide adders to be built from -bit CLA blocks. Each block's , take 2 gate delays after the bit-level , . A second-level look-ahead unit applies the same carry equations to the block signals, giving the carry into every block at once instead of rippling between blocks. With a fixed block size , the number of look-ahead levels grows as , so the delay grows as .

CONTROL MEMORY SIZE

is the number of words (microinstructions) and is the width of one microinstruction. When a question gives the number of address bits of the CAR instead, . Convert to bytes by dividing by 8, and to KB with K = .

NEXT-ADDRESS AND CONDITION-SELECT FIELD WIDTHS

is the number of control-memory words that must be addressable. is the number of branch choices the field must select among, counting 'unconditional' (or 'no branch') as a choice when the question includes it.

CONTROL-FIELD WIDTH: HORIZONTAL VS ENCODED

Group holds mutually exclusive signals. The is the code for 'none of this group active'. Drop it (use ) only if the question says exactly one signal of the group is always active, or says no-operation need not be encoded.

Memory hierarchy, performance and cache mapping

Read the notes

HIT RATIO

The fraction of memory references satisfied directly by the cache. Miss ratio .

AVERAGE ACCESS TIME, HIERARCHICAL (SERIAL) ACCESS

Use this when main memory is accessed only after the cache lookup has missed, so a miss costs . is the time to get the needed data from main memory. If the question says a whole block is transferred into the cache on a miss and gives the block-transfer time, use that time as the miss cost in place of a single-word .

AVERAGE ACCESS TIME, SIMULTANEOUS ACCESS

Use this when the cache and main memory are looked up in parallel. On a miss, the cache-check time is hidden inside the longer memory access and is not added again.

AVERAGE ACCESS TIME FROM A STATED MISS PENALTY

The miss penalty is the EXTRA time a miss costs on top of the hit time. With hierarchical access and , this is the same as the hierarchical formula above.

SIZE OF THE TAG DIRECTORY

Number of lines cache size block size, whatever the associativity. The extra bits per line are whatever the question specifies. Typically that is a valid bit, a dirty bit for a write-back cache, and any replacement bits.

AVERAGE MEMORY ACCESS TIME, TWO-LEVEL CACHE

Model: L2 is accessed only on an L1 miss, and main memory only on an L2 miss, with each lower-level time added on top (hierarchical). here is the LOCAL miss rate of L2: misses in L2 accesses that reach L2 (the L1 misses). It is not the global miss rate.

GLOBAL MISS RATE OF L2

The fraction of ALL CPU accesses that miss in both L1 and L2 and go to main memory. If a question gives a global L2 miss rate, divide it by to get the local rate before using the AMAT formula.

CHIPS NEEDED TO BUILD AN M X W MEMORY FROM M X B CHIPS

Here and are numbers of words, and and are bits per word. Each row places chips side by side to form the full word width. rows are stacked to supply all the words. The memory needs address lines. Each chip takes the low of them, and the remaining high-order bits drive a decoder that selects one row.

TIME TO FETCH AN N-WORD BLOCK FROM LOW-ORDER INTERLEAVED MEMORY WITH M >= N BANKS

Model: all banks start their access together. The first word is on the bus after (the bank access time, including placing the word on the bus). Each further word, already read in its own bank, needs only one bus transfer time . Questions may define the timing differently, for example with a separate address-send cycle. Use the question's model when it gives one.

TIME TO FETCH AN N-WORD BLOCK, NO INTERLEAVING

Same model with a single bank: each word is a full, separate access. This is the baseline against which the speedup from interleaving is measured.

DISK ACCESS TIME

Seek: moving the head to the correct track. Rotational latency: waiting for the target sector to rotate under the head. Transfer: reading or writing the data once positioned. Add a controller overhead only if the question gives one. Unless stated otherwise, a given seek time is taken as the average seek time.

AVERAGE ROTATIONAL LATENCY

Half the time of one revolution, in seconds (RPM = revolutions per minute). This is the AVERAGE. The worst case is a full revolution and the best case is zero.

DATA TRANSFER TIME

One track passes under the head per revolution, so the transfer rate is the track capacity times the revolutions per second. Equivalently, reading one sector takes (revolution time) (sectors per track).

I/O interface: interrupts and DMA

Read the notes

TOTAL INTERRUPT-SERVICING OVERHEAD FOR N INTERRUPTS

= number of interrupts serviced in the period analysed; = context-save time; = the ISR's own execution time, excluding save and restore; = context-restore time. Divide by the total elapsed time to get the fraction of CPU time spent.

FRACTION OF CPU TIME SPENT ON ONE DEVICE'S INTERRUPTS

= total CPU time per interrupt (save + service + restore); = average time between interrupts; = interrupts per second. If there is one interrupt per word, is the device's word rate. This holds only while . Otherwise the CPU cannot keep up and data is lost.

BURST (BLOCK) MODE DMA TRANSFER TIME

= number of words in the block; = one memory (bus) cycle time. This holds when:

  • each word needs exactly one memory cycle;
  • the words are available back to back (for example from the device's buffer);
  • the DMAC holds the bus for the whole block;
  • bus request/grant overhead is ignored.

During this time the CPU cannot use the bus. It can still carry on with internal operations that need no bus.

CPU TIME LOST TO CYCLE-STEALING DMA OVER N WORDS

One bus cycle is stolen per word, assuming each word needs exactly one memory access. The two sides are equal in the standard model, where the CPU would have used the bus in every stolen cycle and arbitration overhead is ignored. This is the same product as burst mode, but it means something different. In cycle stealing, the loss is spread as separate one-cycle delays, and the total elapsed time is set by the device's word rate. In burst mode, the CPU is locked out for one continuous stretch.

FRACTION OF BUS CYCLES TAKEN BY CYCLE-STEALING DMA

= time of the one bus cycle stolen per word; = time between successive word transfers, i.e. the device's word period. This assumes the CPU would otherwise use the bus in every cycle, and .

Some questions give a time to prepare a word and a time to transfer it (). If the device cannot prepare the next word during the transfer, . If preparation overlaps the transfer, (assuming ). State which reading you use.

PERCENTAGE OF CPU TIME USED ON DMA SET-UP AND COMPLETION

= CPU time to program the DMAC for one block; = CPU time for the completion interrupt. This assumes the device transfers continuously, one block after another, and ignores the bus cycles DMA steals. Add the stolen-cycle fraction separately if the question asks for it.

Instruction pipelining and pipeline hazards

Read the notes

PIPELINE CLOCK PERIOD

is the delay of stage and is the inter-stage register (latch) delay, taken as 0 only if the question says so. The slowest stage sets the clock for every stage.

TOTAL TIME FOR N INSTRUCTIONS, K STAGES (NO STALLS)

The first instruction needs cycles to pass through all the stages (pipeline fill). After that, one instruction completes every cycle. Valid for an ideal pipeline with no stalls.

SPEED-UP OVER NON-PIPELINED EXECUTION (GENERAL)

is the time one instruction takes on the non-pipelined machine, as the question defines it: usually the sum of the stage delays. As , .

SPEED-UP, BALANCED STAGES (SPECIAL CASE)

Only when , i.e. all stages have equal delay and latch delay is ignored (or the non-pipelined machine is defined as taking pipelined cycles per instruction). Then as : the ideal maximum speed-up equals the number of stages.

THROUGHPUT

Instructions completed per unit time with no stalls. It approaches as .

PIPELINE EFFICIENCY

Efficiency is the fraction of stage-cycles that do useful work: busy stage-cycles out of . It is below 1 for any finite because of fill and drain, and it tends to 1 as . It equals only in the balanced-stage case, where .

AVERAGE CPI WITH STALLS

For a scalar in-order pipeline, . Here is the fraction of all instructions that suffer hazard type , and is the number of stall cycles it costs. The sum is the average number of stall cycles per instruction. This is the steady-state figure: pipeline fill cycles are ignored.

EXECUTION TIME FROM CPI

The standard performance equation. On the pipelined machine, .

SPEED-UP WITH STALLS

is the non-pipelined time per instruction. The second line holds only for balanced stages with no latch overhead. Both lines ignore fill cycles, so they describe a long program.

RAW STALLS WITHOUT FORWARDING (5-STAGE, SPLIT-CYCLE REGISTER FILE)

is the distance in program order: for the very next instruction. This assumes the register file is written in the first half of WB and read in the second half of ID, so a read in the same cycle as the write sees the new value. The consumer's ID must then fall no earlier than the producer's WB, so needs no stall. If the register file is not split-cycle (the read must come in a cycle after the write), the result becomes .

BRANCH PENALTY (PER TAKEN OR MISPREDICTED BRANCH)

is the number of the stage at whose end both the outcome and the target are known. The correct instruction is fetched in the next cycle. No delay slot or prediction is assumed. For example, resolving at the end of EX (stage 3) squashes the 2 instructions in IF and ID, a penalty of 2 cycles; resolving at the end of ID gives 1.

AVERAGE CPI CONTRIBUTION FROM BRANCHES

is the fraction of all instructions that are branches. is the fraction of those branches that pay the penalty: under predict-not-taken, the taken fraction; under a predictor, the mispredicted fraction. If the pipeline stalls on every branch regardless of outcome, .