GATE GUIDE

GATE CSE COA Formula Sheet: Cache, Pipelining, IEEE 754, Addressing

By MD ANISH AHAMADUpdated 4 Oct 20267 min read
GATE CSE COA Formula Sheet: Cache, Pipelining, IEEE 754, Addressing

Computer Organization and Architecture is the most numerical core subject in GATE CSE, and most of its marks come from four formula families: cache mapping, memory access time, pipelining and number formats. This sheet goes deeper than the general GATE CSE formula sheet. Each formula is shown with a one-line worked example and the trap that costs marks.

In this guide
  1. Key takeaways
  2. The terms this sheet uses
  3. Cache mapping: tag, index and offset
  4. Average memory access time across levels
  5. Pipelining: cycle time, total time and speedup
  6. IEEE 754: decoding and the special values
  7. Addressing modes and instruction encoding
  8. Quick revision

Key takeaways

The terms this sheet uses

Here log⁡\log means log⁡2\log_2, and KB means 2102^{10} bytes.

Cache mapping: tag, index and offset

Work from the block outwards. The offset must address every byte of a block, the index must address every set, and the tag covers what is left.

Formula One-line example Watch out for
offset=log⁡2B\text{offset} = \log_2 B 32 B blocks: 5 bits Counts words if the memory is word-addressable
sets=Ck×B\displaystyle \text{sets} = \dfrac{C}{k \times B} 64 KB, 4-way, 32 B: 2164×32=512\displaystyle \dfrac{2^{16}}{4 \times 32} = 512 Fully associative has one set; direct-mapped has k=1k = 1
index=log⁡2(sets)\text{index} = \log_2(\text{sets}) log⁡2512=9\log_2 512 = 9 bits Fully associative: index =0= 0
tag=A−index−offset\text{tag} = A - \text{index} - \text{offset} 32-bit address: 32−9−5=1832 - 9 - 5 = 18 bits Use the address width, not the memory size in bytes
Block jj goes to set j mod setsj \bmod \text{sets} Block 1000 to set 1000 mod 512=4881000 \bmod 512 = 488 Mod the number of sets, not lines
Tag directory == lines ×\times (tag ++ valid ++ dirty ++ LRU) 2048×(18+1+1+2)=450562048 \times (18 + 1 + 1 + 2) = 45056 bits =5.5= 5.5 KB Dirty bit only for write-back

Remember: Doubling the associativity with the size and block fixed halves the sets, so the index loses one bit and the tag gains one. The offset never changes. The cache memory question guide traces hits and misses with these splits.

Average memory access time across levels

The time you always pay is the L1 time. You add the L2 time only when L1 misses, and the memory time only when L2 misses as well:

AMAT=t1+m1(t2+m2 (t3+m3 tmem))\text{AMAT} = t_1 + m_1\big(t_2 + m_2\,(t_3 + m_3\,t_{\text{mem}})\big)

Here tit_i is the access time of level ii and mim_i is its local miss rate.

Worked example. With t1=1t_1 = 1 ns, m1=0.1m_1 = 0.1, t2=10t_2 = 10 ns, m2=0.2m_2 = 0.2 and tmem=100t_{\text{mem}} = 100 ns for two levels:

AMAT=1+0.1 (10+0.2×100)=1+0.1×30=4 ns\text{AMAT} = 1 + 0.1\,(10 + 0.2 \times 100) = 1 + 0.1 \times 30 = 4\text{ ns}

The global miss rate of L2 is m1×m2=0.02m_1 \times m_2 = 0.02.

Formula One-line example Watch out for
Global miss rate =m1×m2×⋯= m_1 \times m_2 \times \cdots 0.1×0.2=0.020.1 \times 0.2 = 0.02 A local rate is per access reaching that level
Misses per instruction == miss rate ×\times accesses per instruction 0.02×1.4=0.0280.02 \times 1.4 = 0.028 Accesses include the instruction fetch
Parallel model: h1t1+(1−h1) h2t2+⋯h_1 t_1 + (1 - h_1)\,h_2 t_2 + \cdots Use only when the question says so "Miss penalty" may already include the check time

Trap: Adding the L2 hit time on every access treats a hierarchical cache as if L2 were always checked. In the hierarchical model the lower level is reached only on a miss.

Pipelining: cycle time, total time and speedup

The clock must wait for the slowest stage and the latch after it. The first instruction then takes kk cycles and each later one adds a single cycle:

τ=max⁡i(stagei)+tlatch,Tpipe=(k+n−1) τ,Tnon-pipe=n∑istagei\tau = \max_i(\text{stage}_i) + t_{\text{latch}}, \qquad T_{\text{pipe}} = (k + n - 1)\,\tau, \qquad T_{\text{non-pipe}} = n \sum_i \text{stage}_i

Worked example. Stages of 4, 6, 9 and 5 ns with a 1 ns latch give τ=10\tau = 10 ns. For 100 instructions, Tpipe=(4+99)×10=1030T_{\text{pipe}} = (4 + 99) \times 10 = 1030 ns and Tnon-pipe=100×24=2400T_{\text{non-pipe}} = 100 \times 24 = 2400 ns. The speedup is 2400/1030≈2.332400 / 1030 \approx 2.33.

Formula One-line example Watch out for
Speedup =Tnon-pipe/Tpipe= T_{\text{non-pipe}} / T_{\text{pipe}}; limit =∑stagei/τ= \sum \text{stage}_i / \tau Limit =24/10=2.4= 24/10 = 2.4 Equals kk only for equal stages and zero latch
Split the slowest stage: new τ=max⁡(rest,larger half)+tlatch\tau = \max(\text{rest}, \text{larger half}) + t_{\text{latch}} Split 9 into 4.5 and 4.5: τ=6+1=7\tau = 6 + 1 = 7 ns kk rises by one, which matters for finite nn
Total cycles =n+k−1+stalls= n + k - 1 + \text{stalls} 5 stages, 6 instructions, 2 stalls: 12 Load-use leaves 1 stall even with forwarding
CPI=1+fb (1−p)×penalty\text{CPI} = 1 + f_b\,(1 - p) \times \text{penalty} 1+0.2×0.1×2=1.041 + 0.2 \times 0.1 \times 2 = 1.04 Penalty is resolution stage minus 1
Time=IC×CPI/f\text{Time} = \text{IC} \times \text{CPI} / f 109×1.04/2 GHz=0.5210^9 \times 1.04 / 2\text{ GHz} = 0.52 s GHz versus ns

Trap: The non-pipelined time has no latch delay, and the pipelined time is never k×nk \times n cycles. The pipelining question guide works through hazard timing diagrams.

The book's last-minute revision sheet carries the complete table for this subject, including DMA, microprogrammed control, memory interfacing and DRAM refresh, each with symbols, when it applies and its trap. It is part of the GATE CSE 2027 book.

IEEE 754: decoding and the special values

A single-precision number stores a sign bit SS, an 8-bit exponent field EE and a 23-bit fraction FF. For a normalised value the hardware adds an implicit leading 1:

value=(−1)S×1.F×2E−127,1≤E≤254\text{value} = (-1)^{S} \times 1.F \times 2^{E - 127}, \qquad 1 \le E \le 254

Worked example. Decode 0x40A00000. In binary the first bits are 0 10000001 0100..., so S=0S = 0, E=129E = 129 and F=0.012F = 0.01_2. The value is 1.012×22=1012=51.01_2 \times 2^{2} = 101_2 = 5.

Case Rule Watch out for
E=0E = 0, F=0F = 0 ±0\pm 0 Two zeros exist
E=0E = 0, F≠0F \ne 0 Denormal: (−1)S×0.F×2−126(-1)^{S} \times 0.F \times 2^{-126} No implicit 1, exponent −126-126 not −127-127
E=255E = 255 ±∞\pm\infty if F=0F = 0, NaN otherwise All-ones exponent is reserved
Extremes Smallest normal 2−1262^{-126}; smallest denormal 2−1492^{-149}; largest (2−2−23)×2127(2 - 2^{-23}) \times 2^{127} Largest is about 3.4×10383.4 \times 10^{38}
Integers Every integer up to 2242^{24} is exact (2532^{53} in double) Double is 1, 11, 52 bits with bias 1023

For a custom format with ee exponent bits, ff fraction bits and bias bb, the largest value is (2−2−f)×2(2e−2)−b(2 - 2^{-f}) \times 2^{(2^{e} - 2) - b} when the all-ones exponent is reserved.

Trap: Split a hex pattern into 1, 8 and 23 bits before reading it, because hex digits straddle the field boundaries. Using bias 128 is the classic wrong answer. The number-representation side is covered in the digital logic important topics guide.

Addressing modes and instruction encoding

The addressing mode says where an operand lives. Count memory accesses by asking how many times the hardware must read memory to reach it.

Mode Effective address Operand memory accesses
Immediate Operand is in the instruction 0
Register / register indirect Operand in RR / EA=R\text{EA} = R 0 / 1
Direct / memory indirect EA=A\text{EA} = A / EA=M[A]\text{EA} = M[A] 1 / 2
Indexed or displacement EA=A+R\text{EA} = A + R 1
PC-relative EA=PCnext+offset\text{EA} = \text{PC}_{\text{next}} + \text{offset} 1
Formula One-line example Watch out for
Target =PCnext+offset×size= \text{PC}_{\text{next}} + \text{offset} \times \text{size} Branch at 2000, 4 B instructions, offset −3-3: 2004−12=19922004 - 12 = 1992 Offset is from the next instruction
Address lines =log⁡2(addressable units)= \log_2(\text{addressable units}) 4 GB with 2-byte words: log⁡2231=31\log_2 2^{31} = 31 Not 32 for word-addressable memory
Chips =capacitychip capacity×widthchip width\displaystyle = \dfrac{\text{capacity}}{\text{chip capacity}} \times \dfrac{\text{width}}{\text{chip width}} 8K×168\text{K} \times 16 from 2K×82\text{K} \times 8: 4×2=84 \times 2 = 8 Width ratio as well as depth ratio
Signed immediate of ww bits: −2w−1-2^{w-1} to 2w−1−12^{w-1} - 1 w=8w = 8: −128-128 to 127127 Unsigned is 00 to 2w−12^{w} - 1

The COA important topics guide explains which of these families past papers have asked most.

More formula sheets: all of GATE CSE · Computer Networks · Engineering Mathematics · Operating Systems

Quick revision

  1. offset=log⁡2B\text{offset} = \log_2 B, sets=C/(kB)\text{sets} = C/(kB), tag=A−index−offset\text{tag} = A - \text{index} - \text{offset}.
  2. Block jj maps to set j mod setsj \bmod \text{sets}.
  3. AMAT=t1+m1(t2+m2 tmem)\text{AMAT} = t_1 + m_1(t_2 + m_2\,t_{\text{mem}}) with local miss rates.
  4. τ=max⁡(stage)+tlatch\tau = \max(\text{stage}) + t_{\text{latch}}; T=(k+n−1)τT = (k + n - 1)\tau; non-pipelined time has no latch.
  5. Branch CPI=1+fb(1−p)×penalty\text{CPI} = 1 + f_b(1 - p) \times \text{penalty}.
  6. IEEE 754 single: 1, 8, 23 bits, bias 127, implicit 1; double: 1, 11, 52 bits, bias 1023.
  7. PC-relative target =PCnext+offset×size= \text{PC}_{\text{next}} + \text{offset} \times \text{size}.

Frequently asked questions

How do I calculate tag, index and offset bits for a cache?

Offset bits are the base-2 log of the block size in bytes. The number of sets is cache size divided by associativity times block size, and index bits are the log of the number of sets. Tag bits are whatever is left of the address. A fully associative cache has no index bits, and a direct-mapped cache has associativity one.

What is the formula for pipeline execution time in GATE?

The cycle time τ\tau is the largest stage delay plus the latch delay. A k-stage pipeline runs n instructions in (k+n−1)τ(k + n - 1)\tau, never k×nk \times n cycles. The non-pipelined time is n times the sum of the stage delays, with no latch delay. Stall cycles from hazards are added on top of k+n−1k + n - 1.

What is the bias in IEEE 754 single precision?

The bias is 127 for single precision, which has 1 sign bit, 8 exponent bits and 23 fraction bits. Double precision has 11 exponent bits, 52 fraction bits and bias 1023. A normalised value is the implicit 1 followed by the fraction, times 2 raised to the stored exponent minus the bias. Using 128 as the bias is a common mistake.

How is AMAT calculated for a two-level cache?

In the hierarchical model you always pay the L1 time, add the L2 time only on an L1 miss, and add the memory time only on an L2 miss. With local miss rates, AMAT equals t1 plus m1 times (t2 plus m2 times the memory time). GATE questions usually intend this model unless they state that the levels are searched in parallel.

Where is a PC-relative branch offset measured from?

From the address of the next instruction, because the program counter has already been incremented when the branch executes. The target is the next-instruction address plus the offset times the instruction size, unless the question says the offset is already in bytes. Measuring from the branch instruction itself is a common trap in past papers.

Sources

Dates, fees and the syllabus are set by the GATE 2027 organising institute and can change. Always confirm at gate2027.iitm.ac.in.

Keep reading

GATE CSE 2027 book1,020 pages · ₹250 ₹300
Buy now — ₹250