Show description
EEE120 Study Hub
EEE120 Study Hub
^ TOP
EEE120 8-BIT STUDY HUB_
Course Overview
Module 1: CLI
Module 1: Logic
Module 2: Numbers
Module 2: Adders
Lab FAQs
Course Overview
Welcome to your EEE120 command center. This guide covers the core concepts from the first modules to help you build, debug, and design digital logic.
Course Modules
Mod 1: Electrical Circuit Fundamentals, Logic Gates, Truth Tables, CLI
Mod 2: Number Systems, Addition & Subtraction, 2's Complement
Mod 3: Boolean Algebra, Logic Minimization, Karnaugh Maps
Mod 4: Advanced Combinational Logic (Multiplexers, Decoders)
Mod 5: Sequential Logic (Latches, Flip Flops, Registers)
Mod 6: Synchronous Finite State Machine (FSM) Design
Mod 7: Microprocessor Design
Mod 8: Final Exam Review
Lab Experiments
The labs guide you through building a 4-bit CPU in the 'Digital' simulator.
Lab 0: Simulator Tutorial
Lab 1: Half Adder, Incrementer, 4-Bit Full Adder
Lab 2: Multiplexer, Decoder, ALU, 7-Segment Display
Lab 3: The Brainless Microprocessor
Lab 4: The Complete Microprocessor
Capstone: Design your own FSM.
Module 1: Command Line Interface (CLI)
This section covers the essential commands for Bash (Mac/Linux) and PowerShell (Windows).
Bash / Linux
Windows PowerShell
Bash (Mac/Linux) Commands
Navigation & Info
Command
Description
pwd
Print Working Directory (shows your current location).
ls
List files and directories.
ls -l
Long list (shows permissions, owner, size, date).
ls -a
List all files (including hidden . files).
cd [dir]
Change directory. cd .. goes up one level. cd ~ or cd goes home.
whoami
Shows your account name.
history
Shows last-used commands.
man [cmd]
Show the manual page for a command (e.g., man ls).
File & Directory Manipulation
Command
Description
mkdir [name]
Make a new directory.
touch [file]
Create a new, empty file.
cp [src] [dest]
Copy a file or directory. Use cp -r for recursive copy (folders).
mv [src] [dest]
Move a file.…
EEE120 Study Hub
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EEE120 Study Hub</title>
<style>
/* * CSS3 STYLING: 8-BIT RETRO THEME
*/
/* Import 8-bit fonts from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');
/* * :root variables for easy theme editing
*/
:root {
--font-header: 'Press Start 2P', monospace;
--font-body: 'VT323', monospace;
--color-bg: #121212;
--color-text: #f0f0f0;
--color-primary: #00ff00; /* Neon Green */
--color-secondary: #ff00ff; /* Magenta */
--color-accent: #00ffff; /* Cyan */
--color-dark-accent: #003300;
--color-shadow: #005000;
}
/* * Base & Body Styling
*/
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
scroll-behavior: smooth;
}
body {
background-color: var(--color-bg);
color: var(--color-text);
font-family: var(--font-body);
font-size: 24px;
line-height: 1.6;
padding: 20px;
/* Scanline overlay effect */
position: relative;
overflow-x: hidden;
}
body::after {
content: " ";
display: block;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: linear-gradient(rgba(18, 18, 18, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
background-size: 100% 4px, 6px 100%;
z-index: 9999;
pointer-events: none;
animation: scanline 0.2s linear infinite;
}
@keyframes scanline {
0% { background-position: 0 0; }
100% { background-position: 0 4px; }
}
/* * Typography
*/
h1, h2, h3, h4 {
font-family: var(--font-header);
color: var(--color-primary);
margin-bottom: 20px;
text-shadow: 2px 2px 0px var(--color-shadow);
}
h1 { font-size: 2.5rem; text-align: center; margin-bottom: 40px; }
h2 { font-size: 2rem; margin-top: 40px; border-bottom: 2px solid var(--color-primary); padding-bottom: 10px; }
h3 { font-size: 1.5rem; color: var(--color-secondary); margin-top: 30px; }
h4 { font-size: 1.2rem; color: var(--color-accent); margin-top: 20px; }
a {
color: var(--color-accent);
text-decoration: underline;
}
a:hover {
color: var(--color-secondary);
background-color: var(--color-dark-accent);
}
/* * Code & Preformatted Text
*/
code {
background-color: #222;
padding: 2px 6px;
color: var(--color-accent);
font-family: var(--font-body);
font-size: 24px;
}
pre {
background-color: #1a1a1a;
border: 2px dashed var(--color-primary);
padding: 15px;
margin: 20px 0;
overflow-x: auto;
white-space: pre-wrap;
word-wrap: break-word;
font-size: 22px;
color: #f0f0f0;
}
pre code {
padding: 0;
background: none;
}
/* * Layout & Containers
*/
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
section {
background-color: #1a1a1a;
border: 2px solid var(--color-primary);
margin-bottom: 40px;
padding: 20px;
/* 8-bit blocky shadow */
box-shadow: 8px 8px 0px var(--color-shadow);
transition: all 0.1s ease-in;
}
section:hover {
box-shadow: 10px 10px 0px var(--color-secondary);
}
/* * Navigation Bar
*/
nav {
background-color: #222;
border: 2px solid var(--color-primary);
padding: 10px;
text-align: center;
margin-bottom: 40px;
box-shadow: 8px 8px 0px var(--color-shadow);
}
nav a {
font-family: var(--font-header);
font-size: 14px;
color: var(--color-primary);
text-decoration: none;
padding: 10px 15px;
margin: 0 5px;
transition: all 0.1s ease-in;
display: inline-block;
}
nav a:hover {
background-color: var(--color-primary);
color: var(--color-bg);
box-shadow: 4px 4px 0px var(--color-shadow);
transform: translate(-2px, -2px);
}
/* * Tables
*/
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
font-size: 22px;
}
th, td {
border: 2px solid var(--color-primary);
padding: 12px;
text-align: left;
}
th {
background-color: var(--color-dark-accent);
font-family: var(--font-header);
font-size: 14px;
color: var(--color-primary);
}
td:first-child {
color: var(--color-accent);
font-weight: bold;
}
/* * Tabs (for CLI)
*/
.tab-container {
border: 2px solid var(--color-secondary);
box-shadow: 6px 6px 0px var(--color-secondary);
}
.tab-nav {
display: flex;
background-color: #222;
}
.tab-button {
font-family: var(--font-header);
font-size: 16px;
background-color: #222;
color: var(--color-secondary);
border: none;
border-right: 2px solid var(--color-secondary);
padding: 15px 20px;
cursor: pointer;
transition: all 0.1s ease-in;
}
.tab-button:hover {
background-color: var(--color-secondary);
color: var(--color-bg);
}
.tab-button.active {
background-color: var(--color-secondary);
color: var(--color-bg);
text-shadow: 1px 1px 0px #fff;
}
.tab-content {
padding: 20px;
display: none; /* Hidden by default, shown by JS */
}
.tab-content.active {
display: block;
}
/* * Logic Gate Cards
*/
.gate-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
}
.gate-card {
border: 2px solid var(--color-accent);
padding: 15px;
background-color: #222;
box-shadow: 6px 6px 0px var(--color-accent);
}
.gate-card h4 {
border-bottom: 1px solid var(--color-accent);
padding-bottom: 5px;
}
/* * FAQ Accordion
*/
details {
border: 2px solid var(--color-primary);
margin-bottom: 10px;
background-color: #222;
}
summary {
font-family: var(--font-header);
font-size: 14px;
padding: 15px;
color: var(--color-primary);
cursor: pointer;
outline: none;
}
details[open] summary {
background-color: var(--color-dark-accent);
}
details > div {
padding: 0 20px 20px 20px;
border-top: 2px solid var(--color-primary);
}
details p {
margin-bottom: 10px;
}
/* * Footer
*/
footer {
text-align: center;
margin-top: 50px;
color: #777;
font-family: var(--font-header);
font-size: 12px;
}
/* * Scroll-to-Top Button
*/
#scrollTopBtn {
display: none; /* Hidden by default */
position: fixed;
bottom: 30px;
right: 30px;
z-index: 99;
font-family: var(--font-header);
font-size: 14px;
border: 2px solid var(--color-secondary);
outline: none;
background-color: var(--color-secondary);
color: var(--color-bg);
cursor: pointer;
padding: 15px;
box-shadow: 6px 6px 0px #500050;
}
#scrollTopBtn:hover {
background-color: var(--color-accent);
color: var(--color-bg);
border-color: var(--color-accent);
box-shadow: 6px 6px 0px #005050;
}
/* Blinking Cursor Animation */
.blinking-cursor {
animation: blink 1s step-end infinite;
}
@keyframes blink {
from, to { opacity: 1; }
50% { opacity: 0; }
}
</style>
</head>
<body>
<button onclick="scrollToTop()" id="scrollTopBtn" title="Go to top">^ TOP</button>
<header>
<h1>EEE120 <span style="color: var(--color-secondary);">8-BIT</span> STUDY HUB<span class="blinking-cursor">_</span></h1>
</header>
<nav>
<a href="#overview">Course Overview</a>
<a href="#cli">Module 1: CLI</a>
<a href="#logic">Module 1: Logic</a>
<a href="#numbers">Module 2: Numbers</a>
<a href="#adders">Module 2: Adders</a>
<a href="#faqs">Lab FAQs</a>
</nav>
<div class="container">
<section id="overview">
<h2>Course Overview</h2>
<p>Welcome to your EEE120 command center. This guide covers the core concepts from the first modules to help you build, debug, and design digital logic.</p>
<h3>Course Modules</h3>
<ul>
<li><strong>Mod 1:</strong> Electrical Circuit Fundamentals, Logic Gates, Truth Tables, CLI</li>
<li><strong>Mod 2:</strong> Number Systems, Addition & Subtraction, 2's Complement</li>
<li><strong>Mod 3:</strong> Boolean Algebra, Logic Minimization, Karnaugh Maps</li>
<li><strong>Mod 4:</strong> Advanced Combinational Logic (Multiplexers, Decoders)</li>
<li><strong>Mod 5:</strong> Sequential Logic (Latches, Flip Flops, Registers)</li>
<li><strong>Mod 6:</strong> Synchronous Finite State Machine (FSM) Design</li>
<li><strong>Mod 7:</strong> Microprocessor Design</li>
<li><strong>Mod 8:</strong> Final Exam Review</li>
</ul>
<h3>Lab Experiments</h3>
<p>The labs guide you through building a 4-bit CPU in the 'Digital' simulator.</p>
<ul>
<li><strong>Lab 0:</strong> Simulator Tutorial</li>
<li><strong>Lab 1:</strong> Half Adder, Incrementer, 4-Bit Full Adder</li>
<li><strong>Lab 2:</strong> Multiplexer, Decoder, ALU, 7-Segment Display</li>
<li><strong>Lab 3:</strong> The Brainless Microprocessor</li>
<li><strong>Lab 4:</strong> The Complete Microprocessor</li>
<li><strong>Capstone:</strong> Design your own FSM.</li>
</ul>
</section>
<section id="cli">
<h2>Module 1: Command Line Interface (CLI)</h2>
<p>This section covers the essential commands for Bash (Mac/Linux) and PowerShell (Windows).</p>
<div class="tab-container">
<div class="tab-nav">
<button class="tab-button active" onclick="openTab(event, 'bash')">Bash / Linux</button>
<button class="tab-button" onclick="openTab(event, 'powershell')">Windows PowerShell</button>
</div>
<div id="bash" class="tab-content active">
<h3>Bash (Mac/Linux) Commands</h3>
<h4>Navigation & Info</h4>
<table>
<thead><tr><th>Command</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>pwd</code></td><td>Print Working Directory (shows your current location).</td></tr>
<tr><td><code>ls</code></td><td>List files and directories.</td></tr>
<tr><td><code>ls -l</code></td><td>Long list (shows permissions, owner, size, date).</td></tr>
<tr><td><code>ls -a</code></td><td>List all files (including hidden <code>.</code> files).</td></tr>
<tr><td><code>cd [dir]</code></td><td>Change directory. <code>cd ..</code> goes up one level. <code>cd ~</code> or <code>cd</code> goes home.</td></tr>
<tr><td><code>whoami</code></td><td>Shows your account name.</td></tr>
<tr><td><code>history</code></td><td>Shows last-used commands.</td></tr>
<tr><td><code>man [cmd]</code></td><td>Show the manual page for a command (e.g., <code>man ls</code>).</td></tr>
</tbody>
</table>
<h4>File & Directory Manipulation</h4>
<table>
<thead><tr><th>Command</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>mkdir [name]</code></td><td>Make a new directory.</td></tr>
<tr><td><code>touch [file]</code></td><td>Create a new, empty file.</td></tr>
<tr><td><code>cp [src] [dest]</code></td><td>Copy a file or directory. Use <code>cp -r</code> for recursive copy (folders).</td></tr>
<tr><td><code>mv [src] [dest]</code></td><td>Move a file. Also used to rename a file.</td></tr>
<tr><td><code>rm [file]</code></td><td>Remove a file.</td></tr>
<tr><td><code>rmdir [dir]</code></td><td>Remove an *empty* directory.</td></tr>
<tr><td><code>rm -r [dir]</code></td><td>Recursively remove a directory and all its contents (DANGEROUS!).</td></tr>
<tr><td><code>ln [src] [link]</code></td><td>Create a link.</td></tr>
</tbody>
</table>
<h4>Viewing & Searching</h4>
<table>
<thead><tr><th>Command</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>cat [file]</code></td><td>Concatenate and print the entire file to the screen.</td></tr>
<tr><td><code>more [file]</code></td><td>View a file, one page at a time (scroll down only).</td></tr>
<tr><td><code>less [file]</code></td><td>View a file (scroll up and down).</td></tr>
<tr><td><code>head [file]</code></td><td>Show the first 10 lines of a file.</td></tr>
<tr><td><code>find . -name "*.txt"</code></td><td>Find files with a <code>.txt</code> extension in the current directory.</td></tr>
<tr><td><code>grep "text" [file]</code></td><td>Search for "text" inside a file.</td></tr>
<tr><td><code>which [cmd]</code></td><td>Shows the location of a command (e.g., <code>which ls</code>).</td></tr>
</tbody>
</table>
<h4>Pipes, Redirects, & Wildcards</h4>
<table>
<thead><tr><th>Symbol</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>></code></td><td>Redirect output to a file (overwrites). <code>ls > files.txt</code></td></tr>
<tr><td><code><</code></td><td>Redirect input from a file. <code>./program < input.txt</code></td></tr>
<tr><td><code>|</code></td><td>Pipe. Use the output of one command as the input for another. <code>sort file.txt | grep "e"</code></td></tr>
<tr><td><code>*</code></td><td>Wildcard: matches 0 or more characters. <code>ls *.txt</code></td></tr>
<tr><td><code>?</code></td><td>Wildcard: matches exactly 1 character. <code>ls ?.txt</code></td></tr>
</tbody>
</table>
</div>
<div id="powershell" class="tab-content">
<h3>PowerShell (Windows) Commands</h3>
<p>Note: PowerShell often has aliases to make commands look like Bash (e.g., <code>ls</code>, <code>pwd</code>, <code>cat</code>).</p>
<h4>Navigation & Info</h4>
<table>
<thead><tr><th>Command</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>pwd</code> (alias)</td><td>Get-Location. Shows your current directory.</td></tr>
<tr><td><code>ls</code> (alias)</td><td>Get-ChildItem. Lists files and directories.</td></tr>
<tr><td><code>ls -hidden</code></td><td>Lists hidden files.</td></tr>
<tr><td><code>cd [dir]</code></td><td>Set-Location. Changes directory.</td></tr>
<tr><td><code>history</code></td><td>Get-History. Shows last-used commands.</td></tr>
<tr><td><code>tracert [ip]</code></td><td>Trace the network route to an address.</td></tr>
</tbody>
</table>
<h4>File & Directory Manipulation</h4>
<table>
<thead><tr><th>Command</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>New-Item -ItemType directory -Path "name"</code></td><td>Make a new directory.</td></tr>
<tr><td><code>New-Item -ItemType file -Path "file.txt"</code></td><td>Create a new, empty file.</td></tr>
<tr><td><code>cp [src] [dest]</code></td><td>Copy-Item. Use <code>cp -r</code> for recursive.</td></tr>
<tr><td><code>mv [src] [dest]</code></td><td>Move-Item. Also renames files.</td></tr>
<tr><td><code>rm [file]</code></td><td>Remove-Item. Use <code>rm -r</code> for recursive.</td></tr>
</tbody>
</table>
<h4>Viewing & Searching</h4>
<table>
<thead><tr><th>Command</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>cat [file]</code> (alias)</td><td>Get-Content. Prints the whole file.</td></tr>
<tr
><td><code>cat -head 10 [file]</code></td><td>Shows the first 10 lines.</td></tr>
<tr><td><code>Get-Content [file] | Select-String "text"</code></td><td>Searches for "text" in a file (like <code>grep</code>).</td></tr>
<tr><td><code>Get-Content [file] | sort</code></td><td>Sorts the contents of a file.</td></tr>
<tr><td><code>where.exe [cmd]</code></td><td>Finds the location of a command.</td></tr>
</tbody>
</table>
<h4>Pipes & Redirects</h4>
<table>
<thead><tr><th>Symbol</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>></code></td><td>Redirect output to a file (overwrites). <code>ls > files.txt</code></td></tr>
<tr><td><code>|</code></td><td>Pipe. Use the output of one command as the input for another.</td></tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="logic">
<h2>Module 1: Digital Logic Gates</h2>
<p>Digital logic is described by truth tables, Boolean equations, and gate symbols.</p>
<div class="gate-grid">
<div class="gate-card">
<h4>AND Gate</h4>
<p>Output is 1 only if <strong>all</strong> inputs are 1.</p>
<p>Expression: <code>Y = A · B</code> (or <code>AB</code>)</p>
<pre>
A | B | Y
---|---|---
0 | 0 | 0
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1</pre>
</div>
<div class="gate-card">
<h4>OR Gate</h4>
<p>Output is 1 if <strong>any</strong> input is 1.</p>
<p>Expression: <code>Y = A + B</code></p>
<pre>
A | B | Y
---|---|---
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 1</pre>
</div>
<div class="gate-card">
<h4>NOT Gate (Inverter)</h4>
<p>Output is the <strong>opposite</strong> of the input.</p>
<p>Expression: <code>Y = A'</code> (or <code>¬A</code>)</p>
<pre>
A | Y
---|---
0 | 1
1 | 0</pre>
</div>
<div class="gate-card">
<h4>XOR Gate (Exclusive OR)</h4>
<p>Output is 1 if inputs are <strong>different</strong>. (Or, an odd number of inputs is 1).</p>
<p>Expression: <code>Y = A ⊕ B</code></p>
<pre>
A | B | Y
---|---|---
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0</pre>
</div>
<div class="gate-card">
<h4>NAND Gate (NOT-AND)</h4>
<p>The <strong>opposite</strong> of an AND gate. A "Universal Gate."</p>
<p>Expression: <code>Y = (A · B)'</code></p>
<pre>
A | B | Y
---|---|---
0 | 0 | 1
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0</pre>
</div>
<div class="gate-card">
<h4>NOR Gate (NOT-OR)</h4>
<p>The <strong>opposite</strong> of an OR gate. A "Universal Gate."</p>
<p>Expression: <code>Y = (A + B)'</code></p>
<pre>
A | B | Y
---|---|---
0 | 0 | 1
0 | 1 | 0
1 | 0 | 0
1 | 1 | 0</pre>
</div>
<div class="gate-card">
<h4>XNOR Gate (Exclusive NOR)</h4>
<p>Output is 1 if inputs are the <strong>same</strong>.</p>
<p>Expression: <code>Y = (A ⊕ B)'</code></p>
<pre>
A | B | Y
---|---|---
0 | 0 | 1
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1</pre>
</div>
</div>
<h3>Key Logic Concepts (from Quiz 1)</h3>
<ul>
<li><strong>Truth Table Size:</strong> A circuit with <strong>N</strong> inputs has <strong>$2^N$</strong> possible combinations (rows) in its truth table. (e.g., 4 inputs -> $2^4 = 16$ rows).</li>
<li><strong>Universal Gates:</strong> All logic circuits can be created using <em>only</em> NAND gates, or <em>only</em> NOR gates.</li>
<li><strong>De Morgan's Law:</strong>
<ul>
<li><code>(A · B)' = A' + B'</code> (A NAND is an OR with inverted inputs)</li>
<li><code>(A + B)' = A' · B'</code> (A NOR is an AND with inverted inputs)</li>
</ul>
</li>
<li><strong>!!! CRITICAL RULE !!!</strong> You should <strong>NEVER</strong> tie two outputs of two distinct circuits together. This can cause a short circuit.</li>
</ul>
</section>
<section id="numbers">
<h2>Module 2: Number Systems</h2>
<p>Computers use binary (Base-2), but humans often use decimal (Base-10), octal (Base-8), or hexadecimal (Base-16) for convenience.</p>
<h3>Number Base Chart</h3>
<table>
<thead><tr><th>Decimal (Base-10)</th><th>Binary (Base-2)</th><th>Hex (Base-16)</th><th>Octal (Base-8)</th></tr></thead>
<tbody>
<tr><td>0</td><td>0000</td><td>0</td><td>0</td></tr>
<tr><td>1</td><td>0001</td><td>1</td><td>1</td></tr>
<tr><td>...</td><td>...</td><td>...</td><td>...</td></tr>
<tr><td>7</td><td>0111</td><td>7</td><td>7</td></tr>
<tr><td>8</td><td>1000</td><td>8</td><td>10</td></tr>
<tr><td>9</td><td>1001</td><td>9</td><td>11</td></tr>
<tr><td>10</td><td>1010</td><td>A</td><td>12</td></tr>
<tr><td>11</td><td>1011</td><td>B</td><td>13</td></tr>
<tr><td>12</td><td>1100</td><td>C</td><td>14</td></tr>
<tr><td>13</td><td>1101</td><td>D</td><td>15</td></tr>
<tr><td>14</td><td>1110</td><td>E</td><td>16</td></tr>
<tr><td>15</td><td>1111</td><td>F</td><td>17</td></tr>
<tr><td>16</td><td>10000</td><td>10</td><td>20</td></tr>
</tbody>
</table>
<h3>Conversions</h3>
<h4>Decimal to Binary (e.g., 88)</h4>
<p>Find the largest power of 2 that fits and subtract. Repeat.</p>
<pre>
88
- 64 (2^6) -> 1
Remaining: 24
- 32 (2^5) -> 0
- 16 (2^4) -> 1
Remaining: 8
- 8 (2^3) -> 1
Remaining: 0
- 4 (2^2) -> 0
- 2 (2^1) -> 0
- 1 (2^0) -> 0
Result: 1011000. As 8-bit: 01011000
</pre>
<h4>Binary to Hexadecimal (e.g., 10101011)</h4>
<p>Group bits into sets of 4 (nibbles) from right to left.</p>
<pre>
Binary: 1010 1011
Group 1: 1010 = 8 + 2 = 10 = A (Hex)
Group 2: 1011 = 8 + 2 + 1 = 11 = B (Hex)
Result: AB
</pre>
<h4>Decimal to Hexadecimal (e.g., 1302)</h4>
<p>Repeatedly divide by 16 and read the remainders from bottom up.</p>
<pre>
1302 / 16 = 81 remainder 6
81 / 16 = 5 remainder 1
5 / 16 = 0 remainder 5
Read remainders up: 516
Result: 516
</pre>
<h3>Signed Binary: Two's Complement</h3>
<p>This is the standard way to represent negative numbers in binary.</p>
<h4>To find a negative number (e.g., -22 in 6 bits):</h4>
<ol>
<li><strong>Get positive binary:</strong> 22 = 16 + 4 + 2 = 10110</li>
<li><strong>Pad to N bits:</strong> (6 bits) -> 010110</li>
<li><strong>Invert all bits (One's Complement):</strong> 101001</li>
<li><strong>Add 1:</strong> 101001 + 1 = 101010</li>
</ol>
<pre>
-22 (decimal) = 101010 (6-bit signed)
</pre>
<h3>Range & Overflow</h3>
<h4>Number Ranges (N bits)</h4>
<ul>
<li><strong>Unsigned:</strong> 0 to ($2^N - 1$)
<ul><li>e.g., 8-bit: 0 to 255</li></ul>
</li>
<li><strong>Signed:</strong> $-(2^{N-1})$ to $+ (2^{N-1} - 1)$
<ul><li>e.g., 6-bit: $-(2^5)$ to $+(2^5 - 1)$ = -32 to +31</li></ul>
</li>
</ul>
<h4>Signed Overflow</h4>
<p>An overflow occurs when the result of an addition is too large (or too small) to fit in the given bits. It can only happen when adding two numbers of the *same sign*.</p>
<p><strong>Rule:</strong> Overflow occurs if the carry **into** the Most Significant Bit (MSB) is <strong>NOT EQUAL</strong> to the carry **out of** the MSB.</p>
<pre>
C_in (to MSB) ≠ C_out (from MSB) => OVERFLOW!
</pre>
<p><em>Example (Q10): 110100 + 110100</em></p>
<pre>
¹ ¹ (Carries)
110100 (-12)
+ 110100 (-12)
----------
101000 (-24)
C_in to MSB = 1
C_out of MSB = 1
Since C_in == C_out, there is NO overflow.
</pre>
</section>
<section id="adders">
<h2>Module 2: Adders & Circuits</h2>
<p>These are the circuits that perform binary addition.</p>
<h3>Half Adder</h3>
<p>Adds two 1-bit numbers (A and B). It has two outputs: Sum and Carry.</p>
<ul>
<li><strong>Sum (S)</strong> = A ⊕ B (XOR)</li>
<li><strong>Carry (C)</strong> = A · B (AND)</li>
</ul>
<table>
<thead><tr><th>A</th><th>B</th><th>Sum</th><th>Carry</th></tr></thead>
<tbody>
<tr><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>0</td><td>1</td><td>1</td><td>0</td></tr>
<tr><td>1</td><td>0</td><td>1</td><td>0</td></tr>
<tr><td>1</td><td>1</td><td>0</td><td>1</td></tr>
</tbody>
</table>
<p>This is the circuit from Quiz Q18, Option A.</p>
<h3>Full Adder</h3>
<p>Adds three 1-bit numbers (A, B, and a Carry In, $C_{in}$). This allows adders to be "cascaded" or "chained" together.</p>
<ul>
<li><strong>Sum (S)</strong> = A ⊕ B ⊕ $C_{in}$</li>
<li><strong>Carry (C)</strong> = (A · B) + ($C_{in}$ · (A ⊕ B))</li>
</ul>
<table>
<thead><tr><th>A</th><th>B</th><th>$C_{in}$</th><th>Sum</th><th>$C_{out}$</th></tr></thead>
<tbody>
<tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>0</td><td>0</td><td>1</td><td>1</td><td>0</td></tr>
<tr><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td></tr>
<tr><td>0</td><td>1</td><td>1</td><td>0</td><td>1</td></tr>
<tr><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td></tr>
<tr><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td></tr>
<tr><td>1</td><td>1</td><td>0</td><td>0</td><td>1</td></tr>
<tr><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td></tr>
</tbody>
</table>
<h3>Multi-bit Adders</h3>
<ul>
<li><strong>4-bit Incrementer:</strong> A circuit that adds 1 to a 4-bit number (a+1).</li>
<li><strong>4-bit Full Adder:</strong> A circuit that adds two 4-bit numbers (A and B) and one $C_{in}$. This is built by chaining 4 Full Adders together. The $C_{out}$ of one bit becomes the $C_{in}$ of the next.</li>
</ul>
</section>
<section id="faqs">
<h2>Lab FAQs & Troubleshooting</h2>
<p>Common issues and solutions from the EEE120 Lab FAQ.</p>
<details>
<summary>What do I turn in?</summary>
<div>
<p><strong>TWO items are required:</strong></p>
<ol>
<li>The filled-out lab template (doc or pdf).</li>
<li>A <code>.zip</code> file of your *entire* lab folder.</li>
</ol>
<p>Double-check you submitted the correct files!</p>
</div>
</details>
<details>
<summary>GTKWave: Why are my waveforms all red (unknown 'x' state)?</summary>
<div>
<p>This is the most common error. It means your circuit's input/output names do <strong>NOT EXACTLY</strong> match the names specified in the lab manual.</p>
<p>Check for:</p>
<ul>
<li>Spelling errors (e.g., <code>Cout</code> vs <code>cout</code>)</li>
<li>Capitalization errors</li>
<li>Extra spaces</li>
</ul>
</div>
</details>
<details>
<summary>Digital Error: "A name is missing. Have e.g. all pins a label set?"</summary>
<div>
<p>You have an input or output pin in your circuit that you forgot to label. Find the pin and set its "Label" property.</p>
</div>
</details>
<details>
<summary>Digital Error: "Several outputs are connected to each other"</summary>
<div>
<p>You have connected two <strong>outputs</strong> (e.g., the outputs of two different gates) to the same wire. This is NOT allowed.</p>
<p>This can also happen from an accidental "extra" wire. You may need to move components around to find where the short circuit is.</p>
</div>
</details>
<details>
<summary>Digital Error: "Bit count of splitter is not matching"</summary>
<div>
<p>You used a splitter/merger component, but the bits don't add up. This is common when you forget to set the "Bit count" property of a main input or output pin.</p>
<p>For example, if you connect a 4-bit wire to a splitter, but the input pin it's coming from is still set to the default of 1 bit.</p>
</div>
</details>
<details>
<summary>iverilog Error: "...syntax error I give up"</summary>
<div>
<p>This is almost always caused by a <strong>space in a name</strong> (e.g., a wire labeled "my wire"). Verilog does not allow spaces in names. Go back into Digital and remove the space.</p>
</div>
</details>
<details>
<summary>I changed my <code>.v</code> file, but the simulation didn't change.</summary>
<div>
<p>You must <strong>rerun iverilog</strong> (recompile) every time you change a <code>.v</code> file. The simulation only runs on the last compiled version.</p>
</div>
</details>
</section>
</div>
<footer>
<p>EEE120 Course Assistant Guide // Ready to Ace this Class!</p>
</footer>
<script>
/* * Function: Tabbed Interface for CLI
*/
function openTab(evt, tabName) {
// Get all elements with class="tab-content" and hide them
let tabcontent = document.getElementsByClassName("tab-content");
for (let i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tab-button" and remove the "active" class
let tabbuttons = document.getElementsByClassName("tab-button");
for (let i = 0; i < tabbuttons.length; i++) {
tabbuttons[i].className = tabbuttons[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
}
/* * Function: Scroll-to-Top Button
*/
// Get the button:
let mybutton = document.getElementById("scrollTopBtn");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {
scrollFunction()
};
function scrollFunction() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function scrollToTop() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
</script>
</body>
</html>