Recap - Timing Control
Part of the Fundamentals section of Coddy's Verilog journey. Lesson 72 of 90.
Challenge
This challenge tests your understanding of delays, gate delays, assignment delays, timescale, and clock generation.
What to do:
- Add a
timescaledirective with1ns / 1ps - Generate a clock that toggles every 5 time units
- Add an AND gate with a 3 time unit gate delay
- Use an assignment delay to assign
atobafter 2 time units (readaimmediately)
Try it yourself
// TODO: Add timescale directive (1ns / 1ps)
module timing_challenge;
reg clk;
reg a, b;
wire out;
initial begin
clk = 0;
end
// TODO: Generate clock that toggles every 5 time units
// TODO: Add AND gate with 3 time unit delay (inputs a, b, output out)
initial begin
$monitor("Time %0t: clk=%b, a=%b, b=%b, out=%b", $time, clk, a, b, out);
a = 1;
// TODO: Use assignment delay to assign a to b after 2 time units
// Read a now, assign to b after 2 time units
#20;
$finish;
end
endmoduleAll 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 Design13Timing And Delays
What Are DelaysGate DelaysAssignment DelaysTimescale DirectiveClock GenerationRecap - Timing Control5Operators 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 LogicPractice on your own: Online Verilog compiler