Salta al contenuto
Note per Studenti Combinational Design - Hierarchy and NAND-NOR Mapping Report

Combinational Design - Hierarchy and NAND-NOR Mapping

In questa pagina 6

Gates, Boolean algebra and Karnaugh maps are the tools; here they are used to design a circuit from specification to logic diagram.

Combinational and sequential

  • A circuit is combinational if its outputs depend only on the present input values, not on past ones. It has no memory; it is made of interconnected gates without feedback paths (acyclic).
  • A circuit is sequential if its outputs depend on present inputs and on their history (the state). It contains combinational blocks and memory elements, with at least one feedback path bringing the state back to the input.

A half adder with inputs (1,1)(1,1) always gives S=0S=0, C=1C=1 (combinational); a counter with the same input may give different outputs depending on its state. A system with inputs (A,B)=(0,1),(1,1),(1,1)(A,B)=(0,1),(1,1),(1,1) and outputs Y=0,1,0Y=0,1,0 is certainly sequential: the same input (1,1)(1,1) was answered first with 11 and then 00. The converse does not hold: a sequence compatible with a function does not prove the system combinational.

Design procedure

  1. Specification: identify and name inputs and outputs.
  2. Truth table linking inputs and outputs.
  3. Minimum-cost Boolean function for each output (Karnaugh Maps and Two-Level MinimizationA Karnaugh map is the truth table arranged in a grid with rows and columns in Gray code, so that adjacent cells (also across opposite edges) differ in one variable. Groups of 2^k ones eliminate k variables and give a product. A prime implicant is a maximal group, an essential one is the only cover of some minterm; the minimum cover has all essentials plus few other primes. For POS, group the zeros. Don't cares may be used as 1 or 0. XOR functions have a checkerboard map and do not simplify.Karnaugh Maps and Two-Level Minimization →, algebra).
  4. Logic diagram with blocks available in the chosen technology.
  5. Verification (table or simulation).

Hierarchical approach

With 8 inputs the table has 28=2562^8=256 rows: too many for maps. In the hierarchical approach (loosely "divide and conquer") the system is split into blocks and sub-blocks, recursively, until each is simple enough to design alone; blocks are then connected, reusing identical ones.

Example: 4-bit equality comparator

Inputs A=A3A2A1A0A=A_3A_2A_1A_0, B=B3B2B1B0B=B_3B_2B_1B_0; output E=1E=1 iff A=BA=B, i.e. Ai=BiA_i=B_i for all ii.

  1. First level: four 1-bit comparators Ni=Ai⊕BiN_i=A_i\oplus B_i (00 if equal) and a block combining the four NiN_i.
  2. Second level: the 1-bit comparator is an XOR; the final block must give E=1E=1 only if all NiN_i are 0: a 4-input NOR, E=N0+N1+N2+N3‾E=\overline{N_0+N_1+N_2+N_3}.

Check: A=B=1010⇒N=0000⇒E=1A=B=1010\Rightarrow N=0000\Rightarrow E=1; A=1010A=1010, B=1011⇒N=0001⇒E=0B=1011\Rightarrow N=0001\Rightarrow E=0. Gate input cost: 4×24\times2 (XOR) +4+4 (NOR) =12=12.

The tree representation shows the structure only (system, blocks, gates). A block used several times is drawn once ("regular circuits"): the more regular the circuit, the less design work. The ratio between the number of gates in the final circuit and the number of blocks in the hierarchical diagram measures regularity.

Elementary combinational blocks

One-variable functions. Value-fixing (F=0F=0 or F=1F=1), value-transferring (F=XF=X, a wire), value-inverting (F=X‾F=\overline X, an inverter).

Vectors. An nn-bit input is drawn as a line with a slash and the number of bits; single bits are indicated by index, X(2)X(2).

Enabling. An enabling circuit lets the signal XX through if the enable EN is 1, otherwise forces the output to a fixed value: F=X⋅ENF=X\cdot EN (EN =0⇒F=0=0\Rightarrow F=0) or F=X+EN‾F=X+\overline{EN} (EN =0⇒F=1=0\Rightarrow F=1).

Car controls: lights, radio and windows work only with the car on; the ignition signal IS enables the three switches LS,RS,WSLS,RS,WS: L=IS⋅LSL=IS\cdot LS, R=IS⋅RSR=IS\cdot RS, W=IS⋅WSW=IS\cdot WS. With IS=0IS=0 all outputs are 0 whatever the switches (truth-table rows with IS=0IS=0 have X for the switch inputs: multi-minterm rows).

The most important blocks, decoders, encoders and multiplexers, are in Decoders, Encoders and MultiplexersAn n-to-m decoder converts a binary input into a one-hot output whose lines are the minterms of the inputs (m AND gates; hierarchical construction lowers the input cost; enable). Any function equals a decoder plus an OR of its minterms. The encoder does the inverse but fails with several or no active inputs; the priority encoder fixes it with a priority and a valid output V. A 2^n-to-1 multiplexer computes Y = sum of m_i(S) I_i and implements any n-variable function; a smaller MUX uses the last variable (0, 1, X, not X) as data.Decoders, Encoders and Multiplexers →; arithmetic blocks in Binary Adders and SubtractorsHalf adder: S = X xor Y, C = XY. Full adder with carry in Z: S = X xor Y xor Z, C = XY + XZ + YZ = G + PZ with P = X xor Y, G = XY; two half adders and an OR. The n-bit ripple carry adder chains n full adders, so delay grows linearly with n. Adder-subtractor: XOR of each B bit with a control S, which is also the carry in, computes A+B or A+not B+1 = A-B. The 2-bit multiplier uses 4 ANDs and 2 half adders.Binary Adders and Subtractors →.

Technology mapping: NAND and NOR

Technology mapping replaces the logic diagram with one using the components available in the technology. In CMOS (CMOS Gates and Technology ParametersIn CMOS integrated circuits MOSFETs are modelled as switches: nMOS closed when the gate is 1, pMOS closed when the gate is 0. A static gate has a pull-up network (only pMOS, to Vdd) and a dual pull-down network (only nMOS, to ground): one is ON and the other OFF. NAND has series nMOS and parallel pMOS, NOR the opposite; an n-input gate has 2n transistors. Real-gate parameters: fan-in, fan-out, noise margin, propagation delay, power dissipation and cost.CMOS Gates and Technology Parameters →) NAND and NOR are more compact and faster than AND and OR, so circuits are usually built with NAND, NOR and inverters.

SOP to NAND-NAND. By double negation and De Morgan F=P1+P2+⋯+Pk=P1‾⋅P2‾⋯Pk‾‾.F=P_1+P_2+\dots+P_k=\overline{\overline{P_1}\cdot\overline{P_2}\cdots\overline{P_k}}. Each Pi‾\overline{P_i} is the output of a NAND with the inputs of the product; the outer part is a kk-input NAND.

F=AB+CD‾+A‾C=AB‾⋅CD‾‾⋅A‾C‾‾F=AB+C\overline D+\overline AC=\overline{\overline{AB}\cdot\overline{C\overline D}\cdot\overline{\overline AC}}: three 2-input NANDs and one 3-input NAND (plus inverters for D‾\overline D and A‾\overline A). A product with a single literal needs an inverter in place of the NAND. F=AB+C=AB‾⋅C‾‾F=AB+C=\overline{\overline{AB}\cdot\overline C}: a NAND for ABAB, an inverter for CC, a final 2-input NAND.

POS to NOR-NOR. Dually F=S1S2⋯Sk=S1‾+S2‾+⋯+Sk‾‾F=S_1S_2\cdots S_k=\overline{\overline{S_1}+\overline{S_2}+\dots+\overline{S_k}}: a NOR per sum and a final NOR.

F=(A+B‾)(C+D)(A‾+D‾)F=(A+\overline B)(C+D)(\overline A+\overline D): three 2-input NORs and one 3-input NOR. F=(A+B)(C+D)=A+B‾+C+D‾‾F=(A+B)(C+D)=\overline{\overline{A+B}+\overline{C+D}}: three 2-input NORs.

So NAND realizations suit SOPs and NOR ones POSs. Case by case, compare cost (gates, inputs) and delay. A very deep circuit is slower.

Common mistakes

  • Calling a system combinational because a short sequence looks so.
  • Forgetting the inverters for negated variables in NAND-NAND mapping.
  • Using NAND-NAND for a POS (or NOR-NOR for a SOP) without converting the form first.
  • Underestimating delays: deeper means slower.

Versione ripasso

  • Combinational: outputs depend only on present inputs; no memory, no feedback (acyclic). Sequential: also depends on state; memory and feedback. Same input giving different outputs at different times means sequential.
  • Design flow: specification, truth table, minimum-cost function, logic diagram, verification.
  • Hierarchical approach: split into blocks and sub-blocks; reuse identical blocks (regularity).
  • 4-bit equality comparator: Ni=Ai⊕BiN_i=A_i\oplus B_i, E=N0+N1+N2+N3‾E=\overline{N_0+N_1+N_2+N_3} (4-input NOR). A=1010,B=1011⇒N=0001A=1010,B=1011\Rightarrow N=0001, E=0E=0. Cost 4⋅2+4=124\cdot2+4=12.
  • One-variable functions: value-fixing, value-transferring, value-inverting.
  • Enabling: F=X⋅ENF=X\cdot EN or F=X+EN‾F=X+\overline{EN}; car: L=IS⋅LSL=IS\cdot LS, R=IS⋅RSR=IS\cdot RS, W=IS⋅WSW=IS\cdot WS.
  • CMOS mapping: NAND/NOR are more compact and faster than AND/OR.
  • SOP to NAND-NAND: F=P1‾⋯Pk‾‾F=\overline{\overline{P_1}\cdots\overline{P_k}}, one NAND per product plus a final kk-input NAND; AB+CD‾+A‾CAB+C\overline D+\overline AC: three 2-input and one 3-input NAND plus inverters; single literal needs an inverter.
  • POS to NOR-NOR: F=S1‾+⋯+Sk‾‾F=\overline{\overline{S_1}+\dots+\overline{S_k}}; (A+B)(C+D)=A+B‾+C+D‾‾(A+B)(C+D)=\overline{\overline{A+B}+\overline{C+D}}.
  • Mistakes: inverters forgotten; NAND-NAND used on a POS unconverted; delays ignored; short sequence taken as proof of combinational.

Teoria collegata