Wire Type
Part of the Fundamentals section of Coddy's Verilog journey — lesson 6 of 90.
In Verilog, we need to declare what type of signal we're using. The most common type is wire.
A wire represents a physical connection between components. It's like a real wire in a circuit.
- Wires cannot store values - they just pass values through
- Wires are used with
assignstatements - Wires are used to connect modules together
Declaring a Wire
wire a; // Single-bit wire
wire b, c; // Multiple wires on one lineHow Wires Work
module wire_example;
wire x;
reg y;
assign x = y; // x always follows y
endmodulex is connected to y. Whenever y changes, x changes instantly.
Wires are commonly used to connect inputs and outputs:
module and_gate(
input a, // 'a' is a wire by default
input b, // 'b' is a wire by default
output c // 'c' is a wire by default
);
assign c = a & b; // c is driven by this assignment
endmoduleIn this example, a, b, and c are all wires.
Wires are the "glue" that connect different parts of your circuit together!
Challenge
What to do:
- Add a wire called
temp
Cheat sheet
Wire represents a physical connection between components. Wires cannot store values — they just pass values through.
wire a; // Single-bit wire
wire b, c; // Multiple wires on one lineWires are used with assign statements. Whenever the source changes, the wire updates instantly:
wire x;
assign x = y; // x always follows yModule inputs and outputs are wires by default:
module and_gate(
input a, // wire by default
input b, // wire by default
output c // wire by default
);
assign c = a & b;
endmoduleTry it yourself
module simple(
input a,
input b,
output c
);
assign c = a & b;
// Declare wire temp here
endmoduleThis lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4Operators Part 1
Arithmetic OperatorsModulo OperatorComparison OperatorsRecap - Simple MathBitwise Operators7Assign And Gates
Continuous AssignmentAssign With OperatorsBuilt In Gate PrimitivesAND OR NOT GatesXOR XNOR GatesRecap - Logic Gate Circuit10Decision Making
If StatementIf - ElseRecap - Simple ComparatorCase StatementCasex And CasezRecap - ALU Design5Operators Part 2
Logical OperatorsReduction OperatorsShift OperatorsConcatenation OperatorConditional OperatorRecap - Operator Challenge3Number System
Binary RepresentationSized NumbersUnsized NumbersNegative NumbersSpecial Values X And ZRecap - Number Formats6Modules
Module StructureInput And Output PortsInout PortsModule InstantiationPort Mapping By NamePort Mapping By OrderRecap - Build A Module9Procedural Blocks
Always BlockInitial BlockSensitivity ListBlocking AssignmentNon Blocking AssignmentRecap - Always vs Initial15Traffic Light Controller
Defining The StatesState Machine Logic