Verilog I: Dr. Paul D. Franzon
Verilog I: Dr. Paul D. Franzon
Verilog I: Dr. Paul D. Franzon
3. Verilog I
Dr. Paul D. Franzon
Units within this module:
1. Introduction HDL-based Design with Verilog
2. A complete example: count.v
Design
3. A complete example: count.v
Verification Synthesis
4. Further examples
References
1. Quick Reference Guides
2. Ciletti, Ch. 4, Appendix I.
3. Smith & Franzon, Chapter 2-6
Attachments Required : Standard Synthesis Script (count.dc)
See Course Outline for further list of references
Course Mantras
Objectives
Describe the THREE coding styles that make up RTL
Describe basic contrasts of VHDL to Verilog
Describe the basic structure of a Verilog Module
Motivation
Starting to get into core of this course
How to design using HDLs
The complexity is NOT in the language but how to use it
Design before coding
Each design portion becomes a portion of code
References
Sutherland Quick Reference Guide
Ciletti:
Sections 5.1 5.9 : Go into more detail than I do (for now)
Smith & Franzon:
Section 6.4 : teaches these basic constructs
Detailed Outline
1. Purpose of HDLs
2. Describing flip-flops
3. Structure of a Verilog Module
4. Verilog vs. VHDL
5. Describing combinational logic
Detailed Outline
1. Purpose of HDLs
2. Describing flip-flops
3. Structure of a Verilog Module
4. Verilog vs. VHDL
5. Describing combinational logic
Purpose of HDLs
Purpose of Hardware Description Languages:
Capture design in Register Transfer Language form
i.e. All registers specified
Synthesis
Basically, a Boolean Combinational Logic optimizer that is timing
aware
always@(posedge clock)
Q <= D;
always@( )
Triggers execution of following code block
( ) called sensitivity list
Describes when execution triggered
Mantra #3
Behavior implies function
Determine the behavior described by the Verilog code
Choose the hardware with the matching behavior
always@(posedge clock)
Q <= D;
Code behavior:
Q re-evaluated every time there is a rising edge of the clock
Q remains unchanged between rising edges
This behavior describes the behavior of an edge-triggered
Flip-flop
2013, Dr. Paul D. Franzon, www.ece.ncsu.edu/erl/faculty/paulf.html 11
Digital ASIC Design
Verilog example
always@(clock or D)
if (clock) Q <=D;
Flip-Flops
Every variable assigned in a block starting with
Sub-module Summary
Verilog is used to capture a design at the Register Transfer Level (RTL)
All variables assigned after an always@(posedge clock) statement
become the outputs of flip-flops
Why? Behavior Function
Detailed Outline
1. Purpose of HDLs
2. Describing flip-flops
3. Structure of a Verilog Module
4. Verilog vs. VHDL
5. Describing combinational logic
Verilog
Based on C, originally Cadence proprietary, now an
IEEE Standard
Quicker to learn, read and design in than VHDL
Has more tools supporting its use than VHDL
Detailed Outline
1. Purpose of HDLs
2. Describing flip-flops
3. Structure of a Verilog Module
4. Verilog vs. VHDL
5. Describing combinational logic
And in Code?
Behavior Function
always@(a or b or c)
if (a) foo = b^c;
else foo = b | c;
Procedural Blocks
Statement block starting with an always@ statement is
called a procedural block
Why?
Statements in block are generally executed in sequence (i.e.
procedurally)
always@(posedge clock)
if (a) foo< = c;
else foo <= b;
Behavior function
foo is re-evaluated on every clock edge ouptut of FF
If;else MUX
Best to limit this practice to simple case statements and if-else
statements (will explain why in a later module)
Summary Exercise
What does each piece of logic specify?
Summary
Three basic synthesizable VL styles
always@(posedge clock) Flip-flops
always@(*) Combinational logic specified as behavior
assign Combinational logic specified as structure
Please do the sub-module quiz before proceeding to the first Verilog 1.2
sub-module