Section 2 · Revision
Digital Logic formula sheet
Laws, counts, circuit equations, timing rules and number formats for Digital Logic on one printable page.
Boolean algebra and minimization
Laws to apply on sight
| Law | Form |
|---|---|
| Absorption | , |
| Redundant literal | , |
| Distributive (OR over AND) | |
| Consensus | |
| Consensus (POS) | |
| De Morgan | , |
| XOR | , , |
| XOR with AND | , |
| Dual | swap and , keep literals |
- Complement of : take the dual and complement every literal.
- Dual of over variables: minterms for every .
Standard counts ( variables)
| Quantity | Count |
|---|---|
| Boolean functions | |
| Self-dual functions | |
| Symmetric functions | |
| Functions with rows fixed | |
| Neutral functions (equal 0s and 1s) | |
| Minterms covered by a -literal product | |
| Minterms of XOR of variables |
K-map and tabular method
- Adjacent cells differ in one bit. Gray order: 00, 01, 11, 10. Edges wrap.
- Groups have cells; a group of drops variables.
- Prime implicant (PI): group that cannot grow. Essential PI: the only PI covering some 1-cell.
- Procedure: take all EPIs, then cover the rest with the fewest PIs. Don't cares may be used, never required.
- Cyclic function: no EPI, several minimal covers (for example , 6 PIs, 2 minimal SOPs).
- Quine-McCluskey: group minterms by number of 1s; merge terms in adjacent groups that differ in one bit and have dashes in the same places; tick merged terms; unticked terms are PIs; then build the PI chart.
- PI chart reduction: row with one X marks an EPI; drop dominated rows; drop dominating columns.
- POS: group the 0s, write the result as a product of sums.
Functional completeness (Post): a set is complete iff, for each of the 5 classes, some member lies outside it: 0-preserving, 1-preserving, self-dual, monotone, linear (XOR-based).
- Complete alone: NAND, NOR, , , .
- Not complete: , , alone.
Combinational circuits
Adders and subtractors
| Block | Outputs |
|---|---|
| Half adder | , |
| Full adder | , |
| Half subtractor | , borrow |
| Full subtractor | , borrow |
| Adder-subtractor | into each stage, |
- Ripple-carry, bits: carry ready after ; last sum at .
- Carry lookahead: , , , .
- ; all carries in 2 gate levels after P/G, independent of (fan-in grows).
- Blocks of CLA chained in ripple: time P/G time + (number of blocks) block carry delay + final sum delay.
Multiplexers and decoders
- -to-1 mux: select lines. Realises any -variable function with one variable (and its complement) on the data lines.
- Residue rule: for each select value, the data input is , , or .
- Mux tree from -to-1 units for inputs: in level 1, then divide by (round up) per level until 1. Example: 32-to-1 from 4-to-1 needs .
- -to- decoder: each output is one minterm. OR of chosen outputs gives ; NOR of the rest gives the same .
- Active-low outputs: NAND of chosen lines gives , AND gives .
- Bigger decoder: 6-to-64 from 3-to-8 with enable needs .
- Priority encoder: highest-priority active input wins; valid bit = OR of inputs.
Codes, comparators, parity
| Item | Rule |
|---|---|
| Binary to Gray | , |
| Gray to binary | , |
| Equality (bit) | , AND over all bits |
| (2-bit) | |
| Parity of bits | two-input XOR gates |
| multiplier | , , , |
Gate counts (2-input, uncomplemented inputs): XOR = 4 NAND or 5 NOR; XNOR = 5 NAND or 4 NOR; NOT = 1 NAND; AND = 2 NAND; OR = 3 NAND.
Hazards
- Static-1 hazard in SOP: two adjacent 1-cells not inside a common product term.
- Fix: add the consensus term of each such pair. Hazard-free SOP covers every adjacent pair of 1s.
- Static-0 hazard is the POS dual. Two-level SOP has no static-0 hazard for single input changes.
Sequential circuits
Flip-flops
| FF | Characteristic | Excitation (: 00, 01, 10, 11) |
|---|---|---|
| SR | , | , , , |
| JK | , , , | |
| D | , , , | |
| T | , , , |
- Conversions: D from SR: , . T from JK: . T from D: . D from JK: , .
- NOR latch: is forbidden (); releasing both together races.
- Latch is level-sensitive; flip-flop is edge-triggered. JK master-slave avoids race-around.
Counters
| Counter | States with FFs | Notes |
|---|---|---|
| Binary (ripple or sync) | mod- needs FFs | |
| Ring | one 1 circulates; unused | |
| Johnson | ; unused | |
| LFSR (max length) | all-zero state locks |
- Ripple counter settle time , so . Sync counter: .
- Ripple outputs pass through false states (011 to 100 shows 010, 000).
- MSB of a mod- counter: frequency ; a T flip-flop divides by 2.
- Asynchronous clear at state : modulus . Synchronous clear decoded at state : modulus . Same decode used synchronously gives one more state.
- Self-starting check: trace every unused state until it enters the main cycle.
Timing ( = capture clock arrives later than launch)
| Check | Condition |
|---|---|
| Setup | |
| Hold |
- Hold does not involve : fix it by adding delay to the short path, never by changing the clock.
- .
State machines
- Moore: output from state; Mealy: from state and input. Moore often needs 1 more state.
- Sequence detector for a pattern of length : usually Mealy states and Moore states.
- Counting machines: tracking (count mod , count mod ) needs states when the output depends on both.
- State minimisation: split by output, then refine by next-state blocks until stable; states left in one block are equivalent.
Number representation and arithmetic
Integer ranges, bits
| Format | Range | Zeros |
|---|---|---|
| Unsigned | to | 1 |
| Sign-magnitude | to | 2 |
| 1's complement | to | 2 |
| 2's complement | to | 1 |
- 2's complement value: . Negate: invert and add 1.
- Sign extension copies the MSB. Arithmetic right shift rounds toward .
- Base conversion: group 3 bits for octal, 4 for hex. Fractions: multiply by the base, take integer parts.
- Unknown base: expand both sides as polynomials in , solve, check every digit is less than .
Overflow (2's complement)
- Addition: (sign bits).
- Opposite-sign operands never overflow on addition.
- Subtraction : overflow iff signs of and differ and the result sign differs from .
- Unsigned overflow: on add; on subtract via .
Booth recoding
| Radix-2 | Action | Radix-4 | Digit |
|---|---|---|---|
| 00 / 11 | none | 000 / 111 | |
| 10 | 001 / 010 | ||
| 01 | 011 | ||
| 100 | |||
| 101 / 110 |
- Append . Radix-2 operations = number of bit changes in . Radix-4 gives digits.
Codes
| Code | Rule |
|---|---|
| BCD | each decimal digit in 4 bits; nibbles 1010 to 1111 invalid |
| BCD add | add binary per digit; if sum > 9 or carry out, add 0110 |
| Excess-3 | digit stored as ; self-complementing |
| Gray | consecutive values differ in one bit |
Fixed point: -bit 2's complement with fraction bits: value = integer , step , range to . Product of formats with and fraction bits has fraction bits.
IEEE 754: value for .
| Item | Single | Double |
|---|---|---|
| Sign / exponent / fraction bits | 1 / 8 / 23 | 1 / 11 / 52 |
| Bias | 127 | 1023 |
| Smallest normal | ||
| Smallest subnormal | ||
| Largest finite | ||
| Gap above 1 (epsilon) | ||
| Values in |
| Exponent field | Fraction | Meaning |
|---|---|---|
| all 0 | 0 | (+0 = -0 when compared) |
| all 0 | nonzero | subnormal |
| all 1 | 0 | |
| all 1 | nonzero | NaN (NaN NaN) |
- Custom format with exponent bits and fraction bits: bias , largest , smallest subnormal .
- Exactly representable: with enough fraction bits (, never are). Integers up to in single.
- Encode: write , store . Hex shortcuts: 1.0 is 3F800000, 2.0 is 40000000, is 7F800000.
- Round to nearest, ties to even; spacing at exponent is .