2009 pearson education, upper saddle river, nj 07458. all rights reservedfloyd, digital...
DESCRIPTION
Introduction to HDL/ VerilogTRANSCRIPT
![Page 1: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/1.jpg)
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10th ed
Digital Logic Design
Dr. Oliver Faust
© 2008 Pearson Education
Basic logic design with
verilog
![Page 2: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/2.jpg)
Outline
Introduction to HDL/ Verilog Gate Level ModelingBehavioral Level ModelingTest benchSummary and NotesSimulation using Silos
![Page 3: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/3.jpg)
Introduction to HDL/ Verilog
![Page 4: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/4.jpg)
What is HDL/Verilog Why use HDL (Hardware Description Language)?
HDL ←→ layout by human Reduce cost and time
Verilog is one of the most popular HDLs VHDL (another popular HDL)
Key features of Verilog Supports Various levels
Behavior level (Register Transfer Level, RTL)Gate levelSwitch level
Simulate design functions
![Page 5: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/5.jpg)
Hardware Design Flow
RTLEditor
LogicSynthesizer
RTLSimulation
Gate LevelSimulation
Place & RoutePost Gate
LevelSimulation
Chip
RTL Code
Gate Level Code
Physical Layout
Tape Out
DesignerLevel
High
Low
Cost
Low
High
Verilog
![Page 6: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/6.jpg)
An Example1-bit Multiplexer
in1
in2out
0
1
sel
if (sel==0) out = in1;else out = in2;
out = (sel’‧in1) + (sel‧in2)
sel in1 in2 out
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
to “select” output
![Page 7: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/7.jpg)
Gate Level Description
a1
a2
in1in2
sel
outo1
iv_sel a1_o
a2_on1
iv_sel
Gate Level: you see only gates and wires in the code
![Page 8: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/8.jpg)
Behavioral Level Description
RTL: you may see high level behavior in the codealways block assign
![Page 9: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/9.jpg)
Verilog HDL Syntax
![Page 10: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/10.jpg)
A Simple Verilog Code
declaration syntax
module name in/out port
port/wiredeclaration
kernel hardwaregate-connection/behavior
![Page 11: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/11.jpg)
Module
Basic building block in Verilog. Module
1. Created by “declaration” (can’t be nested)
2. Used by “instantiation“Interface is defined by portsMay contain instances of other modulesAll modules run concurrently
![Page 12: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/12.jpg)
Module Instantiation
Adder
Adder Adder
Adder_tree
instance example
![Page 13: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/13.jpg)
Port Connection
Connect module port by order listFA1 fa1(c_o, sum, a, b, c_i);
Not fully connectedFA1 fa3(c_o,, a, b, c_i);
Connect module port by nameFA1 fa2(.A(a), .B(b), .CO(c_o),.CI(c_i), .S(sum));Recommended
![Page 14: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/14.jpg)
Verilog Language Rule
Case sensitive Identifiers:
Digits 1…9 Underscore _ Upper and lower case letters from the alphabet
Terminate line with semicolon “;” Comments:
Single line: // it’s a single line comment example Multiline: /* when the comment exceeds single line, multiline comment is necessary*/
![Page 15: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/15.jpg)
Register and Net Registers
Keyword : reg, integer, time, real Storage element Assignment in “always” block
Nets Keyword : wire, wand, wor, tri
triand, trior, supply0, supply1 Doesn’t store value, just a connection input, output, inout are default “wire” Can’t appear in “always” block assignment
![Page 16: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/16.jpg)
Value and Number expressions Verilog value set consists of four basic values:
0 represent a logic zero or false condition 1 represent a logic one or true condition x represent an unknown logic value z represent a high-impedance stage
![Page 17: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/17.jpg)
Value and Number Expressions : Examples659 // unsized decimal‘h 837ff // unsized hexadecimal‘o7460 // unsized octal4af // illegal syntax4’b1001 // 4-bit binary5’D 3// 5-bit decimal3’b01x // 3-bit number with
unknown LSB12’hx // 12-bit unknown8’d -6 // illegal syntax-8’d 6 // phrase as - (8’d6)
// underline usage27_195_00016’b0001_0101_0001_111132’h12ab_f001
// X and Z is sign-extended
reg [11:0] a;initialbegin
a = ‘hx; // yields xxxa = ‘h3x; // yields 03xa = ‘h0x; // yields 00x
end
![Page 18: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/18.jpg)
Net Concatenations : An Easy Way to Group Nets
Representations Meanings{b[3:0],c[2:0]} {b[3] ,b[2] ,b[1] ,b[0], c[2] ,c[1] ,c[0]}{a,b[3:0],w,3’b101} {a,b[3] ,b[2] ,b[1] ,b[0],w,1’b1,1’b0,1’b1}{4{w}} {w,w,w,w}{b,{3{a,b}}} {b,a,b,a,b,a,b}
3‘o7
Module AModule B
Module C
![Page 19: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/19.jpg)
(excerpts from CIC training course : Verilog_9807.pdf)
![Page 20: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/20.jpg)
(excerpts from CIC training course : Verilog_9807.pdf)
![Page 21: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/21.jpg)
Compiler Directives `define
`define RAM_SIZE 16 Defining a name and gives a constant value to it.
`include `include adder.v Including the entire contents of other verilog source file.
`timescale `timescale 100ns/1ns Setting the reference time unit and time precision of
your simulation. Only 1, 10, and 100 are legal values.
![Page 22: 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust](https://reader036.vdocuments.net/reader036/viewer/2022081505/5a4d1b727f8b9ab0599b5e8a/html5/thumbnails/22.jpg)
System Tasks $monitor
$monitor ($time,"%d %d %d",address,sinout,cosout); Displays the values of the argument list whenever any of the arguments change except $time.
$display $display ("%d %d %d",address,sinout,cosout); Prints out the current values of the signals in the argument list
$finish $finish Terminate the simulation