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.
The labs guide you through building a 4-bit CPU in the 'Digital' simulator.
This section covers the essential commands for Bash (Mac/Linux) and PowerShell (Windows).
| 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). |
| 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. Also used to rename a file. |
rm [file] | Remove a file. |
rmdir [dir] | Remove an *empty* directory. |
rm -r [dir] | Recursively remove a directory and all its contents (DANGEROUS!). |
ln [src] [link] | Create a link. |
| Command | Description |
|---|---|
cat [file] | Concatenate and print the entire file to the screen. |
more [file] | View a file, one page at a time (scroll down only). |
less [file] | View a file (scroll up and down). |
head [file] | Show the first 10 lines of a file. |
find . -name "*.txt" | Find files with a .txt extension in the current directory. |
grep "text" [file] | Search for "text" inside a file. |
which [cmd] | Shows the location of a command (e.g., which ls). |
| Symbol | Description |
|---|---|
> | Redirect output to a file (overwrites). ls > files.txt |
< | Redirect input from a file. ./program < input.txt |
| | Pipe. Use the output of one command as the input for another. sort file.txt | grep "e" |
* | Wildcard: matches 0 or more characters. ls *.txt |
? | Wildcard: matches exactly 1 character. ls ?.txt |
Note: PowerShell often has aliases to make commands look like Bash (e.g., ls, pwd, cat).
| Command | Description |
|---|---|
pwd (alias) | Get-Location. Shows your current directory. |
ls (alias) | Get-ChildItem. Lists files and directories. |
ls -hidden | Lists hidden files. |
cd [dir] | Set-Location. Changes directory. |
history | Get-History. Shows last-used commands. |
tracert [ip] | Trace the network route to an address. |
| Command | Description |
|---|---|
New-Item -ItemType directory -Path "name" | Make a new directory. |
New-Item -ItemType file -Path "file.txt" | Create a new, empty file. |
cp [src] [dest] | Copy-Item. Use cp -r for recursive. |
mv [src] [dest] | Move-Item. Also renames files. |
rm [file] | Remove-Item. Use rm -r for recursive. |
| Command | Description |
|---|---|
cat [file] (alias) | Get-Content. Prints the whole file. |
cat -head 10 [file] | Shows the first 10 lines. |
Get-Content [file] | Select-String "text" | Searches for "text" in a file (like grep). |
Get-Content [file] | sort | Sorts the contents of a file. |
where.exe [cmd] | Finds the location of a command. |
| Symbol | Description |
|---|---|
> | Redirect output to a file (overwrites). ls > files.txt |
| | Pipe. Use the output of one command as the input for another. |
Digital logic is described by truth tables, Boolean equations, and gate symbols.
Output is 1 only if all inputs are 1.
Expression: Y = A · B (or AB)
A | B | Y ---|---|--- 0 | 0 | 0 0 | 1 | 0 1 | 0 | 0 1 | 1 | 1
Output is 1 if any input is 1.
Expression: Y = A + B
A | B | Y ---|---|--- 0 | 0 | 0 0 | 1 | 1 1 | 0 | 1 1 | 1 | 1
Output is the opposite of the input.
Expression: Y = A' (or ¬A)
A | Y ---|--- 0 | 1 1 | 0
Output is 1 if inputs are different. (Or, an odd number of inputs is 1).
Expression: Y = A ⊕ B
A | B | Y ---|---|--- 0 | 0 | 0 0 | 1 | 1 1 | 0 | 1 1 | 1 | 0
The opposite of an AND gate. A "Universal Gate."
Expression: Y = (A · B)'
A | B | Y ---|---|--- 0 | 0 | 1 0 | 1 | 1 1 | 0 | 1 1 | 1 | 0
The opposite of an OR gate. A "Universal Gate."
Expression: Y = (A + B)'
A | B | Y ---|---|--- 0 | 0 | 1 0 | 1 | 0 1 | 0 | 0 1 | 1 | 0
Output is 1 if inputs are the same.
Expression: Y = (A ⊕ B)'
A | B | Y ---|---|--- 0 | 0 | 1 0 | 1 | 0 1 | 0 | 0 1 | 1 | 1
(A · B)' = A' + B' (A NAND is an OR with inverted inputs)(A + B)' = A' · B' (A NOR is an AND with inverted inputs)Computers use binary (Base-2), but humans often use decimal (Base-10), octal (Base-8), or hexadecimal (Base-16) for convenience.
| Decimal (Base-10) | Binary (Base-2) | Hex (Base-16) | Octal (Base-8) |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| ... | ... | ... | ... |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 8 | 10 |
| 9 | 1001 | 9 | 11 |
| 10 | 1010 | A | 12 |
| 11 | 1011 | B | 13 |
| 12 | 1100 | C | 14 |
| 13 | 1101 | D | 15 |
| 14 | 1110 | E | 16 |
| 15 | 1111 | F | 17 |
| 16 | 10000 | 10 | 20 |
Find the largest power of 2 that fits and subtract. Repeat.
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
Group bits into sets of 4 (nibbles) from right to left.
Binary: 1010 1011 Group 1: 1010 = 8 + 2 = 10 = A (Hex) Group 2: 1011 = 8 + 2 + 1 = 11 = B (Hex) Result: AB
Repeatedly divide by 16 and read the remainders from bottom up.
1302 / 16 = 81 remainder 6 81 / 16 = 5 remainder 1 5 / 16 = 0 remainder 5 Read remainders up: 516 Result: 516
This is the standard way to represent negative numbers in binary.
-22 (decimal) = 101010 (6-bit signed)
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*.
Rule: Overflow occurs if the carry **into** the Most Significant Bit (MSB) is NOT EQUAL to the carry **out of** the MSB.
C_in (to MSB) ≠ C_out (from MSB) => OVERFLOW!
Example (Q10): 110100 + 110100
¹ ¹ (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.
These are the circuits that perform binary addition.
Adds two 1-bit numbers (A and B). It has two outputs: Sum and Carry.
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
This is the circuit from Quiz Q18, Option A.
Adds three 1-bit numbers (A, B, and a Carry In, $C_{in}$). This allows adders to be "cascaded" or "chained" together.
| A | B | $C_{in}$ | Sum | $C_{out}$ |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Common issues and solutions from the EEE120 Lab FAQ.
TWO items are required:
.zip file of your *entire* lab folder.Double-check you submitted the correct files!
This is the most common error. It means your circuit's input/output names do NOT EXACTLY match the names specified in the lab manual.
Check for:
Cout vs cout)You have an input or output pin in your circuit that you forgot to label. Find the pin and set its "Label" property.
You have connected two outputs (e.g., the outputs of two different gates) to the same wire. This is NOT allowed.
This can also happen from an accidental "extra" wire. You may need to move components around to find where the short circuit is.
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.
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.
This is almost always caused by a space in a name (e.g., a wire labeled "my wire"). Verilog does not allow spaces in names. Go back into Digital and remove the space.
.v file, but the simulation didn't change.You must rerun iverilog (recompile) every time you change a .v file. The simulation only runs on the last compiled version.