Digital Logic
Deep Understanding: 85 hours
Community
Digital Logic
2081 Boards
Section A
Answer any two questions.
Differentiation between Synchronous and Asynchronous Counters
| Feature | Asynchronous (Ripple) Counter | Synchronous Counter |
|---|---|---|
| Clocking | Flip-flops are clocked by the output of the preceding flip-flop. | All flip-flops are clocked simultaneously by a common clock signal. |
| Propagation Delay | Delay accumulates from one flip-flop to the next (ripple effect). | Delay is minimal, primarily due to combinational logic. |
| Speed | Slower, especially for higher bit counts, due to accumulated delay. | Faster, as all flip-flops change state almost simultaneously. |
| Complexity | Simpler design for many bits, often requiring fewer logic gates. | More complex logic required to determine the next state inputs for each flip-flop, especially for higher bit counts. |
| Glitches/Skew | Susceptible to glitches or transient states because flip-flops do not change state at the exact same time. | Less prone to glitches as all outputs change synchronously with the clock. |
| Design | Relatively straightforward as each flip-flop triggers the next. | Requires state tables, K-maps (or other simplification methods) to derive input equations. |
Design of a 3-bit Synchronous Binary Counter using T Flip-Flop
A 3-bit binary counter cycles through 2^3 = 8 states (000 to 111). We will use three T flip-flops, denoted by Q2, Q1, and Q0, where Q0 is the Least Significant Bit (LSB) and Q2 is the Most Significant Bit (MSB).
1. T Flip-Flop Excitation Table:
| Present State Q(t) | Next State Q(t+1) | T Input |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
2. State Transition Table and T-Input Derivation:
| Present State (Q2 Q1 Q0) | Next State (Q2' Q1' Q0') | T2 | T1 | T0 |
|---|---|---|---|---|
| 0 0 0 | 0 0 1 | 0 | 0 | 1 |
| 0 0 1 | 0 1 0 | 0 | 1 | 1 |
| 0 1 0 | 0 1 1 | 0 | 0 | 1 |
| 0 1 1 | 1 0 0 | 1 | 1 | 1 |
| 1 0 0 | 1 0 1 | 0 | 0 | 1 |
| 1 0 1 | 1 1 0 | 0 | 1 | 1 |
| 1 1 0 | 1 1 1 | 0 | 0 | 1 |
| 1 1 1 | 0 0 0 | 1 | 1 | 1 |
3. Derivation of T-Input Equations (using K-Maps or direct observation):
- For T0: From the table, T0 is always 1, regardless of the present state.
T0 = 1 - For T1: T1 is 1 when (Q2 Q1 Q0) = 001, 011, 101, 111. This simplifies to Q0 = 1.
T1 = Q0 - For T2: T2 is 1 when (Q2 Q1 Q0) = 011, 111. This simplifies to Q1 AND Q0.
T2 = Q1 ⋅ Q0
4. Logic Circuit Diagram:
<<<GRAPHVIZ_START>>>
digraph G {
rankdir=LR;
node [shape=box, style=filled, fillcolor=lightgray];
// Flip-Flops
FF0 [label="T FF0\nQ0"];
FF1 [label="T FF1\nQ1"];
FF2 [label="T FF2\nQ2"];
// Clock
CLK [shape=none, label="CLK"];
// Inputs for FFs
INPUT_T0 [shape=none, label="1"];
AND_GATE [label="AND", shape=none];
// Connections
CLK -> FF0:clk [dir=none];
CLK -> FF1:clk [dir=none];
CLK -> FF2:clk [dir=none];
INPUT_T0 -> FF0:T; // T0 = 1
FF0:Q -> FF1:T; // T1 = Q0
FF0:Q -> AND_GATE:in1 [label="Q0"];
FF1:Q -> AND_GATE:in2 [label="Q1"];
AND_GATE -> FF2:T [label="T2"];
// Invisible nodes for cleaner layout
{rank=same; FF0; FF1; FF2;}
{rank=min; CLK; INPUT_T0;}
}
<<<GRAPHVIZ_END>>>
Timing Diagram
The timing diagram illustrates the change in output states (Q0, Q1, Q2) with respect to the common clock signal. Assuming positive edge-triggered T flip-flops.
- Clock (CLK): A periodic square wave signal that synchronizes all flip-flops.
- Q0: Toggles on every rising edge of the clock (since T0=1).
- Q1: Toggles on the rising edge of the clock only when Q0 is HIGH (since T1=Q0).
- Q2: Toggles on the rising edge of the clock only when both Q1 and Q0 are HIGH (since T2=Q1 ⋅ Q0).
Below is a representation of the state progression of the 3-bit counter over consecutive clock cycles, as a traditional waveform timing diagram is not suitable for Graphviz.
| Clock Cycle | CLK Edge | Q2 Q1 Q0 (Output State) |
|---|---|---|
| (Initial) | - | 0 0 0 |
| 1 | Rising | 0 0 1 |
| 2 | Rising | 0 1 0 |
| 3 | Rising | 0 1 1 |
| 4 | Rising | 1 0 0 |
| 5 | Rising | 1 0 1 |
| 6 | Rising | 1 1 0 |
| 7 | Rising | 1 1 1 |
| 8 | Rising | 0 0 0 |
This table represents the sequence of states generated by the counter at each active clock edge. For a full waveform timing diagram, individual waveforms for CLK, Q0, Q1, and Q2 would show the propagation delays and the exact moments of transition.
De Morgan's Law
De Morgan's Law consists of two fundamental rules in Boolean algebra that describe the relationship between logical operations (AND, OR) and negation (NOT). These laws are crucial for simplifying Boolean expressions and transforming logic gates.
-
Law 1: The complement of a sum is equal to the product of the complements.
- Algebraic Form: (A + B)' = A' · B'
- Explanation: This law states that if two or more variables are ORed together and then complemented, the result is the same as complementing each variable individually and then ANDing them together.
- Truth Table:
A B A+B (A+B)' A' B' A'·B' 0 0 0 1 1 1 1 0 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 0 0 0
-
Law 2: The complement of a product is equal to the sum of the complements.
- Algebraic Form: (A · B)' = A' + B'
- Explanation: This law states that if two or more variables are ANDed together and then complemented, the result is the same as complementing each variable individually and then ORing them together.
- Truth Table:
A B A·B (A·B)' A' B' A'+B' 0 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1 1 1 0 0 0 0
Significance: De Morgan's Laws enable the conversion of expressions from sum-of-products (SOP) to product-of-sums (POS) form and vice-versa, which is essential for circuit design and optimization using universal gates like NAND and NOR.
K-Map Simplification
Given the Boolean function F(P,Q,R,S) = Π(0,1,4,5,11,14,15) and d(P,Q,R,S) = Σ(2,3,7,8,9,13).
- Maxterms (0s): M = {0,1,4,5,11,14,15}
- Don't Cares (Xs): d = {2,3,7,8,9,13}
- Minterms (1s): Derived from the remaining indices (0-15) not in M or d.
Total minterms: {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
Minterms (1s) = Total - M - d = {6,10,12}
K-Map for SOP (Sum of Products) Form
For SOP, we group the '1's and 'X's on the K-Map.
K-Map Representation:
The K-Map is populated with '1' for minterms (6,10,12), '0' for maxterms (0,1,4,5,11,14,15), and 'X' for don't cares (2,3,7,8,9,13).
<<<GRAPHVIZ_START>>>
digraph KMapSOP {
rankdir=LR;
node [shape=plaintext, fontsize=10];
KMap [shape=none, margin=0, label=<
| RS | |||||
| 00 | 01 | 11 | 10 | ||
| PQ | 00 | 0 (0) | 0 (1) | X (3) | X (2) |
| 01 | 0 (4) | 0 (5) | X (7) | 1 (6) | |
| 11 | 1 (12) | X (13) | 0 (15) | 0 (14) | |
| 10 | X (8) | X (9) | 0 (11) | 1 (10) | |
];
}
<<<GRAPHVIZ_END>>>
Grouping for SOP:
- Quad (P'R): Groups minterms {m6} and don't cares {d2, d3, d7}.
- Cells: (0010, 0011, 0110, 0111) which simplifies to P'R.
- (P'Q'RS', P'Q'RS, P'QRS', P'QRS) -> P'R
- Quad (PR'): Groups minterms {m12} and don't cares {d8, d9, d13}.
- Cells: (1000, 1001, 1100, 1101) which simplifies to PR'.
- (PQ'R'S', PQ'R'S, PQR'S', PQR'S) -> PR'
- Pair (Q'RS'): Groups minterm {m10} and don't care {d2}.
- Cells: (0010, 1010) which simplifies to Q'RS'.
- (P'Q'RS', PQ'RS') -> Q'RS'
Simplified SOP Expression:
F(P,Q,R,S) = P'R + PR' + Q'RS'
K-Map for POS (Product of Sums) Form
For POS, we group the '0's and 'X's on the K-Map.
K-Map Representation:
The K-Map values remain the same as for SOP, but we now focus on grouping the '0's (Maxterms) and 'X's (Don't Cares).
<<<GRAPHVIZ_START>>>
digraph KMapPOS {
rankdir=LR;
node [shape=plaintext, fontsize=10];
KMap [shape=none, margin=0, label=<
| RS | |||||
| 00 | 01 | 11 | 10 | ||
| PQ | 00 | 0 (0) | 0 (1) | X (3) | X (2) |
| 01 | 0 (4) | 0 (5) | X (7) | 1 (6) | |
| 11 | 1 (12) | X (13) | 0 (15) | 0 (14) | |
| 10 | X (8) | X (9) | 0 (11) | 1 (10) | |
];
}
<<<GRAPHVIZ_END>>>
Grouping for POS:
- Quad (P+R): Groups maxterms {M0, M1, M4, M5}.
- Cells: (0000, 0001, 0100, 0101) which simplifies to (P+R).
- (P+Q+R+S)(P+Q+R+S')(P+Q'+R+S)(P+Q'+R+S') -> P+R
- Pair (P'+S'): Groups maxterm {M11} and don't care {d13}.
- Cells: (1011, 1101) which simplifies to (P'+S').
- (P'+Q+R'+S')(P'+Q'+R+S') -> P'+S'
- Pair (P'+Q'+R'): Groups maxterms {M14, M15}.
- Cells: (1110, 1111) which simplifies to (P'+Q'+R').
- (P'+Q'+R'+S)(P'+Q'+R'+S') -> P'+Q'+R'
Simplified POS Expression:
F(P,Q,R,S) = (P+R)(P'+S')(P'+Q'+R')
Design Procedure of Combinatorial Circuits
The design procedure for combinatorial circuits involves a systematic approach to translate a functional specification into a physical logic gate implementation. The key steps are:
-
Problem Specification:
- Clearly define the circuit's function, identifying all required inputs and outputs.
- Specify the relationships between inputs and outputs, often using natural language or a set of rules.
-
Input/Output Definition:
- Assign symbolic names to each input and output variable (e.g., A, B, C for inputs; X, Y, Z for outputs).
- Determine the number of bits for each input and output, establishing their binary representation.
-
Truth Table Formulation:
- Construct a truth table that lists all possible combinations of input values.
- For each input combination, determine the corresponding output values based on the circuit's functional specification. This explicitly defines the circuit's behavior.
-
Boolean Expression Derivation & Simplification:
- For each output, derive a Boolean expression (sum-of-minterms or product-of-maxterms) directly from the truth table.
- Simplify these Boolean expressions to their minimal form using methods like:
- Boolean Algebra theorems: Applying identities and postulates.
- Karnaugh Maps (K-Maps): A graphical method for simplifying expressions with a small number of variables (typically up to 6). It identifies adjacent minterms/maxterms to form larger groups, reducing the number of literals and terms.
- Quine-McCluskey method: A tabular method suitable for a larger number of variables, implementable by computer programs.
-
Logic Diagram Implementation:
- Draw the circuit diagram using standard logic gate symbols (AND, OR, NOT, NAND, NOR, XOR, XNOR) corresponding to the simplified Boolean expressions.
- Ensure proper connections between gates and to input/output terminals.
-
Verification (Optional but Recommended):
- Simulate the designed circuit or manually trace its behavior for various input combinations to ensure it matches the original specification and truth table.
Combinatorial Circuit Design Example
Circuit Specification:
A combinatorial circuit with three inputs (x, y, z) and three outputs (A, B, C).
- When the binary input (xyz) is 0, 1, 2, or 3, the binary output (ABC) is one greater than the input.
- When the binary input (xyz) is 4, 5, 6, or 7, the binary output (ABC) is one less than the input.
1. Inputs and Outputs:
- Inputs: x, y, z (representing a 3-bit binary number)
- Outputs: A, B, C (representing a 3-bit binary number)
2. Truth Table Formulation:
| x | y | z | Input (Decimal) | Output (Decimal) | A | B | C |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
| 0 | 0 | 1 | 1 | 2 | 0 | 1 | 0 |
| 0 | 1 | 0 | 2 | 3 | 0 | 1 | 1 |
| 0 | 1 | 1 | 3 | 4 | 1 | 0 | 0 |
| 1 | 0 | 0 | 4 | 3 | 0 | 1 | 1 |
| 1 | 0 | 1 | 5 | 4 | 1 | 0 | 0 |
| 1 | 1 | 0 | 6 | 5 | 1 | 0 | 1 |
| 1 | 1 | 1 | 7 | 6 | 1 | 1 | 0 |
3. K-Map Simplification and Boolean Expressions:
K-Map for Output A:
A = Σm(3, 5, 6, 7)
A
yz\x | 0 | 1 |
-------|---|---|
00 | 0 | 0 |
01 | 0 | 1 | (m5)
11 | 1 | 1 | (m3, m7)
10 | 1 | 1 | (m2, m6) <-- Error here from truth table. Output A for m2=0, for m6=1.
Let's redraw K-map for A using xyz order.
A = Σm(3, 5, 6, 7)
z=0 z=1
xy
00 0 0
01 0 1 (m3)
11 1 (m6) 1 (m7)
10 0 1 (m5)
Groups:
1. (m3, m7): (011, 111) -> yz
2. (m5, m7): (101, 111) -> xz
3. (m6, m7): (110, 111) -> xy
Simplified Boolean Expression for A:
A = xy + yz + xz
K-Map for Output B:
B = Σm(1, 2, 4, 6, 7)
B
z=0 z=1
xy
00 0 1 (m1)
01 1 (m2) 0
11 1 (m6) 1 (m7)
10 1 (m4) 0
Groups:
1. (m1): 001 -> x'y'z (Essential Prime Implicant)
2. (m2): 010 -> x'yz' (Essential Prime Implicant)
3. (m4): 100 -> xy'z' (Essential Prime Implicant)
4. (m6, m7): (110, 111) -> xy (Covers m6 and m7)
Simplified Boolean Expression for B:
B = x'y'z + x'yz' + xy'z' + xy
K-Map for Output C:
C = Σm(0, 2, 4, 6)
C
z=0 z=1
xy
00 1 (m0) 0
01 1 (m2) 0
11 1 (m6) 0
10 1 (m4) 0
Groups:
1. (m0, m2, m4, m6): (000, 010, 100, 110) -> z' (Covers all 1s in the z=0 column)
Simplified Boolean Expression for C:
C = z'
4. Logic Diagram Implementation:
<<<GRAPHVIZ_START>>>
digraph CombinatorialCircuit {
rankdir=LR;
node [shape=box, style=filled, fillcolor=lightgrey];
// Inputs
x [label="x", shape=circle, fillcolor=white];
y [label="y", shape=circle, fillcolor=white];
z [label="z", shape=circle, fillcolor=white];
// NOT gates for inverted inputs
not_x [label="NOT"];
not_y [label="NOT"];
not_z [label="NOT"];
x -> not_x;
y -> not_y;
z -> not_z;
// Output A = xy + yz + xz
and_xy [label="AND"];
and_yz [label="AND"];
and_xz [label="AND"];
or_A [label="OR", shape=octagon, fillcolor=lightblue];
x -> and_xy:in1; y -> and_xy:in2;
y -> and_yz:in1; z -> and_yz:in2;
x -> and_xz:in1; z -> and_xz:in2;
and_xy -> or_A;
and_yz -> or_A;
and_xz -> or_A;
or_A -> A [label="A"];
// Output B = x'y'z + x'yz' + xy'z' + xy
and_nxnyz [label="AND"]; // x'y'z
and_nxyz [label="AND"]; // x'yz'
and_xnyz [label="AND"]; // xy'z'
and_xy_B [label="AND"]; // xy (already used for A but distinct wire)
or_B [label="OR", shape=octagon, fillcolor=lightblue];
not_x -> and_nxnyz:in1; not_y -> and_nxnyz:in2; z -> and_nxnyz:in3;
not_x -> and_nxyz:in1; y -> and_nxyz:in2; not_z -> and_nxyz:in3;
x -> and_xnyz:in1; not_y -> and_xnyz:in2; not_z -> and_xnyz:in3;
x -> and_xy_B:in1; y -> and_xy_B:in2;
and_nxnyz -> or_B;
and_nxyz -> or_B;
and_xnyz -> or_B;
and_xy_B -> or_B;
or_B -> B [label="B"];
// Output C = z'
not_z -> C [label="C", shape=octagon, fillcolor=lightblue];
}
<<<GRAPHVIZ_END>>>
Section B
Answer any two questions.
-
Represent A and B in Binary:
- A = 46 (decimal) = 101110 (binary)
- B = 35 (decimal) = 100011 (binary)
-
Determine 1's Complement of B:
- B = 100011
- 1's Complement of B = 011100 (invert all bits)
-
Perform Addition of A and 1's Complement of B:
A = 101110 1's Comp B = +011100 -------------------- Sum = 1001010 -
Handle End-Around Carry:
- The sum results in a 7-bit number, indicating a carry-out from the most significant bit.
- The carry-out is '1'.
- Add this carry-out back to the least significant bit of the 6-bit result:
001010 (6-bit sum, ignoring carry) + 1 (End-around carry) -------------------- 001011
-
Final Result:
- The result in binary is 001011.
- Converting back to decimal: 0*32 + 0*16 + 1*8 + 0*4 + 1*2 + 1*1 = 8 + 2 + 1 = 11.
- Therefore, A - B = 46 - 35 = 11.
A Multiplexer (MUX), also known as a data selector, is a combinational logic circuit that selects one of several analog or digital input signals and forwards the selected input into a single output line. The selection of a particular input line is controlled by a set of select lines. An N-input multiplexer has log2(N) select lines.
Design of an 8-to-1 Multiplexer using 2-to-1 Multiplexers
An 8-to-1 multiplexer requires 8 data inputs (D0-D7), 3 select lines (S2, S1, S0), and 1 output (Y). This can be constructed using multiple 2-to-1 multiplexers in stages.
- Stage 1: Four 2-to-1 multiplexers are used. Each MUX takes two data inputs and the least significant select line (S0) as its control input.
- MUX1: Inputs D0, D1; Select S0; Output A
- MUX2: Inputs D2, D3; Select S0; Output B
- MUX3: Inputs D4, D5; Select S0; Output C
- MUX4: Inputs D6, D7; Select S0; Output D
- Stage 2: Two 2-to-1 multiplexers are used. Each MUX takes two outputs from Stage 1 as its data inputs and the middle select line (S1) as its control input.
- MUX5: Inputs A, B; Select S1; Output E
- MUX6: Inputs C, D; Select S1; Output F
- Stage 3: One 2-to-1 multiplexer is used. This MUX takes the two outputs from Stage 2 as its data inputs and the most significant select line (S2) as its control input, producing the final output Y.
- MUX7: Inputs E, F; Select S2; Output Y
<<<GRAPHVIZ_START>>>
digraph G {
rankdir=LR;
node [shape=record, style=filled, fillcolor=lightgray];
subgraph cluster_inputs {
label="Inputs";
color=blue;
D0 [label="D0"];
D1 [label="D1"];
D2 [label="D2"];
D3 [label="D3"];
D4 [label="D4"];
D5 [label="D5"];
D6 [label="D6"];
D7 [label="D7"];
S0 [label="S0", shape=circle, fillcolor=orange];
S1 [label="S1", shape=circle, fillcolor=orange];
S2 [label="S2", shape=circle, fillcolor=orange];
}
node [shape=record, style=filled, fillcolor=lightblue];
MUX1 [label="{<i0> D0|<i1> D1|<s0> S0|<o> A}"];
MUX2 [label="{<i0> D2|<i1> D3|<s0> S0|<o> B}"];
MUX3 [label="{<i0> D4|<i1> D5|<s0> S0|<o> C}"];
MUX4 [label="{<i0> D6|<i1> D7|<s0> S0|<o> D}"];
MUX5 [label="{<i0> A|<i1> B|<s0> S1|<o> E}"];
MUX6 [label="{<i0> C|<i1> D|<s0> S1|<o> F}"];
MUX7 [label="{<i0> E|<i1> F|<s0> S2|<o> Y}"];
node [shape=record, style=filled, fillcolor=lightgray];
Y_out [label="Y", shape=circle, fillcolor=orange];
// Connect inputs to Stage 1 MUXes
D0 -> MUX1:i0;
D1 -> MUX1:i1;
D2 -> MUX2:i0;
D3 -> MUX2:i1;
D4 -> MUX3:i0;
D5 -> MUX3:i1;
D6 -> MUX4:i0;
D7 -> MUX4:i1;
// Connect S0 to Stage 1 MUXes
S0 -> MUX1:s0;
S0 -> MUX2:s0;
S0 -> MUX3:s0;
S0 -> MUX4:s0;
// Connect Stage 1 outputs to Stage 2 MUXes
MUX1:o -> MUX5:i0;
MUX2:o -> MUX5:i1;
MUX3:o -> MUX6:i0;
MUX4:o -> MUX6:i1;
// Connect S1 to Stage 2 MUXes
S1 -> MUX5:s0;
S1 -> MUX6:s0;
// Connect Stage 2 outputs to Stage 3 MUX
MUX5:o -> MUX7:i0;
MUX6:o -> MUX7:i1;
// Connect S2 to Stage 3 MUX
S2 -> MUX7:s0;
// Connect Stage 3 output to final output
MUX7:o -> Y_out;
{rank=same; D0 D1 D2 D3 D4 D5 D6 D7;}
{rank=same; MUX1 MUX2 MUX3 MUX4;}
{rank=same; MUX5 MUX6;}
{rank=same; MUX7;}
{rank=same; S0 S1 S2 Y_out;}
}
<<<GRAPHVIZ_END>>>
A D flip-flop (Data flip-flop) is a synchronous sequential logic circuit used to store a single bit of binary data. It has a single data input (D), a clock input (CLK), and two outputs (Q and Q'). D flip-flops are typically edge-triggered, meaning they capture the value present at the D input and transfer it to the Q output only on a specific transition (either rising or falling edge) of the clock signal. This characteristic makes them ideal for building registers, shift registers, and memory elements.
Necessary Circuit (Clocked D-Latch):
The following circuit diagram illustrates a clocked D-latch, which is a fundamental component used in constructing edge-triggered D flip-flops (often in a master-slave configuration).
<<<GRAPHVIZ_START>>>
digraph D_Latch_NAND {
rankdir=LR;
node [shape=box, style=filled, fillcolor=white, fontname="Arial"];
// Inputs
D_in [shape=none, label="D"];
CLK_in [shape=none, label="CLK"];
// Gates
INV1 [shape=invtriangle, label="", penwidth=1.5];
NAND1 [shape=nand, label="G1", penwidth=1.5];
NAND2 [shape=nand, label="G2", penwidth=1.5];
NAND3 [shape=nand, label="G3", penwidth=1.5];
NAND4 [shape=nand, label="G4", penwidth=1.5];
// Outputs
Q_out [shape=none, label="Q"];
Q_bar_out [shape=none, label="Q'"];
// Connections
D_in -> NAND1:w;
D_in -> INV1:w;
CLK_in -> NAND1:s;
CLK_in -> NAND2:s;
INV1 -> NAND2:w;
NAND1 -> NAND3:n;
NAND2 -> NAND4:n;
NAND3 -> Q_out;
NAND3 -> NAND4:e; // Feedback path from Q to G4
NAND4 -> Q_bar_out;
NAND4 -> NAND3:e; // Feedback path from Q' to G3
}
<<<GRAPHVIZ_END>>>
Block Diagram:
The block diagram for a D flip-flop typically includes a symbol for the clock input to indicate edge-triggering.
<<<GRAPHVIZ_START>>>
digraph D_FlipFlop_Block {
rankdir=LR;
node [shape=none, fontname="Arial"];
// Input/Output labels
D_lbl [label="D"];
CLK_lbl [label="CLK"];
Q_lbl [label="Q"];
Q_bar_lbl [label="Q'"];
// D Flip-Flop box (rectangle)
D_FF_box [shape=box, label="", width=1, height=1.2, fixedsize=true, penwidth=2];
// Clock triangle (separate node for edge-triggering)
CLK_tri [shape=triangle, style=filled, fillcolor=black, width=0.15, height=0.15, fixedsize=true, label=""];
// Connect labels to box and triangle
D_lbl -> D_FF_box:nw [dir=none];
CLK_lbl -> CLK_tri:w [dir=none];
CLK_tri -> D_FF_box:sw [dir=none];
D_FF_box:ne -> Q_lbl [dir=none];
D_FF_box:se -> Q_bar_lbl [dir=none];
// Invisible edges for alignment
{rank=same; D_lbl; D_FF_box; Q_lbl;}
{rank=same; CLK_lbl; CLK_tri; Q_bar_lbl;}
}
<<<GRAPHVIZ_END>>>
Characteristic Table:
The characteristic table shows the next state (Q(t+1)) of the D flip-flop based on its current input (D) and present state (Q(t)), at the active clock edge.
| D | Q(t) | Q(t+1) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Characteristic Equation:
From the characteristic table, it is observed that the next state of the flip-flop is always equal to the D input at the active clock edge.
Q(t+1) = D
To simplify the Boolean function F(A, B, C, D) = Σ(1,3,4,6,9,11,12,14) and realize it using NOR gates only:
-
K-map Simplification:
A 4-variable K-map is used to simplify the function F(A, B, C, D).CD\AB 00 (A'B') 01 (A'B) 11 (AB) 10 (AB') 00 (C'D') 0 1 (4) 1 (12) 0 01 (C'D) 1 (1) 0 0 1 (9) 11 (CD) 1 (3) 0 0 1 (11) 10 (CD') 0 1 (6) 1 (14) 0 Grouping of minterms:
- Group 1 (Quad): (m1, m3, m9, m11)
- A'B'C'D + A'B'CD + AB'C'D + AB'CD
- Simplifies to B'D (as A, C vary while B'D remains constant)
- Group 2 (Quad): (m4, m6, m12, m14)
- A'BC'D' + A'BCD' + ABC'D' + ABCD'
- Simplifies to BD' (as A, C vary while BD' remains constant)
The simplified Sum of Products (SOP) expression is:
F(A, B, C, D) = B'D + BD'
This is the XOR function of B and D (F = B ⊕ D). - Group 1 (Quad): (m1, m3, m9, m11)
-
Realization using NOR gates only:
The simplified function is F = B'D + BD'.
To realize using NOR gates, we utilize the following NOR gate equivalences:- Inverter: X' = X NOR X
- AND: X.Y = (X' + Y')' = X' NOR Y'
- OR: X+Y = ((X+Y)')' = (X NOR Y)'
Steps for realizing F = B'D + BD':
- Implement B' = B NOR B
- Implement D' = D NOR D
- Implement B'D: Using X.Y = X' NOR Y', so B'D = (B'')' NOR (D')' = (B)' NOR (D') = (B NOR (D NOR D))
However, it is simpler to use the De Morgan's form for B'D = (B + D')' = B NOR D'. - Implement BD': Similarly, BD' = (B' + D)' = B' NOR D.
- Implement F = (B'D) + (BD'): Using X+Y = (X NOR Y)', so F = ((B'D) NOR (BD'))'
Substituting the NOR forms:
- D' = D NOR D
- B' = B NOR B
- Term1 = B NOR D' (Implements (B+D')' = B'D)
- Term2 = B' NOR D (Implements (B'+D)' = BD')
- Intermediate_Output = Term1 NOR Term2 (Implements ((B'D) + (BD'))')
- Final_Output F = Intermediate_Output NOR Intermediate_Output (Implements ((B'D + BD')')' = B'D + BD')
The circuit diagram is as follows:
<<<GRAPHVIZ_START>>>
digraph G {
rankdir=LR;
node [shape=circle, fixedsize=true, width=0.5, style=filled, fillcolor=lightblue];
B [label="B", shape=none];
D [label="D", shape=none];
node [shape=circle, label="NOR", fixedsize=true, width=0.6, style=filled, fillcolor=lightgreen];
// Inverters
nor1 [label="NOR"]; // D'
nor2 [label="NOR"]; // B'
// AND gates (using NOR form (X+Y)')
nor3 [label="NOR"]; // B'D (as (B+D')')
nor4 [label="NOR"]; // BD' (as (B'+D)')
// OR gate (using NOR form (X+Y)')
nor5 [label="NOR"]; // (B'D + BD')'
nor6 [label="NOR"]; // (B'D + BD')
// Connections
D -> nor1;
D -> nor1; // D' = D NOR D
B -> nor2;
B -> nor2; // B' = B NOR B
B -> nor3;
nor1 -> nor3; // (B+D')' = B'D
nor2 -> nor4;
D -> nor4; // (B'+D)' = BD'
nor3 -> nor5;
nor4 -> nor5; // (B'D + BD')'
nor5 -> nor6;
nor5 -> nor6; // Invert to get (B'D + BD')
nor6 -> F_out [label="F", shape=none, fontcolor=red];
}
<<<GRAPHVIZ_END>>>
Different types of shift registers are:
- Serial-In, Serial-Out (SISO): Data enters serially and exits serially after a specific number of clock cycles.
- Serial-In, Parallel-Out (SIPO): Data enters serially and is available at parallel outputs after a specified number of clock cycles.
- Parallel-In, Serial-Out (PISO): Data is loaded in parallel and then shifted out serially.
- Parallel-In, Parallel-Out (PIPO): Data is loaded in parallel and is immediately available at parallel outputs without shifting, or can be shifted out in parallel after loading.
- Universal Shift Register: Can perform all the above operations (SISO, SIPO, PISO, PIPO) and often includes hold and clear capabilities.
- Ring Counter: A specific configuration of a shift register where the output of the last flip-flop is fed back to the input of the first.
- Johnson Counter (Twisted-Ring Counter): Similar to a ring counter, but the inverted output of the last flip-flop is fed back to the first.
Serial-In, Parallel-Out (SIPO) Shift Register
A Serial-In, Parallel-Out (SIPO) shift register converts serial data into parallel data. Data bits are entered into the register one bit at a time, serially, on successive clock pulses. After a number of clock pulses equal to the number of stages (flip-flops) in the register, all the data bits are present simultaneously at the parallel outputs of the flip-flops. This configuration is widely used for serial-to-parallel data conversion, for example, when receiving data over a single line (like in a microcontroller's UART) and then needing to process it as a complete word.
Timing Diagram for a 4-bit SIPO Shift Register (Serial Input: 1011)
The following diagram illustrates the shifting process for a 4-bit SIPO register, where data "1011" (MSB first) is serially loaded. Q3 is the Most Significant Bit (MSB) and Q0 is the Least Significant Bit (LSB).
<<<GRAPHVIZ_START>>>
digraph SIPO_Timing {
rankdir=LR;
node [shape=record, style=filled, fillcolor=lightblue, fontname="Arial"];
edge [dir=forward, fontcolor=darkgreen, labelfontize=10, fontname="Arial"];
initial [label="{<p>Initial State|Q3Q2Q1Q0=0000}"];
clk1 [label="{<p>After Clock 1|Serial Input=1|Q3Q2Q1Q0=1000}"];
clk2 [label="{<p>After Clock 2|Serial Input=0|Q3Q2Q1Q0=0100}"];
clk3 [label="{<p>After Clock 3|Serial Input=1|Q3Q2Q1Q0=1010}"];
clk4 [label="{<p>After Clock 4|Serial Input=1|Q3Q2Q1Q0=1101}"];
initial -> clk1 [label="Clock 1 (Input 1)"];
clk1 -> clk2 [label="Clock 2 (Input 0)"];
clk2 -> clk3 [label="Clock 3 (Input 1)"];
clk3 -> clk4 [label="Clock 4 (Input 1)"];
clk4 -> parallel_out [label="Parallel Data Ready", style=dashed, color=red];
parallel_out [label="Final Parallel Output\nQ3Q2Q1Q0=1101", shape=box, style=filled, fillcolor=lightgreen, fontname="Arial"];
}
<<<GRAPHVIZ_END>>>
A decoder is a combinational logic circuit that converts binary information from N input lines to a maximum of 2^N unique output lines. It enables one of the 2^N outputs based on the N-bit binary value applied to its inputs.
3-to-8 Line Decoder Circuit:
A 3-to-8 line decoder has three input lines (A2, A1, A0) and eight output lines (Y0 to Y7). Each output line corresponds to one of the 2^3 = 8 possible minterms of the input variables.
- Functionality: For every unique 3-bit input combination, only one of the eight output lines is activated (set to HIGH or LOW, depending on active-high or active-low design), while all other output lines remain inactive.
- Circuit Structure: It is typically constructed using AND gates and NOT gates. Each output corresponds to a unique minterm derived from the three input variables and their complements. For instance, output Y0 corresponds to the minterm A2'A1'A0', Y1 to A2'A1'A0, and so on, up to Y7 corresponding to A2A1A0.
- Truth Table:
| A2 | A1 | A0 | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
- Enable Input (Optional): Many decoders include an additional enable (EN) input. When EN is asserted (e.g., HIGH), the decoder operates normally. When EN is deasserted (e.g., LOW), all outputs are forced to an inactive state, regardless of the input values.
<<<GRAPHVIZ_START>>>
digraph G {
rankdir=LR;
node [shape=box];
subgraph cluster_0 {
label="3-to-8 Line Decoder";
style=filled;
color=lightgrey;
node [shape=none];
A2 [label="A2"];
A1 [label="A1"];
A0 [label="A0"];
EN [label="EN"];
node [shape=box, style=solid, label="Decoder"];
Decoder_block [label="3-to-8 Decoder"];
Y0 [label="Y0"];
Y1 [label="Y1"];
Y2 [label="Y3"];
Y3 [label="Y4"];
Y4 [label="Y5"];
Y5 [label="Y6"];
Y6 [label="Y7"];
Y7 [label="Y8"];
A2 -> Decoder_block [headlabel="3\nInputs", labelfloat=true];
A1 -> Decoder_block;
A0 -> Decoder_block;
EN -> Decoder_block [label="Enable"];
Decoder_block -> Y0 [taillabel="8\nOutputs", labelfloat=true];
Decoder_block -> Y1;
Decoder_block -> Y2;
Decoder_block -> Y3;
Decoder_block -> Y4;
Decoder_block -> Y5;
Decoder_block -> Y6;
Decoder_block -> Y7;
{rank=same; A2; A1; A0; EN;}
{rank=same; Y0; Y1; Y2; Y3; Y4; Y5; Y6; Y7;}
}
}
<<<GRAPHVIZ_END>>>
-
State Diagram:
A graphical representation of the behavior of a sequential circuit. It consists of:- States (nodes): Represent the stable conditions of the circuit.
- Transitions (directed arcs): Indicate the change from one state to another based on input conditions.
- Labels on transitions: Show the input that causes the transition and the corresponding output produced.
- Example: A state diagram for a traffic light controller might have states like "Red", "Green", "Yellow", with transitions based on a timer or external sensor inputs.
-
State Table:
A tabular representation of the information contained in a state diagram. It lists all possible present states, the inputs, the resulting next states, and the outputs produced.- Columns: Typically include Present State, Next State (for each input combination), and Output (for each input combination or present state, depending on Mealy/Moore model).
- Rows: Represent each unique state.
- Example: For a 2-bit counter, a state table would list Present State (e.g., 00), and the Next State (e.g., 01) when an increment input is active, and the output (e.g., 00).
-
State Reduction:
The process of minimizing the number of states in a sequential circuit while preserving its original input-output behavior. This is done by identifying and merging equivalent states.- Purpose: To simplify the circuit design, reduce the number of flip-flops required, and minimize the combinational logic, leading to a more cost-effective and faster implementation.
- Example: If two states S1 and S2, for every possible input, transition to the same next state and produce the same output, then S1 and S2 are equivalent and can be replaced by a single state.
-
State Assignment:
The process of assigning unique binary codes (bit patterns) to each state in a sequential circuit. The number of bits required for assignment is determined by the number of states (N), usingceil(log2(N))bits.- Purpose: To convert the symbolic states into binary values that can be implemented using flip-flops. The choice of assignment can significantly impact the complexity of the combinational logic required between flip-flops.
- Example: For a circuit with four states (S0, S1, S2, S3), 2 bits are needed. A simple sequential assignment might be S0=00, S1=01, S2=10, S3=11. Other assignments like Gray code or one-hot might be used to optimize logic.
A 2-bit asynchronous binary counter counts from 00 to 11 and then resets to 00. It uses two T flip-flops connected such that the output of the preceding flip-flop clocks the next one. T inputs of all flip-flops are tied to logic HIGH (1) to ensure they toggle on each active clock edge. For an up-counter with negative-edge triggered T flip-flops, the Q output of the first flip-flop (LSB) clocks the second flip-flop (MSB).
Circuit Design
- Flip-Flop 0 (LSB - Q0):
- T input connected to VCC (logic 1).
- Clock input connected to the external clock signal.
- Q output is Q0.
- Flip-Flop 1 (MSB - Q1):
- T input connected to VCC (logic 1).
- Clock input connected to the Q output of Flip-Flop 0 (Q0).
- Q output is Q1.
Circuit Diagram
<<<GRAPHVIZ_START>>>
digraph CounterCircuit {
rankdir=LR;
node [shape=rect, style=filled, fillcolor=lightblue];
// External inputs
Clock [label="Clock"];
VCC [label="VCC (Logic 1)", shape=circle];
// Flip-Flop 0 (FF0)
subgraph cluster_ff0 {
label="T Flip-Flop 0 (FF0)";
FF0_CLK [label="CLK"];
FF0_T [label="T"];
FF0_Q [label="Q0"];
FF0_Qbar [label="Q0'", shape=none]; // Q-bar not used for clocking, but typically present
FF0_Node [shape=box, label="T-FF"]; // Placeholder for the FF graphic
FF0_CLK -> FF0_Node [headlabel="CLK"];
FF0_T -> FF0_Node [headlabel="T"];
FF0_Node -> FF0_Q [taillabel="Q"];
FF0_Node -> FF0_Qbar [taillabel="Q'"];
}
// Flip-Flop 1 (FF1)
subgraph cluster_ff1 {
label="T Flip-Flop 1 (FF1)";
FF1_CLK [label="CLK"];
FF1_T [label="T"];
FF1_Q [label="Q1"];
FF1_Qbar [label="Q1'", shape=none];
FF1_Node [shape=box, label="T-FF"];
FF1_CLK -> FF1_Node [headlabel="CLK"];
FF1_T -> FF1_Node [headlabel="T"];
FF1_Node -> FF1_Q [taillabel="Q"];
FF1_Node -> FF1_Qbar [taillabel="Q'"];
}
// Connections
Clock -> FF0_CLK; // External clock to FF0
VCC -> FF0_T; // T0 tied high
VCC -> FF1_T; // T1 tied high
FF0_Q -> FF1_CLK; // Q0 output clocks FF1
// Indicate output lines clearly
FF0_Q -> Q0_output [label="Q0 (LSB)", style=dashed];
FF1_Q -> Q1_output [label="Q1 (MSB)", style=dashed];
Q0_output [label="Q0", shape=none];
Q1_output [label="Q1", shape=none];
}
<<<GRAPHVIZ_END>>>
Timing Diagram
<<<GRAPHVIZ_START>>>
digraph timing_diagram {
rankdir=LR;
node [shape=plaintext, fontname="Courier New", fontsize=10];
edge [dir=none];
// Invisible nodes to mark time steps for vertical alignment
subgraph cluster_time_markers {
style=invis;
t0 [label="", width=0.1, height=0.1];
t1 [label="", width=0.1, height=0.1];
t2 [label="", width=0.1, height=0.1];
t3 [label="", width=0.1, height=0.1];
t4 [label="", width=0.1, height=0.1];
t5 [label="", width=0.1, height=0.1];
t6 [label="", width=0.1, height=0.1];
t7 [label="", width=0.1, height=0.1];
t8 [label="", width=0.1, height=0.1];
t0 -> t1 -> t2 -> t3 -> t4 -> t5 -> t6 -> t7 -> t8 [style=invis];
}
// Clock signal
subgraph cluster_clk {
label="Clock";
clk_label [label="Clock", shape=none];
clk0 [label="H"]; clk1 [label="L"]; clk2 [label="H"]; clk3 [label="L"]; clk4 [label="H"]; clk5 [label="L"]; clk6 [label="H"]; clk7 [label="L"]; clk8 [label="H"];
clk0 -> clk1 -> clk2 -> clk3 -> clk4 -> clk5 -> clk6 -> clk7 -> clk8;
{rank=same; t0; clk0;}
{rank=same; t1; clk1;}
{rank=same; t2; clk2;}
{rank=same; t3; clk3;}
{rank=same; t4; clk4;}
{rank=same; t5; clk5;}
{rank=same; t6; clk6;}
{rank=same; t7; clk7;}
{rank=same; t8; clk8;}
clk_label -> clk0 [style=invis]; // Helps align label
}
// Q0 signal (LSB)
subgraph cluster_q0 {
label="Q0";
q0_label [label="Q0", shape=none];
q0_0 [label="0"]; q0_1 [label="1"]; q0_2 [label="1"]; q0_3 [label="0"]; q0_4 [label="0"]; q0_5 [label="1"]; q0_6 [label="1"]; q0_7 [label="0"]; q0_8 [label="0"];
q0_0 -> q0_1 -> q0_2 -> q0_3 -> q0_4 -> q0_5 -> q0_6 -> q0_7 -> q0_8;
{rank=same; t0; q0_0;}
{rank=same; t1; q0_1;}
{rank=same; t2; q0_2;}
{rank=same; t3; q0_3;}
{rank=same; t4; q0_4;}
{rank=same; t5; q0_5;}
{rank=same; t6; q0_6;}
{rank=same; t7; q0_7;}
{rank=same; t8; q0_8;}
q0_label -> q0_0 [style=invis];
}
// Q1 signal (MSB)
subgraph cluster_q1 {
label="Q1";
q1_label [label="Q1", shape=none];
q1_0 [label="0"]; q1_1 [label="0"]; q1_2 [label="0"]; q1_3 [label="1"]; q1_4 [label="1"]; q1_5 [label="1"]; q1_6 [label="1"]; q1_7 [label="0"]; q1_8 [label="0"];
q1_0 -> q1_1 -> q1_2 -> q1_3 -> q1_4 -> q1_5 -> q1_6 -> q1_7 -> q1_8;
{rank=same; t0; q1_0;}
{rank=same; t1; q1_1;}
{rank=same; t2; q1_2;}
{rank=same; t3; q1_3;}
{rank=same; t4; q1_4;}
{rank=same; t5; q1_5;}
{rank=same; t6; q1_6;}
{rank=same; t7; q1_7;}
{rank=same; t8; q1_8;}
q1_label -> q1_0 [style=invis];
}
// Binary Count
subgraph cluster_count {
label="Binary Count (Q1Q0)";
count_label [label="Count", shape=none];
c0 [label="00"]; c1 [label="01"]; c2 [label="01"]; c3 [label="10"]; c4 [label="10"]; c5 [label="11"]; c6 [label="11"]; c7 [label="00"]; c8 [label="00"];
c0 -> c1 -> c2 -> c3 -> c4 -> c5 -> c6 -> c7 -> c8;
{rank=same; t0; c0;}
{rank=same; t1; c1;}
{rank=same; t2; c2;}
{rank=same; t3; c3;}
{rank=same; t4; c4;}
{rank=same; t5; c5;}
{rank=same; t6; c6;}
{rank=same; t7; c7;}
{rank=same; t8; c8;}
count_label -> c0 [style=invis];
}
}
<<<GRAPHVIZ_END>>>
Encoder
- A combinational logic circuit that converts n input lines into m output lines, where 2m ≥ n.
- The primary function is to generate a binary code corresponding to the active input line.
- For a standard encoder, only one input line is active (high) at any given time, and its position determines the binary output code.
- Common applications include converting decimal or octal inputs into their binary equivalents and generating control signals in digital systems.
- Example: An 8-to-3 line encoder converts one of eight active input signals into a 3-bit binary output code.
Error Detection Codes
- Techniques used to detect errors that may occur in digital data during transmission or storage.
- These codes work by adding redundant bits (checksums, parity bits, CRC remainders) to the original data at the sender.
- The receiver processes both the data and the redundant bits to determine if any corruption has occurred during transit.
- Common types include:
- Parity Check: Adds a single parity bit to make the total number of '1's in the data unit either even (even parity) or odd (odd parity). Primarily detects single-bit errors.
- Checksum: Involves summing the data words and transmitting the complement of the sum as the checksum. Detects many multiple-bit errors.
- Cyclic Redundancy Check (CRC): Utilizes polynomial division over a finite field to generate a sequence of redundant bits. Highly effective in detecting burst errors.
- Error detection codes primarily identify the presence of errors but do not inherently correct them.