Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.

Slides:



Advertisements
Similar presentations
Digital System Design-II (CSEB312)
Advertisements

Recap : Always block module and_gate (out, in1, in2); inputin1, in2; outputout; regout; or in2) begin out = in1 & in2; end endmodule zAlways.
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Sequential Logic in Verilog
Supplement on Verilog adder examples
Synchronous Sequential Logic
EE 361 Fall 2003University of Hawaii1 Hardware Design Tips EE 361 University of Hawaii.
Combinational Logic.
Table 7.1 Verilog Operators.
Hardware Description Language (HDL)
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
2/9/20031 ECE 551: Digital System Design & Synthesis Lecture Set 4 4.1: Verilog – Procedural Assignments &Scheduling Semantics 4.2: Verilog – More Behavioral.
1 COMP541 Sequential Circuits Montek Singh Sep 17, 2014.
Lecture 12 Latches Section , Block Diagram of Sequential Circuit gates New output is dependent on the inputs and the preceding values.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Digital System Design by Verilog University of Maryland ENEE408C.
ELEN 468 Lecture 81 ELEN 468 Advanced Logic Design Lecture 8 Behavioral Descriptions II.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
Advanced Verilog EECS 270 v10/23/06.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Overview Logistics Last lecture Today HW5 due today
Advanced FPGA Based System Design Lecture-9 & 10 VHDL Sequential Code By: Dr Imtiaz Hussain 1.
Sequential Logic in Verilog
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
1 Verilog Digital System Design Z. Navabi, 2006 Digital Design Flow  Digital Design Flow begins with specification of the design at various levels of.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
ECE 2372 Modern Digital System Design
Chapter 4: Behavioral Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 4-1 Ders – 4: Davranışsal Modelleme.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
ECE/CS 352 Digital System Fundamentals© 2001 C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Spring 2001 Chapters 3 and 4: Verilog – Part 2 Charles R.
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 7: Design Example, Modeling Flip-Flops Spring.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Verilog Part 3 – Chapter.
3/4/20031 ECE 551: Digital System Design * & Synthesis Lecture Set 3 3.1: Verilog - User-Defined Primitives (UDPs) (In separate file) 3.2: Verilog – Operators,
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
M.Mohajjel. Structured Procedures Two basic structured procedure statements always initial All behavioral statements appear only inside these blocks Each.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
COMP541 Sequential Circuits
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
Structural Description
Overview Logistics Last lecture Today HW5 due today
Lecture 10 Flip-Flops/Latches
Verilog Tutorial Fall
Supplement on Verilog FF circuit examples
Verilog Introduction Fall
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
‘if-else’ & ‘case’ Statements
HDL for Sequential Circuits
TODAY’S OUTLINE Procedural Assignments Verilog Coding Guidelines
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
SYNTHESIS OF SEQUENTIAL LOGIC
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
332:437 Lecture 8 Verilog and Finite State Machines
Chapter 4: Behavioral Modeling
COE 202 Introduction to Verilog
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
The Verilog Hardware Description Language
332:437 Lecture 8 Verilog and Finite State Machines
Sequntial-Circuit Building Blocks
Presentation transcript:

Behavioral Modelling - 1

Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit will operate without specifying hardware. There are two important keywords for behavioral description. initial Specifies a single-pass behavior. always Specifies cyclic behavior.

Behavioral Modelling initial keyword is followed by a single statement or a begin…end block The statement following initial is executed once at t=0 and it expires. always keyword is followed by a single statement or a begin…end block The statement following always is executed repeatedly until simulation is stopped. Chapter 5 3

Use of initial and always Chapter 5 4

Use of initial and always. Defines a clock with 20 unit clock period. Chapter 5 5

always and event control expression) begin is called event control operator. waits until the event occurs. When event takes place begin.. end block will be executed. Example: wait for positive edge of clock clock) clock or negedge reset) Chapter 5 6

(A or B or C or OUT2) /* Note: OUT2 is output of one statement but input of another statement */ begin OUT1 = (A&B) | (B&C) | (C&A) ; OUT2 = {A,B,C}; OUT3 = OUT2 >>> 2; OUT4 = OUT2 << 1; /* inside the always block all instructions are executed sequentially, like in programming languages (exceptions will be mentioned later) */ end Multiple statements in always block

(A or B or C) OUT1 = (A&B) | (B&C) | (C&A); (A, B, C) OUT2 = {A, B, C}; (*) OUT3 = OUT2 >> 1; /* All the three always blocks will run concurrently i.e. all the LHS of each of the always blocks will be calculated at the same instant of time */ Multiple always blocks

Procedural Blocks module MultiplexerD (input a, b, s, output w); reg w; b, s) begin if (s) w = b; else w = a; end endmodule alwaysstatement if-elsestatement Can be used when the operation of a unit is too complex to be described by Boolean or conditional expressions Sensitivity list

There are two types of assignments in verilog. In blocking assignment the instuctions are executed sequentially one after the other. In non blocking the left hand side is assigned the value of the right hand side simultaneously at the end of the simulation timestep. These statements are executed in parallel. Blocking and non blocking assignments

Blocking and Nonblocking assignment examples  Blocking assignment: Evaluation and assignment are immediate ( a or b or c) begin x = a | b; //Evaluate a|b and assign value to x y = a ^ b ^ c; // Evaluate a^b^c and assign value to y z = b & ~c; //Evaluate b & ~c and assign value to z end  Non Blocking assignment: Assignments deferred until right hand side has been evaluated (assigned at the end of timestep) (a or b or c) begin x <= a | b; //Evaluate a|b but defer assignment of x y <= a ^ b ^ c; // Evaluate a^b^c but defer assignment of y z <= b & ~c; // Evaluate b & ~c but defer assignment of z end

Blocking vs. Nonblocking If A=3 and B=5 B=A ; C=B will set B=3 and C=5 B<=A ; C<=B+2 …… will result B=3 and C=7 Chapter 5 12

Swap Operation  Blocking (*) begin temp = b; b=a; a=temp; end  Non blocking (*) begin a<=b; b<=a; end Blocking and non blocking assignments

module blocking (in, clk, out); input in, clk; output out; reg out, q1, q2; (posedge clk) begin q1 = in; q2 = q1; out = q2; end endmodule Blocking and non blocking assignment examples module nonblocking(in, clk, out); input in, clk, out; output out; reg q1, q2, out; (posedge clk) begin q1 <= in; q2 <= q1; out <= q2; end endmodule

Circuits which the above code is synthesized to Blocking Assignment Non Blocking Assignment

You represent all your combinational logic by blocking assignment. You represent all your sequential logic by non- blocking assignment Rule of thumb

Flip-Flop `timescale 1ns/100ps module Flop (reset, din, clk, qout); input reset, din, clk; output qout; reg qout; clk) begin if (reset) qout <= 1'b0; else qout <= din; end endmodule Synchronous reset input A Signal declared as a reg to be capable of holding its values between clock edges Flip-Flops are used in data part for flags and data storage A Non-blocking Assignment A Software-Like Procedural Coding Style Flip-Flop triggers on the falling edge of clk Input The Body of always statement is executed at the negative edge of the clk signal

D flip-flop with active-low asynchronous reset D clk Q Q_n reset_n Behaviour of the circuit  reset_n is active low signal which clears output when low  Q and Q_n are complimentary outputs of the flip flop  On the positive edge of the clock the input D is passed on to the output Q.

D flip-flop with active-low asynchronous reset (posedge clk or negedge reset_n) begin end if(reset_n == 0) begin Q <= 0; Q_n<=1; end else begin Q <= D; Q_n <= !D; end