Dr. Mike Borowczak · Electrical & Computer Engineering · CECS · UCF
HDL ≠ SoftwareSynth vs SimModule AnatomyLogic Refresher
🌍 Where This Lives
Why Refresh?
You saw gates in a prior class. This refresher is calibration: we're
making sure we use the same names, truth tables, and symbols for
the rest of the course. If we say “priority encoder” in Week 2
and half the class hears something different, debugging becomes
impossible.
What's Different This Time
Now we're looking at gates through the lens of “what Verilog
builds.” The & operator is an AND gate. The ternary
?: is a mux. Every construct in the rest of the course
will map back to the primitives in this video.
Truth tables ↔ Boolean expressions: both directions
The D flip-flop: captures D on clock edge
The Four Gates You'll See Most
Symbol on top, truth table below. 0 = low voltage, 1 = high voltage. That's it — gates are physics, not metaphor.
AND &
A
B
Y
0
0
0
0
1
0
1
0
0
1
1
1
"both"
OR |
A
B
Y
0
0
0
0
1
1
1
0
1
1
1
1
"either"
NOT ~
A
Y
0
1
1
0
"flip it"
(the bubble = invert)
XOR ^
A
B
Y
0
0
0
0
1
1
1
0
1
1
1
0
"different"
NAND, NOR, XNOR are just these with a NOT bubble on the output. Same gates, complement output.
Gates Compose: A 1-bit Adder
Add two 1-bit numbers. 1 + 1 = 10 (binary) — a sum bit and a carry bit.
A
B
Sum
Carry
0
0
0
0
0
1
1
0
1
0
1
0
1
1
0
1
Sum column = XOR truth table. Carry column = AND truth table. That's the whole circuit.
assign sum = a ^ b; // XOR
assign carry = a & b; // AND
Bigger circuits are just more of this. A 32-bit adder is 32 of these chained together (with a carry-in on each). The whole course is "compose primitives, name the result, reuse it."
① Wrap it. Same two assigns, now a named module with pins.
module half_adder (
input wire a, b,
output wire sum, carry
);
assign sum = a ^ b;
assign carry = a & b;
endmodule
② Reuse it. Two half-adders + an OR = full adder (with carry-in).
// NAND: ~(a & b) NOR: ~(a | b)
// Sum-of-products: y = AB + CD
assign y = (a & b) | (c & d);
// DeMorgan's: these produce IDENTICAL hardware
assign y1 = ~(a & b);
assign y2 = ~a | ~b; // same gate!
The synthesizer optimizes. Write for readability — the tool reduces to minimum hardware.
▶ LIVE DEMO
Gates in Verilog
Gate-level Verilog → assign equivalents
lecture_examples/week1_day01/d01_s4_ex3/
AND → OR → XOR → compound expression → verify identical output
Combinational vs. Sequential in Verilog
Combinational
// Output changes whenever
// inputs change
assign y = a & b;
No clock. No memory. Weeks 1–2 focus.
Sequential
// Output changes only on
// the clock edge
always @(posedge clk)
q <= d;
Clock-driven. Has memory. Introduced Topic 4.
You Already Know the Hardware
Gates ✓ Boolean algebra ✓ Truth tables ✓ Flip-flops ✓
This course teaches you the language to describe it.
🤖 Check the Machine
Ask an AI assistant:
“Given a 3-input multiplexer truth table, write the minimal Verilog
using assign and the conditional operator. Then tell me how
many LUT4s it will take on an iCE40.”
TASK
Mux design from truth table + predict LUT count.
BEFORE
Predict: 3-input mux has 3 data + 2 select = 5 inputs. Doesn't fit 1 LUT4. So 2+.
AI can write correct Verilog. AI cannot always predict exact LUT count. Tool wins.
Pre-Class Self-Check
Pause the video and try each question before revealing the answer.
Q1: Name three fundamental differences between writing software and writing Verilog.
① Execution model: sequential vs. concurrent.
② Resources: more code = more time (SW) vs. more hardware (HW).
③ No dynamic allocation: hardware is fixed at synthesis time.
Pre-Class Self-Check (cont.)
Q2: What happens to #10 during synthesis? During simulation?
Simulation: waits 10 time units. Synthesis: completely ignored.
This is why you never use #delay in synthesizable code.
Q3: Write a complete Verilog module that connects i_switch1 to o_led1.
Q4: What does assign mean — a one-time computation or something else?
A permanent physical wire connection. Not one-time.
The output continuously reflects the input — like a wire soldered between two points.
Q5: Does the order of these assign statements matter?
assign y2 = a | b;
assign y1 = a & b;
No. Both create hardware that exists simultaneously.
Swapping them produces identical hardware. This is different from software.
If Q3 felt hard, re-watch Video 3. Getting the module template into muscle memory saves you time in lab.
🔗 End of Topic 1
Tomorrow: Data Types & Operators
Topic 2 · Combinational Building Blocks
▸ WHY THIS MATTERS NEXT
You now have the mental model: Verilog describes concurrent
hardware, two tools consume it (synthesis vs simulation), and modules
are chips with named pins. Topic 2 gives you the working vocabulary
— how to declare signals and combine them. By end of Topic 2 you'll
decode a hex digit to a 7-segment display on the Go Board. Real hardware.
Real output. Tomorrow.