Show description
Digital Logic Solutions // HW5
Digital Logic Solutions // HW5
Logic Decoder
HW5 Solution Artifact // System Ready
SYSTEM MESSAGE: This document analyzes the timing diagrams and sequential logic problems from Chapter 6.
Click on any module below to reveal the solution logic.
03 Timing Diagrams: D & T Flip-Flops
The "Why"
D Flip-Flop (Data): It's a copycat. When the clock ticks (rising edge), Q copies whatever D is.
T Flip-Flop (Toggle): It's a switch. If T=1 at the clock tick, Q flips (0→1 or 1→0). If T=0, Q stays the same.
CLR (Clear): The "Emergency Stop". If CLR is active (Low/0), Q becomes 0 immediately. It ignores the clock.
PRE (Preset): The "Jump Start". If PRE is active (Low/0), Q becomes 1 immediately.
a) D-FF (No Async Inputs)
Q updates only at rising clock edges.
CLK Edge: ↑ #1 ↑ #2 ↑ #3 ↑ #4 ↑ #5
Input D: 1 0 1 0 1
Output Q: 1 0 1 0 1
b) D-FF w/ Active Low CLR
Watch the CLR' line. When it dips to 0, Q flatlines to 0 instantly.
Logic: If CLR'=0, Q=0. Else, if CLK ↑, Q=D.
Result: The first high pulse of D is cut short because CLR' goes low during it.
e) T-FF w/ Active Low CLR
Toggles on clock if T=1. Resets if CLR'=0.
1. CLR' active early? -> Q starts at 0.
2. 1st Clock: T is high? -> Q toggles 0->1.
3. CLR' goes low? -> Q forced to 0 immediately.
4. 2nd Clock: T is low? -> Q stays 0.
04 JK Flip-Flop (74112)
Critical Info: Negative Edge & Async
The 74112 is Negative-Edge Triggered (updates when clock goes High->Low) and has Active Low PRE/CLR.
J=0, K=0 -> Hold
J=0, K=1 -> Reset (0)
J=1, K=0 -> Set (1)
J=1, K=1 -> Toggle
Case A: J & K Change
Look for the falling edges of the clock.
CLK ↓
J
K
Action
1
1
0
Set (1)
2
0
1
Reset (0)
3
1
1
Toggle
Case C: PRE & CLR Dominance
Async inputs win.
Initially PRE' goes Low -> Q jumps to 1.
Later CLR' goes Low -> Q drops to 0.
In between, if both are High (inactive), check J/K at falling edge.
05 Logic Gate Analysis
Decoding the Circuit
The diagram shows gates feeding the Flip-Flop input.…
Digital Logic Solutions // HW5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Digital Logic Solutions // HW5</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Orbitron:wght@500;700;900&display=swap');
:root {
--neon-blue: #00f3ff;
--neon-pink: #ff00ff;
--neon-green: #0aff00;
--dark-bg: #0a0a0f;
--panel-bg: #13131f;
--text-main: #e0e0e0;
}
body {
background-color: var(--dark-bg);
color: var(--text-main);
font-family: 'JetBrains Mono', monospace;
background-image:
linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
background-size: 30px 30px;
}
h1, h2, h3 {
font-family: 'Orbitron', sans-serif;
text-transform: uppercase;
}
.neon-text {
text-shadow: 0 0 5px var(--neon-blue), 0 0 10px var(--neon-blue);
}
.neon-border {
box-shadow: 0 0 5px var(--neon-blue), inset 0 0 5px var(--neon-blue);
border: 1px solid var(--neon-blue);
}
.card {
background: var(--panel-bg);
border-left: 4px solid var(--neon-blue);
transition: all 0.3s ease;
}
.card:hover {
transform: translateX(5px);
box-shadow: -5px 0 15px rgba(0, 243, 255, 0.2);
}
.logic-table th {
background-color: #2a2a35;
color: var(--neon-blue);
padding: 8px;
border-bottom: 1px solid #444;
}
.logic-table td {
padding: 8px;
border-bottom: 1px solid #333;
text-align: center;
}
.logic-table tr:hover {
background-color: #2a2a35;
}
.explanation-box {
background-color: rgba(10, 255, 0, 0.05);
border: 1px dashed var(--neon-green);
color: #b0ffb0;
}
/* Toggle Animation */
details > summary {
list-style: none;
cursor: pointer;
}
details > summary::-webkit-details-marker {
display: none;
}
details[open] summary ~ * {
animation: sweep .3s ease-in-out;
}
@keyframes sweep {
0% {opacity: 0; transform: translateY(-10px)}
100% {opacity: 1; transform: translateY(0)}
}
.chip-diagram {
position: relative;
border: 2px solid #555;
border-radius: 4px;
padding: 10px;
display: inline-block;
margin: 10px;
background: #222;
}
.pin {
width: 10px;
height: 2px;
background: #888;
position: absolute;
}
</style>
</head>
<body class="min-h-screen p-4 md:p-8">
<div class="max-w-4xl mx-auto">
<!-- Header -->
<header class="mb-12 text-center relative">
<div class="absolute inset-0 bg-blue-500 blur-[100px] opacity-10 pointer-events-none"></div>
<h1 class="text-4xl md:text-6xl font-black text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 to-blue-600 mb-4 neon-text">
Logic Decoder
</h1>
<p class="text-gray-400 text-lg">HW5 Solution Artifact // <span class="text-cyan-400">System Ready</span></p>
</header>
<!-- Intro -->
<div class="mb-8 p-4 border border-gray-800 bg-gray-900/50 rounded-lg">
<p class="mb-2"><i class="fas fa-terminal text-green-500 mr-2"></i><strong>SYSTEM MESSAGE:</strong> This document analyzes the timing diagrams and sequential logic problems from Chapter 6.</p>
<p class="text-sm text-gray-500 pl-6">Click on any module below to reveal the solution logic.</p>
</div>
<!-- Problem 3 -->
<details class="group mb-6">
<summary class="flex items-center justify-between p-6 rounded-lg cursor-pointer bg-gray-900 border border-gray-700 hover:border-cyan-500 transition-colors">
<h2 class="text-xl font-bold text-cyan-400"><span class="text-gray-500 mr-4">03</span> Timing Diagrams: D & T Flip-Flops</h2>
<span class="text-2xl group-open:rotate-180 transition-transform"><i class="fas fa-chevron-down"></i></span>
</summary>
<div class="p-6 bg-gray-800/50 border-x border-b border-gray-700 rounded-b-lg">
<div class="grid gap-6">
<div class="explanation-box p-4 rounded">
<h3 class="text-green-400 font-bold mb-2"><i class="fas fa-lightbulb mr-2"></i>The "Why"</h3>
<ul class="list-disc pl-5 space-y-2 text-sm">
<li><strong>D Flip-Flop (Data):</strong> It's a copycat. When the clock ticks (rising edge), Q copies whatever D is.</li>
<li><strong>T Flip-Flop (Toggle):</strong> It's a switch. If T=1 at the clock tick, Q flips (0→1 or 1→0). If T=0, Q stays the same.</li>
<li><strong>CLR (Clear):</strong> The "Emergency Stop". If CLR is active (Low/0), Q becomes 0 <em>immediately</em>. It ignores the clock.</li>
<li><strong>PRE (Preset):</strong> The "Jump Start". If PRE is active (Low/0), Q becomes 1 <em>immediately</em>.</li>
</ul>
</div>
<div class="space-y-4">
<div class="card p-4 rounded">
<h4 class="font-bold text-white mb-2">a) D-FF (No Async Inputs)</h4>
<p class="text-gray-400 text-sm mb-2">Q updates only at rising clock edges.</p>
<div class="text-xs font-mono bg-black p-2 rounded border border-gray-700 overflow-x-auto">
CLK Edge: ↑ #1 ↑ #2 ↑ #3 ↑ #4 ↑ #5<br>
Input D: 1 0 1 0 1<br>
<span class="text-cyan-400">Output Q: 1 0 1 0 1</span>
</div>
</div>
<div class="card p-4 rounded">
<h4 class="font-bold text-white mb-2">b) D-FF w/ Active Low CLR</h4>
<p class="text-gray-400 text-sm mb-2">Watch the CLR' line. When it dips to 0, Q flatlines to 0 instantly.</p>
<div class="text-xs font-mono bg-black p-2 rounded border border-gray-700">
Logic: If CLR'=0, Q=0. Else, if CLK ↑, Q=D.<br>
<span class="text-yellow-400">Result: The first high pulse of D is cut short because CLR' goes low during it.</span>
</div>
</div>
<div class="card p-4 rounded">
<h4 class="font-bold text-white mb-2">e) T-FF w/ Active Low CLR</h4>
<p class="text-gray-400 text-sm mb-2">Toggles on clock if T=1. Resets if CLR'=0.</p>
<div class="text-xs font-mono bg-black p-2 rounded border border-gray-700">
1. CLR' active early? -> Q starts at 0.<br>
2. 1st Clock: T is high? -> Q toggles 0->1.<br>
3. CLR' goes low? -> Q forced to 0 immediately.<br>
4. 2nd Clock: T is low? -> Q stays 0.<br>
</div>
</div>
</div>
</div>
</div>
</details>
<!-- Problem 4 -->
<details class="group mb-6">
<summary class="flex items-center justify-between p-6 rounded-lg cursor-pointer bg-gray-900 border border-gray-700 hover:border-pink-500 transition-colors">
<h2 class="text-xl font-bold text-pink-400"><span class="text-gray-500 mr-4">04</span> JK Flip-Flop (74112)</h2>
<span class="text-2xl group-open:rotate-180 transition-transform"><i class="fas fa-chevron-down"></i></span>
</summary>
<div class="p-6 bg-gray-800/50 border-x border-b border-gray-700 rounded-b-lg">
<div class="grid md:grid-cols-2 gap-6">
<div class="col-span-2 explanation-box p-4 rounded">
<h3 class="text-green-400 font-bold mb-2">Critical Info: Negative Edge & Async</h3>
<p class="text-sm">The 74112 is <strong>Negative-Edge Triggered</strong> (updates when clock goes High->Low) and has Active Low PRE/CLR.</p>
<ul class="list-disc pl-5 mt-2 text-sm font-mono text-gray-300">
<li>J=0, K=0 -> Hold</li>
<li>J=0, K=1 -> Reset (0)</li>
<li>J=1, K=0 -> Set (1)</li>
<li>J=1, K=1 -> Toggle</li>
</ul>
</div>
<div class="card p-4 rounded">
<h4 class="font-bold text-white">Case A: J & K Change</h4>
<p class="text-sm text-gray-400 mt-2">Look for the falling edges of the clock.</p>
<table class="w-full logic-table text-xs mt-2">
<tr><th>CLK ↓</th><th>J</th><th>K</th><th>Action</th></tr>
<tr><td>1</td><td>1</td><td>0</td><td>Set (1)</td></tr>
<tr><td>2</td><td>0</td><td>1</td><td>Reset (0)</td></tr>
<tr><td>3</td><td>1</td><td>1</td><td>Toggle</td></tr>
</table>
</div>
<div class="card p-4 rounded">
<h4 class="font-bold text-white">Case C: PRE & CLR Dominance</h4>
<p class="text-sm text-gray-400 mt-2">Async inputs win.</p>
<ul class="list-decimal pl-5 text-xs space-y-2 mt-2 font-mono">
<li>Initially PRE' goes Low -> <strong>Q jumps to 1</strong>.</li>
<li>Later CLR' goes Low -> <strong>Q drops to 0</strong>.</li>
<li>In between, if both are High (inactive), check J/K at falling edge.</li>
</ul>
</div>
</div>
</div>
</details>
<!-- Problem 5 -->
<details class="group mb-6">
<summary class="flex items-center justify-between p-6 rounded-lg cursor-pointer bg-gray-900 border border-gray-700 hover:border-yellow-500 transition-colors">
<h2 class="text-xl font-bold text-yellow-400"><span class="text-gray-500 mr-4">05</span> Logic Gate Analysis</h2>
<span class="text-2xl group-open:rotate-180 transition-transform"><i class="fas fa-chevron-down"></i></span>
</summary>
<div class="p-6 bg-gray-800/50 border-x border-b border-gray-700 rounded-b-lg">
<div class="mb-6">
<h3 class="text-lg font-bold text-white mb-2">Decoding the Circuit</h3>
<p class="text-gray-400 mb-4">The diagram shows gates feeding the Flip-Flop input. Let's trace the wires:</p>
<div class="bg-black p-4 rounded border border-gray-700 font-mono text-sm">
<span class="text-purple-400">Top AND Gate:</span> Inputs are X and Q'<br>
<span class="text-purple-400">Bottom AND Gate:</span> Inputs are X' (via inverter) and Q<br>
<span class="text-orange-400">OR Gate:</span> Sums the two ANDs<br>
<br>
<span class="text-green-400">Equation:</span> IN = (X AND Q') OR (X' AND Q)<br>
<span class="text-green-400">Simplification:</span> This is the <strong>XOR</strong> function (X ⊕ Q).
</div>
</div>
<div class="grid md:grid-cols-2 gap-6">
<div class="card p-4 rounded relative overflow-hidden">
<div class="absolute top-0 right-0 p-2 opacity-20 text-6xl text-white font-black">D</div>
<h4 class="font-bold text-white z-10 relative">Part A: If it's a D-Flip Flop</h4>
<p class="text-sm text-gray-300 mt-2 z-10 relative">
$$ D = X \oplus Q $$
<br>
This means the Next State will be the XOR of Input X and Current State Q.
</p>
<p class="text-xs text-yellow-300 mt-2 z-10 relative font-bold">
Result: It acts like a T Flip-Flop! <br>
(If X=1, it toggles. If X=0, it holds).
</p>
</div>
<div class="card p-4 rounded relative overflow-hidden">
<div class="absolute top-0 right-0 p-2 opacity-20 text-6xl text-white font-black">T</div>
<h4 class="font-bold text-white z-10 relative">Part B: If it's a T-Flip Flop</h4>
<p class="text-sm text-gray-300 mt-2 z-10 relative">
$$ T = X \oplus Q $$
<br>
Next State = $$ Q \oplus T = Q \oplus (X \oplus Q) $$
<br>
$$ = X \oplus (Q \oplus Q) = X \oplus 0 = X $$
</p>
<p class="text-xs text-yellow-300 mt-2 z-10 relative font-bold">
Result: It acts like a D Flip-Flop! <br>
(Next state is just X).
</p>
</div>
</div>
</div>
</details>
<!-- Problem 6 -->
<details class="group mb-6">
<summary class="flex items-center justify-between p-6 rounded-lg cursor-pointer bg-gray-900 border border-gray-700 hover:border-purple-500 transition-colors">
<h2 class="text-xl font-bold text-purple-400"><span class="text-gray-500 mr-4">06</span> The "Mystery" Flip-Flop</h2>
<span class="text-2xl group-open:rotate-180 transition-transform"><i class="fas fa-chevron-down"></i></span>
</summary>
<div class="p-6 bg-gray-800/50 border-x border-b border-gray-700 rounded-b-lg">
<div class="grid gap-4">
<div class="explanation-box p-4 rounded">
<p class="text-sm"><strong>Rule:</strong> If A=0, Q* = B. If A=1, Q* = B'.</p>
</div>
<div class="card p-4 rounded">
<h3 class="font-bold text-white mb-2">b) The Equation</h3>
<p class="text-gray-400 text-sm mb-2">We can write this as a Sum of Products:</p>
<div class="font-mono text-lg text-cyan-300">
Q* = (A' • B) + (A • B')
</div>
<div class="text-sm text-gray-500 mt-1">
(This is A XOR B)
</div>
</div>
<div class="card p-4 rounded">
<h3 class="font-bold text-white mb-2">a) State Diagram Description</h3>
<table class="w-full logic-table text-sm">
<thead>
<tr>
<th>Current State</th>
<th>Inputs (AB)</th>
<th>Next State</th>
<th>Logic</th>
</tr>
</thead>
<tbody>
<tr><td>0</td><td>00</td><td>0</td><td>A=0, copy B (0)</td></tr>
<tr><td>0</td><td>01</td><td>1</td><td>A=0, copy B (1)</td></tr>
<tr><td>0</td><td>10</td><td>1</td><td>A=1, inv B (1)</td></tr>
<tr><td>0</td><td>11</td><td>0</td><td>A=1, inv B (0)</td></tr>
<tr class="border-t border-gray-600">
<td colspan="4" class="text-xs text-gray-500 pt-2">Repeat logic for Current State = 1</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</details>
<!-- Problem 7 & 8 -->
<details class="group mb-6">
<summary class="flex items-center justify-between p-6 rounded-lg cursor-pointer bg-gray-900 border border-gray-700 hover:border-red-500 transition-colors">
<h2 class="text-xl font-bold text-red-400"><span class="text-gray-500 mr-4">07</span> State Tables Guide (Prob 7 & 8)</h2>
<span class="text-2xl group-open:rotate-180 transition-transform"><i class="fas fa-chevron-down"></i></span>
</summary>
<div class="p-6 bg-gray-800/50 border-x border-b border-gray-700 rounded-b-lg">
<p class="text-gray-300 mb-4 text-sm">Problems 7 and 8 require building a <strong>State Table</strong>. Since the exact wire connections are hard to read perfectly from the scan, here is the standard algorithm to solve them:</p>
<div class="space-y-4">
<div class="flex items-start gap-4">
<div class="bg-red-500/20 text-red-400 w-8 h-8 flex items-center justify-center rounded font-bold shrink-0">1</div>
<div>
<h4 class="text-white font-bold">Identify State Variables</h4>
<p class="text-gray-400 text-sm">Look for the Flip-Flops. Label their outputs (e.g., Q1, Q2). These are your "Present State".</p>
</div>
</div>
<div class="flex items-start gap-4">
<div class="bg-red-500/20 text-red-400 w-8 h-8 flex items-center justify-center rounded font-bold shrink-0">2</div>
<div>
<h4 class="text-white font-bold">Write Logic Equations</h4>
<p class="text-gray-400 text-sm">Trace the wires backwards from the D inputs of the Flip-Flops.</p>
<code class="block bg-black p-2 mt-1 text-xs text-green-400 rounded">
Example: D1 = (X AND Q2) OR Q1
</code>
</div>
</div>
<div class="flex items-start gap-4">
<div class="bg-red-500/20 text-red-400 w-8 h-8 flex items-center justify-center rounded font-bold shrink-0">3</div>
<div>
<h4 class="text-white font-bold">Fill the Table</h4>
<p class="text-gray-400 text-sm">Create a table with columns: Present State (Q1 Q2), Input (X), Next State (Q1* Q2*), Output (Z).</p>
</div>
</div>
</div>
<div class="mt-6 p-4 bg-black rounded border border-gray-800">
<h4 class="text-xs font-bold text-gray-500 uppercase mb-2">Sample State Table Layout</h4>
<table class="w-full logic-table text-xs font-mono">
<thead>
<tr>
<th colspan="2">Present</th>
<th>Input</th>
<th colspan="2">Next State</th>
<th>Output</th>
</tr>
<tr>
<th>Q1</th><th>Q2</th>
<th>X</th>
<th>D1 -> Q1*</th><th>D2 -> Q2*</th>
<th>Z</th>
</tr>
</thead>
<tbody>
<tr><td>0</td><td>0</td><td>0</td><td>?</td><td>?</td><td>?</td></tr>
<tr><td>0</td><td>0</td><td>1</td><td>?</td><td>?</td><td>?</td></tr>
<tr><td>0</td><td>1</td><td>0</td><td>?</td><td>?</td><td>?</td></tr>
<tr><td colspan="6" class="text-gray-600">...continue for all combinations (00, 01, 10, 11)</td></tr>
</tbody>
</table>
</div>
</div>
</details>
<footer class="text-center text-gray-600 text-xs mt-12 pb-8">
<p>Generated for Digital Logic HW5 Analysis</p>
</footer>
</div>
</body>
</html>