SlideShare a Scribd company logo
8
Most read
16
Most read
17
Most read
Digital Design Using Verilog
- For Absolute Beginners
LEC 7 :Verilog Behavioral Model
Introduction
• This model is considered as the highest level of
abstraction in the Verilog design modelling methods.
•It is also popularly known as Procedural assignment.
•Verilog behavioral model procedural statements
control the simulation and manipulate variables of the
data types .
•This behavioral model provides a wide scope for the
designer to build any complex design which can be
properly simulated and synthesized.
contd
• These statements are contained within procedures.
Each procedure has an activity flow associated with
it.
•The procedural block of Verilog HDL is defined as “a
region of code containing sequential statements.
•There are two types of procedural blocks.
(i).The always block & (ii).The initial block
• Each initial construct and each always construct
starts a separate activity flow.
• All of the activity flows are concurrent to model
the inherent concurrence of hardware.
Procedural assignments
• Procedural assignments are used for updating reg, integer,
time, real, realtime,and memory data types.
• There is a significant difference between procedural
assignments and continuous assignments:
Continuous assignments drive nets and are evaluated and
updated whenever an input operand
changes its value.
Procedural assignments update the value of variables under
the control of the procedural flow constructs
that surround them.
The always Block
• The ‘always’ block is a continuous loop that never
terminates.
• A Verilog module can contain any number of ‘always’
blocks and all these blocks are executed concurrently.
• The basic syntax of always block is
always @ (sensitivity list)
begin
statement 1
------------
statement n
end
contd
23 June 2020 6yayavaram@yahoo.com
• The sequential statements are executed if and if only
,the signals of the sensitivity list changes .
• The LHS of the statements in ‘always ‘ block is reg
type only.
• Ex: let us consider an example code.
module my-mux(A,B,S,Q,Q_b);
input A,B,S;
output Q,Q_b;
reg Q,Q_b;
always @(A or B or S)
begin
if(S)
Q = A; // procedural descriptions
else Q = B;
end
assign Q = ~Q_b; // continuous assignment
endmodule
23 June 2020 7yayavaram@yahoo.com
contd
The Initial Block
• The initial block is typically used to write test bench
for simulation.
• It specifies the stimulus to be applied to the DUT.
• The initial block is executed only once at the
beginning of the simulation used in the test bench.
23 June 2020 8yayavaram@yahoo.com
Illustration
• module behave;
[1:0] a, b;
initial begin
a = 1’b1;
b = 1’b0;
end
always begin
#50 a = ~a;
end
always begin
#100 b = ~b;
end
endmodule
23 June 2020
9
yayavaram@yahoo.com
contd
• In this model, the reg variables a and b initialize to 1
and 0 respectively at simulation time zero.
• The initial construct is then complete and does not
execute again during this simulation run.
• This initial construct contains a begin-end block
(also called a sequential block) of statements. In this
begin-end block a is initialized first, followed by b.
• The always constructs also start at time zero
23 June 2020 10yayavaram@yahoo.com
contd
• But the values of the variables do not change until
the times specified by the delay controls (introduced
by #) have elapsed.
• Thus, reg a inverts after 50 time units and reg b
inverts after 100 time units.
• Since the always constructs repeat, this model will
produce two square waves.
• The reg a toggles with a period of 100 time units,
and reg b toggles with a period of 200 time units.
• The two always constructs proceed concurrently
throughout the entire simulation run.
23 June 2020 11yayavaram@yahoo.com
Different Sequential Statements
(i).begin
sequential statements
end
Note: If there is a single statement in the block ‘begin’
and ‘end ‘ not required
(ii).if(expression)
Sequential statement
else
Sequential statement
23 June 2020 12yayavaram@yahoo.com
contd
• (iii).case(expression)
expr1 : Sequential statement 1
………..
expr n : Sequential statement n
default : Sequential statement
endcase
• (iv).forever
Sequential statemet
23 June 2020 13yayavaram@yahoo.com
• (v). Repeat(expression)
Sequential statement
• (vi). while(expression)
Sequential statement
• (vii). for (expr1:expr2:expr3)
Sequential expression
• (viii).@(event_expression)
This makes a block of statements suspend until
event expression triggers.
23 June 2020 14yayavaram@yahoo.com
Ex: Sequential Logic (D-F/F)
• module ex_Dff(D,clk,Q,Qb);
input D,clk ;
output Q,Qb;
reg Q, Qb ;
always @(negedge clk)
begin
Q = D;
Qb = ~D;
end
endmodule
23 June 2020 15yayavaram@yahoo.com
Ex: 4 Bit ALU
• module ex_ALU4(Y,A,B,S);
input [3:0]A,B;
input [1:0] S ;
output [3:0] Y;
Parameter ADD=2’b00, SUB =2’b01, MUL = 2’10,
DIV = 2’b11;
always @(A or B or S)
case (S)
ADD : Y = A+B;
23 June 2020 16yayavaram@yahoo.com
contd
SUB : Y = A-B ;
MUL : Y=A * B ;
DIV : Y = A/B;
endcase
endmodule
23 June 2020 17yayavaram@yahoo.com
23 June 2020 18yayavaram@yahoo.com

More Related Content

What's hot (20)

PPTX
Flip flop
Bhaskar Kumar Jha
 
PPTX
Asynchronous Sequential Circuit-Unit 4 ppt
SIVALAKSHMIPANNEERSE
 
PPTX
Verilog Tutorial - Verilog HDL Tutorial with Examples
E2MATRIX
 
PPTX
VHDL Behavioral Description
Sudhanshu Janwadkar
 
PPTX
Combinational circuits
DrSonali Vyas
 
PPT
Interfacing 8255
Anuja Bhakuni
 
PPTX
Latches and flip flops
sheheryar ahmed
 
PPTX
Counters
Ketaki_Pattani
 
PPTX
Hardware Description Language
Prachi Pandey
 
PPT
VHDL
Ramasubbu .P
 
PPT
Sequential circuits
Paresh Parmar
 
PPTX
SEQUENTIAL CIRCUITS INTRODUCTION
Easy n Inspire L
 
PPTX
Combinational Circuits & Sequential Circuits
gourav kottawar
 
PPTX
Data flow model -Lecture-4
Dr.YNM
 
PDF
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Revathi Subramaniam
 
PPTX
Verilog overview
posdege
 
PPTX
Combinational circuit
Satya P. Joshi
 
PDF
Verilog tutorial
Abhiraj Bohra
 
PPTX
Sequential circuits
DrSonali Vyas
 
PPTX
Register in Digital Logic
ISMT College
 
Asynchronous Sequential Circuit-Unit 4 ppt
SIVALAKSHMIPANNEERSE
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
E2MATRIX
 
VHDL Behavioral Description
Sudhanshu Janwadkar
 
Combinational circuits
DrSonali Vyas
 
Interfacing 8255
Anuja Bhakuni
 
Latches and flip flops
sheheryar ahmed
 
Counters
Ketaki_Pattani
 
Hardware Description Language
Prachi Pandey
 
Sequential circuits
Paresh Parmar
 
SEQUENTIAL CIRCUITS INTRODUCTION
Easy n Inspire L
 
Combinational Circuits & Sequential Circuits
gourav kottawar
 
Data flow model -Lecture-4
Dr.YNM
 
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Revathi Subramaniam
 
Verilog overview
posdege
 
Combinational circuit
Satya P. Joshi
 
Verilog tutorial
Abhiraj Bohra
 
Sequential circuits
DrSonali Vyas
 
Register in Digital Logic
ISMT College
 

Similar to Lect 7: Verilog Behavioral model for Absolute Beginners (20)

PPT
Ver1-iitkgp.ppt
SouvikSaha842368
 
PPTX
MODULE 3 process synchronizationnnn.pptx
senthilkumar969017
 
PDF
Sva.pdf
SamHoney6
 
PDF
FPGA Coding Guidelines
Chethan Kumar
 
PPTX
Lecture_Verilog HDL from high-level algorithmic designs to detailed gate-leve...
Rajmohan Madasamy
 
PDF
Lecture-07 Modelling techniques.pdf
NikhilSoni177492
 
PPTX
systemverilog and veriog presentation
KhushiV8
 
PPTX
Test pattern Generation for 4:1 MUX
UrmilasSrinivasan
 
PPT
Verilog Lecture4 2014
Béo Tú
 
PDF
Advanced Digital Design With The Verilog HDL
Tony Lisko
 
PDF
SKEL 4273 CAD with HDL Topic 2
alhadi81
 
PPTX
C language (Part 2)
Dr. SURBHI SAROHA
 
DOCX
15CS202-unitV.docx HDL CODE FOR II/IV JNTU GV
ssuser03e980
 
DOCX
HDL CODE FOR II/IV B.TECH STUDENTS JNTU GV
ssuser03e980
 
PPTX
VERILOG HDL :: Blocking & NON- Blocking assignments
Dr.YNM
 
PPTX
Machine_Learning_JNTUH_R18_UNIT5_CONCEPTS.pptx
Hemavanth1
 
PPTX
Distributed Model Validation with Epsilon
Sina Madani
 
PDF
rtl to gds lecture-10rrrrrrrrrrrrrrrrrrrrrrrrr.pdf
rampawan1
 
PPT
VIT_Workshop.ppt
VINOTHRAJR1
 
Ver1-iitkgp.ppt
SouvikSaha842368
 
MODULE 3 process synchronizationnnn.pptx
senthilkumar969017
 
Sva.pdf
SamHoney6
 
FPGA Coding Guidelines
Chethan Kumar
 
Lecture_Verilog HDL from high-level algorithmic designs to detailed gate-leve...
Rajmohan Madasamy
 
Lecture-07 Modelling techniques.pdf
NikhilSoni177492
 
systemverilog and veriog presentation
KhushiV8
 
Test pattern Generation for 4:1 MUX
UrmilasSrinivasan
 
Verilog Lecture4 2014
Béo Tú
 
Advanced Digital Design With The Verilog HDL
Tony Lisko
 
SKEL 4273 CAD with HDL Topic 2
alhadi81
 
C language (Part 2)
Dr. SURBHI SAROHA
 
15CS202-unitV.docx HDL CODE FOR II/IV JNTU GV
ssuser03e980
 
HDL CODE FOR II/IV B.TECH STUDENTS JNTU GV
ssuser03e980
 
VERILOG HDL :: Blocking & NON- Blocking assignments
Dr.YNM
 
Machine_Learning_JNTUH_R18_UNIT5_CONCEPTS.pptx
Hemavanth1
 
Distributed Model Validation with Epsilon
Sina Madani
 
rtl to gds lecture-10rrrrrrrrrrrrrrrrrrrrrrrrr.pdf
rampawan1
 
VIT_Workshop.ppt
VINOTHRAJR1
 
Ad

More from Dr.YNM (20)

PPT
Introduction to DSP.ppt
Dr.YNM
 
PPT
Atmel.ppt
Dr.YNM
 
PPT
PIC Microcontrollers.ppt
Dr.YNM
 
PPT
Crystalstructure-.ppt
Dr.YNM
 
PPT
Basics of OS & RTOS.ppt
Dr.YNM
 
PPTX
Introducion to MSP430 Microcontroller.pptx
Dr.YNM
 
PPT
Microcontroller-8051.ppt
Dr.YNM
 
PPTX
Introduction to ASICs.pptx
Dr.YNM
 
PPT
VHDL-PRESENTATION.ppt
Dr.YNM
 
PPTX
Basics of data communications.pptx
Dr.YNM
 
PPTX
CPLD & FPGA Architectures and applictionsplications.pptx
Dr.YNM
 
PDF
Transient response of RC , RL circuits with step input
Dr.YNM
 
PPSX
CISC & RISC ARCHITECTURES
Dr.YNM
 
PPSX
Lect 4 ARM PROCESSOR ARCHITECTURE
Dr.YNM
 
PPSX
Lect 3 ARM PROCESSOR ARCHITECTURE
Dr.YNM
 
PPSX
Microprocessor Architecture 4
Dr.YNM
 
PPSX
Lect 2 ARM processor architecture
Dr.YNM
 
PPSX
Microprocessor Architecture-III
Dr.YNM
 
PPSX
LECT 1: ARM PROCESSORS
Dr.YNM
 
PPSX
Microprocessor architecture II
Dr.YNM
 
Introduction to DSP.ppt
Dr.YNM
 
Atmel.ppt
Dr.YNM
 
PIC Microcontrollers.ppt
Dr.YNM
 
Crystalstructure-.ppt
Dr.YNM
 
Basics of OS & RTOS.ppt
Dr.YNM
 
Introducion to MSP430 Microcontroller.pptx
Dr.YNM
 
Microcontroller-8051.ppt
Dr.YNM
 
Introduction to ASICs.pptx
Dr.YNM
 
VHDL-PRESENTATION.ppt
Dr.YNM
 
Basics of data communications.pptx
Dr.YNM
 
CPLD & FPGA Architectures and applictionsplications.pptx
Dr.YNM
 
Transient response of RC , RL circuits with step input
Dr.YNM
 
CISC & RISC ARCHITECTURES
Dr.YNM
 
Lect 4 ARM PROCESSOR ARCHITECTURE
Dr.YNM
 
Lect 3 ARM PROCESSOR ARCHITECTURE
Dr.YNM
 
Microprocessor Architecture 4
Dr.YNM
 
Lect 2 ARM processor architecture
Dr.YNM
 
Microprocessor Architecture-III
Dr.YNM
 
LECT 1: ARM PROCESSORS
Dr.YNM
 
Microprocessor architecture II
Dr.YNM
 
Ad

Recently uploaded (20)

PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PPTX
Benefits_^0_Challigi😙🏡💐8fenges[1].pptx
akghostmaker
 
PPTX
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
PPTX
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPT
inherently safer design for engineering.ppt
DhavalShah616893
 
PDF
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
Electron Beam Machining for Production Process
Rajshahi University of Engineering & Technology(RUET), Bangladesh
 
PPTX
drones for disaster prevention response.pptx
NawrasShatnawi1
 
PPTX
UNIT DAA PPT cover all topics 2021 regulation
archu26
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
Hashing Introduction , hash functions and techniques
sailajam21
 
Benefits_^0_Challigi😙🏡💐8fenges[1].pptx
akghostmaker
 
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
inherently safer design for engineering.ppt
DhavalShah616893
 
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Electron Beam Machining for Production Process
Rajshahi University of Engineering & Technology(RUET), Bangladesh
 
drones for disaster prevention response.pptx
NawrasShatnawi1
 
UNIT DAA PPT cover all topics 2021 regulation
archu26
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 

Lect 7: Verilog Behavioral model for Absolute Beginners

  • 1. Digital Design Using Verilog - For Absolute Beginners LEC 7 :Verilog Behavioral Model
  • 2. Introduction • This model is considered as the highest level of abstraction in the Verilog design modelling methods. •It is also popularly known as Procedural assignment. •Verilog behavioral model procedural statements control the simulation and manipulate variables of the data types . •This behavioral model provides a wide scope for the designer to build any complex design which can be properly simulated and synthesized.
  • 3. contd • These statements are contained within procedures. Each procedure has an activity flow associated with it. •The procedural block of Verilog HDL is defined as “a region of code containing sequential statements. •There are two types of procedural blocks. (i).The always block & (ii).The initial block • Each initial construct and each always construct starts a separate activity flow. • All of the activity flows are concurrent to model the inherent concurrence of hardware.
  • 4. Procedural assignments • Procedural assignments are used for updating reg, integer, time, real, realtime,and memory data types. • There is a significant difference between procedural assignments and continuous assignments: Continuous assignments drive nets and are evaluated and updated whenever an input operand changes its value. Procedural assignments update the value of variables under the control of the procedural flow constructs that surround them.
  • 5. The always Block • The ‘always’ block is a continuous loop that never terminates. • A Verilog module can contain any number of ‘always’ blocks and all these blocks are executed concurrently. • The basic syntax of always block is always @ (sensitivity list) begin statement 1 ------------ statement n end
  • 6. contd 23 June 2020 [email protected] • The sequential statements are executed if and if only ,the signals of the sensitivity list changes . • The LHS of the statements in ‘always ‘ block is reg type only. • Ex: let us consider an example code. module my-mux(A,B,S,Q,Q_b); input A,B,S; output Q,Q_b; reg Q,Q_b;
  • 7. always @(A or B or S) begin if(S) Q = A; // procedural descriptions else Q = B; end assign Q = ~Q_b; // continuous assignment endmodule 23 June 2020 [email protected] contd
  • 8. The Initial Block • The initial block is typically used to write test bench for simulation. • It specifies the stimulus to be applied to the DUT. • The initial block is executed only once at the beginning of the simulation used in the test bench. 23 June 2020 [email protected]
  • 9. Illustration • module behave; [1:0] a, b; initial begin a = 1’b1; b = 1’b0; end always begin #50 a = ~a; end always begin #100 b = ~b; end endmodule 23 June 2020 9 [email protected]
  • 10. contd • In this model, the reg variables a and b initialize to 1 and 0 respectively at simulation time zero. • The initial construct is then complete and does not execute again during this simulation run. • This initial construct contains a begin-end block (also called a sequential block) of statements. In this begin-end block a is initialized first, followed by b. • The always constructs also start at time zero 23 June 2020 [email protected]
  • 11. contd • But the values of the variables do not change until the times specified by the delay controls (introduced by #) have elapsed. • Thus, reg a inverts after 50 time units and reg b inverts after 100 time units. • Since the always constructs repeat, this model will produce two square waves. • The reg a toggles with a period of 100 time units, and reg b toggles with a period of 200 time units. • The two always constructs proceed concurrently throughout the entire simulation run. 23 June 2020 [email protected]
  • 12. Different Sequential Statements (i).begin sequential statements end Note: If there is a single statement in the block ‘begin’ and ‘end ‘ not required (ii).if(expression) Sequential statement else Sequential statement 23 June 2020 [email protected]
  • 13. contd • (iii).case(expression) expr1 : Sequential statement 1 ……….. expr n : Sequential statement n default : Sequential statement endcase • (iv).forever Sequential statemet 23 June 2020 [email protected]
  • 14. • (v). Repeat(expression) Sequential statement • (vi). while(expression) Sequential statement • (vii). for (expr1:expr2:expr3) Sequential expression • (viii).@(event_expression) This makes a block of statements suspend until event expression triggers. 23 June 2020 [email protected]
  • 15. Ex: Sequential Logic (D-F/F) • module ex_Dff(D,clk,Q,Qb); input D,clk ; output Q,Qb; reg Q, Qb ; always @(negedge clk) begin Q = D; Qb = ~D; end endmodule 23 June 2020 [email protected]
  • 16. Ex: 4 Bit ALU • module ex_ALU4(Y,A,B,S); input [3:0]A,B; input [1:0] S ; output [3:0] Y; Parameter ADD=2’b00, SUB =2’b01, MUL = 2’10, DIV = 2’b11; always @(A or B or S) case (S) ADD : Y = A+B; 23 June 2020 [email protected]
  • 17. contd SUB : Y = A-B ; MUL : Y=A * B ; DIV : Y = A/B; endcase endmodule 23 June 2020 [email protected]

Editor's Notes

  • #19: If the value of S is 1 ,then Y= B other wise Y= A