---
title: Midterm exam
heading: "Midterm exam: combinational and sequential logic"
eyebrow: C7 · Midterm exam
type: problems
---

::: hook
Twelve problems from the first half of the course: logic levels and number systems, Boolean algebra and canonical forms, CMOS gates and power, Karnaugh maps, building blocks, arithmetic, number formats, flip-flops, timing and shift registers. Give yourself two hours, work without the lessons open, and write out your reasoning before checking each answer. Number truth-table rows from 0, with the first-listed input as the top bit. "Another set" deals a different exam.
:::

::: pool
pick: 12

::: check
kind: parts
given: VOH = 2.6 | 3.2; VIH = 2 | 2.3; VIL = 0.8 | 1; VOL = 0.1 | 0.4

## A logic family has $V_{OH}$ = {VOH}, $V_{IH}$ = {VIH}, $V_{IL}$ = {VIL} and $V_{OL}$ = {VOL} V.

::: part
answer: VOH - VIH
unit: V
tolerance: 0.5%

### What is the high noise margin?

::: misses
- [any] $V_{OH} - V_{IH}$.
:::
:::

::: part
answer: VIL - VOL
unit: V
tolerance: 0.5%

### What is the low noise margin?

::: misses
- [any] $V_{IL} - V_{OL}$.
:::
:::
:::

::: check
kind: parts
given: n = 140..250 int

## An 8-bit register holds {n:hex2} (hex).

::: part
answer: n
tolerance: 0

### What is its unsigned value?

::: misses
- [any] Convert from hex.
:::
:::

::: part
answer: n - 256
tolerance: 0

### What is its two's-complement value?

::: misses
- [any] Subtract 256.
:::
:::
:::

::: check
kind: boolean
vars: A, B, C
answer: A & ~B | B & C
ops: and, or, not

## Minimize $\sum m(3, 4, 5, 7)$.

::: misses
- [any] Two groups of two.
:::
:::

::: check
kind: boolean
vars: A, B, C, D
answer: ~B & ~D | ~A & B & D | A & C & ~D
dontcare: 12, 13
ops: and, or, not

## Minimize $\sum m(0, 2, 5, 7, 8, 10, 14) + d(12, 13)$.

::: misses
- [any] Start with the four corners.
:::
:::

::: check
kind: parts
given: n = 2 | 3 | 4; r = 2 | 2.5; a = 0.1 | 0.3; C = 1 | 10; V = 0.8 | 1.2; f = 1 | 3

## An {n}-input CMOS NOR is sized to match an inverter of NMOS width 1 and PMOS width {r}; it drives {C} fF switching with α = {a} at {f} GHz on {V} V.

::: part
answer: r*n
tolerance: 0.5%

### How wide is each PMOS?

::: misses
- [any] n in series.
:::
:::

::: part
answer: a*C*V^2*f
unit: µW
tolerance: 0.5%

### What dynamic power does its output node take?

::: misses
- [any] $\alpha CV^2f$.
:::
:::
:::

::: check
kind: boolean
vars: A, B, C
answer: B & C | ~B & A
ops: and, or, not

## Write the function computed by a 2:1 multiplexer that outputs C when B = 1 and A when B = 0.

::: misses
- [any] One term for each value of B.
:::
:::

::: check
kind: boolean
vars: A1, A0, B1, B0
answer: A1 & ~B1 | ~(A1 ^ B1) & A0 & ~B0
ops: and, or, not, xor

## Write A > B for 2-bit numbers.

::: misses
- [any] Top bits first.
:::
:::

::: check
kind: parts
given: a = 40 | 90; b = 60 | 100

## Two 8-bit two's-complement numbers {a} and {b} are added.

::: part
answer: a + b - 256*step(a + b - 127.5)
tolerance: 0

### What value does the result represent?

::: misses
- [any] Wrap if the sum exceeds 127.
:::
:::

::: part
answer: step(a + b - 127.5)
tolerance: 0

### Is the overflow flag set (1 or 0)?

::: misses
- [any] Two positives giving a negative.
:::
:::
:::

::: check
kind: parts
given: n = 8 | 32; tc = 2 | 3; G1 = 0 | 1; P1 = 0 | 1; G0 = 1 | 0

## A ripple adder's carry takes {tc} gate delays per bit; separately, a lookahead stage has $G_1$ = {G1}, $P_1$ = {P1}, $G_0$ = {G0}, $P_0$ = 1 and $C_0$ = 1.

::: part
answer: n*tc
tolerance: 0

### What is the {n}-bit ripple adder's worst carry delay?

::: misses
- [any] n stages.
:::
:::

::: part
answer: step(G1 + P1*G0 + P1*1*1 - 0.5)
tolerance: 0

### What is $C_2$?

::: misses
- [any] $G_1 + P_1G_0 + P_1P_0C_0$.
:::
:::
:::

::: check
kind: parts
given: e = 125 | 128 | 131; f = 0.25 | 0.5

## An IEEE 754 single has sign 1, exponent field {e} and fraction {f}.

::: part
answer: -(1 + f)*2^(e - 127)
tolerance: 0.1%

### What value does it represent?

::: misses
- [any] $(-1)^s \times 1.f \times 2^{e - 127}$.
:::
:::

::: part
answer: e - 127
tolerance: 0

### What is its unbiased exponent?

::: misses
- [any] Subtract 127.
:::
:::
:::

::: check
kind: parts
given: tpcq = 50 | 80; tpd = 400 | 900; ts = 30 | 60; tccq = 20 | 30; tcd = 0 | 40; th = 25 | 50

## A path has $t_{pcq}$ = {tpcq}, $t_{pd}$ = {tpd}, $t_\text{setup}$ = {ts}, $t_{ccq}$ = {tccq}, $t_{cd}$ = {tcd} and $t_\text{hold}$ = {th} ps.

::: part
answer: 1e3/(tpcq + tpd + ts)
unit: GHz
tolerance: 0.5%

### What is the highest clock frequency?

::: misses
- [any] $1/(t_{pcq} + t_{pd} + t_\text{setup})$.
:::
:::

::: part
answer: tccq + tcd - th
unit: ps
tolerance: 0.5%

### What is the hold margin (no skew)?

::: misses
- [any] $t_{ccq} + t_{cd} - t_\text{hold}$.
:::
:::
:::

::: check
kind: parts
given: N = 5 | 12 | 100; f = 8 | 25

## A modulo-{N} binary counter divides a {f} MHz clock.

::: part
answer: ceil(log(N)/log(2))
tolerance: 0.5%

### How many flip-flops?

::: misses
- [any] $\lceil\log_2 N\rceil$.
:::
:::

::: part
answer: f*1000/N
unit: kHz
tolerance: 0.5%

### What output frequency?

::: misses
- [any] $f/N$.
:::
:::
:::

::: check
kind: parts
given: n = 6 | 12 | 32; L = 100 | 1000; f = 1 | 10

## An {n}-bit maximal LFSR is clocked at {f} MHz.

::: part
answer: 2^n - 1
tolerance: 0

### How many states does it cycle through?

::: misses
- [any] $2^n - 1$.
:::
:::

::: part
answer: (2^n - 1)/(f*1e6)
unit: s
tolerance: 0.5%

### How long before its sequence repeats?

::: misses
- [any] States over clock rate.
:::
:::
:::

::: check
kind: parts
given: x = -24 | -72 | -120; k = 1 | 3; q = 4 | 6; v = 37 | 150

## Shifts and fixed point.

::: part
answer: floor(x/2^k)
tolerance: 0

### What value does {x} have after an arithmetic right shift by {k}?

::: misses
- [any] Copy the sign bit in: floor division.
:::
:::

::: part
answer: v/2^q
tolerance: 0.1%

### A Q format with {q} fraction bits stores {v}. What value is that?

::: misses
- [any] $v/2^q$.
:::
:::
:::

::: check
kind: boolean
vars: A, B, C, D
answer: ~C | ~A & ~D | B & ~D
ops: and, or, not

## Minimize $\sum m(0, 1, 2, 4, 5, 6, 8, 9, 12, 13, 14)$ (A the top bit).

::: right
Right: $\bar C + \bar A\bar D + B\bar D$.
:::

::: misses
- [any] Not yet. Start with every cell where C = 0.
:::
:::

::: check
kind: parts
given: P = 0.05 | 0.1; D = 0.5 | 1; S = 0.04 | 0.08; Q = 0.03 | 0.06; C = 0.03 | 0.12; H = 0.02 | 0.05; K = 0.05 | 0.1

## A register pair has $t_{pcq}$ = {P} ns, setup {S} ns, $t_{ccq}$ = {Q} ns and hold {H} ns, with logic of {D} ns (long) and {C} ns (short); the capture clock is {K} ns late.

::: part
answer: P + D + S - K
unit: ns
tolerance: 0.5%

### What's the minimum period?

::: misses
- [any] $t_{pcq} + t_{pd} + t_\text{setup} - t_\text{skew}$.
:::
:::

::: part
answer: Q + C - H - K
unit: ns
tolerance: 1%

### What's the hold slack?

::: misses
- [any] $t_{ccq} + t_{cd} - t_\text{hold} - t_\text{skew}$.
:::
:::
:::
:::
