Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.

Slides:



Advertisements
Similar presentations
CS 3850 Lecture 6 Tasks and Functions. 6.1 Tasks and Functions Tasks are like procedures in other programming languages. e. g., tasks may have zero or.
Advertisements

CPSC 321 Computer Architecture Andreas Klappenecker
Simulation executable (simv)
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 7 Khurram Kazi.
Supplement on Verilog adder examples
Synchronous Sequential Logic
Combinational Logic.
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 07: Verilog (3/3) Prof. Sherief Reda Division of.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
2/9/20031 ECE 551: Digital System Design & Synthesis Lecture Set 4 4.1: Verilog – Procedural Assignments &Scheduling Semantics 4.2: Verilog – More Behavioral.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
ELEN 468 Lecture 81 ELEN 468 Advanced Logic Design Lecture 8 Behavioral Descriptions II.
ELEN 468 Lecture 91 ELEN 468 Advanced Logic Design Lecture 9 Behavioral Descriptions III.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
ELEN 468 Lecture 161 ELEN 468 Advanced Logic Design Lecture 16 Synthesis of Language Construct II.
Verilog HDL (Behavioral Modeling) Bilal Saqib. Behavioral Modeling.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
ECEN ECEN475 Introduction to VLSI System Design Verilog HDL.
Digital System Design Verilog ® HDL Tasks and Functions Maziar Goudarzi.
Advanced Verilog EECS 270 v10/23/06.
Digital System Design Verilog ® HDL Behavioral Modeling (1) Maziar Goudarzi.
2/3/03ΗΥ220 - Μαυροειδής Ιάκωβος1 Delays in Behavioral Verilog - Interassignment Delay  Key idea: unlike blocking delay, RHS is evaluated before delay.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
Digital System Design EEE344 Lecture 3 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1.
Timing control in verilog Module 3.1 Delays in Verilog.
Overview Logistics Last lecture Today HW5 due today
Tasks and Functions Programmable Logic Design (40-493) Fall 2001 Computer Engineering Department Sharif University of Technology Maziar Gudarzi.
Module : TASKS, Functions and UDPs in Verilog. Functions Functions are declared with the keywords function and endfunction. Functions are used if all.
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
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
MODULE 1.3 VERILOG BASICS UNIT 1 : INTRODUCTION TO VERILOG TOPIC : System Tasks and Compiler directive.
Verilog Language Concepts
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
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.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Under-Graduate Project Logic Design with Behavioral Models Speaker: Darcy Tsai Adviser:
Digital System Design Verilog ® HDL Behavioral Modeling Maziar Goudarzi.
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 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
M.Mohajjel. Structured Procedures Two basic structured procedure statements always initial All behavioral statements appear only inside these blocks Each.
 A test bench is an HDL program used for applying stimulus to an HDL design in order to test it and observe its response during simulation.  In addition.
Timing Controls in Behavioral Modeling Programmable Logic Design (40-493) Fall 2001 Computer Engineering Department Sharif University of Technology Maziar.
Verilog® HDL Behavioral Modeling (2)
55:032 - Intro. to Digital DesignPage 1 VHDL and Processes Defining Sequential Circuit Behavior.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU 99-1 Under-Graduate Project Logic Design with Behavioral Models Speaker: 銀子駒 Adviser:
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
Structural Description
Overview Logistics Last lecture Today HW5 due today
Supplement on Verilog FF circuit examples
Verilog Introduction Fall
‘if-else’ & ‘case’ Statements
TODAY’S OUTLINE Procedural Assignments Verilog Coding Guidelines
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
101-1 Under-Graduate Project Logic Design with Behavioral Models
332:437 Lecture 8 Verilog and Finite State Machines
Test Fixture (Testbench)
332:437 Lecture 8 Verilog and Finite State Machines
Introduction to Digital IC Design
Presentation transcript:

Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks

Process Model 2 Basic statements in behavioral modeling initial statement & always statement All other procedural statements appear inside these statements Verilog is concurrent language unlike C; all the initial & always blocks run in parallel. All of them start at simulation time 0

Process Model (cont.) Initial block ( statement inside initial statement ) starts at time 0 and executes only once. If there are multiple blocks, they all start concurrently always block starts at time 0 and executes statements continuously in a loop, e.g. Examples: initial clock = 1’b’0; always # 10 clock = ~clock;

Assignments Continuous assignments assign values to nets (vector and scalar) –They are triggered whenever simulation causes the value of the right-hand side to change –Keyword “assign” e.g. assign out = in1 & in2; Procedural assignments drive values onto registers (vector and scalar) –They Occur within procedures such as always and initial –They are triggered when the flow of execution reaches them (like in C) –Blocking and Non-Blocking procedural assignments

Assignments (cont.) Procedural Assignments –Blocking assignment statement (= operator) acts much like in traditional programming languages. The whole statement is done before control passes on to the next statement –Nonblocking assignment statement (<= operator) evaluates all the right-hand sides for the current time unit and assigns the left-hand sides at the end of the time unit

Assignments (cont.) Assignments Example: reg [0:7] A, B; Initial begin A = 3; #1 A = A + 1; B = A + 1; $display(“Blocking: A=%d B=%d:,A,B); A = 3; #1 A <= A + 1; B <= A + 1; end #1 $display(“Non-blocking: A=%d B=%d”,A,B); endmodule Ouput: Blocking: A=4 B=5 Non-blocking: A=4 B=4

Used when same functionality is required to be used at many places. Both must be defined in a module and are local to the module. They can have local variables, registers, time variable, integers, real but not wires. Tasks are used for the code that contains timing constructs or multiple outputs. Functions are used when the code is purely combinational, executes in 0 simulation time and has only one output. Tasks and Functions

A function can enable another function but not another task Functions always execute in zero simulation time Functions must not contain any delay, even or timing control statements Functions must have at least 1 input argument. can have more than 1 input Functions always return a single value. They can not have output or inout arguments A task can enable another tasks and functions Tasks may execute in non zero simulation time. Tasks may contain delay, event or timing control statements Tasks may have 0 or more arguments of type input, output, inout Tasks don ’ t return with a value but can paas multiple values through output & inout arguments Tasks and Functions (cont.)

task ; endtask To invoke a task: ( );

module tasks Tasks and Functions (cont.) task add; // task definition input a, b; // two input argument ports output c; // one output argument port reg R; // register declaration begin R = 1; if (a == b) c = 1 & R; else c = 0; end endtask initial begin: init1 reg p; add(1, 0, p); // invocation of task with 3 arguments $display("p= %b", p); end endmodule

function ; // Notice: no parameter list or ()s endfunction is the type of results passed back to the expression where the function was called. Inside the function, one must assign the function name a value. Tasks and Functions (cont.)

function [1:1] add2; // function definition input a, b; // two input argument ports reg R; // register declaration begin R = 1; if (a == b) add2 = 1 & R; else add2 = 0; end endfunction initial begin: init1 reg p; p = add2(1, 0); // invocation of function with 2 arguments $display("p= %b", p); end Module functions endmodule

Timing Control Verilog is a discrete event time simulator. If there is no timing control, simulation time does not advance. Simulated time can only progress by one of the following: –gate or wire delay, if specified – a delay control, introduced by the # symbol. –an event control, introduced by symbol. –the wait statement. The order of execution of events in the same clock time may not be predictable.

Delay Control (#) –Expression specifies the time duration between initially encountering the statement and when the statement actually executes. –Delay in Procedural Assignments Inter-Statement Delay Intra-Statement Delay –For example: Inter-Statement Delay #10 A = A + 1; Intra-Statement Delay A = #10 A + 1; Delay based Timing Control

Events –Change in the value of a register or net –Used to trigger execution of a statement or block (reactive behavior/reactivity) Types of Event-based timing control – Regular event control –Named event control –Event OR control –Level-sensitive timing control (wait statement) Event-Based Timing Control (cont.)

Regular event control ) –Events to specify: posedge sig: –Change of sig from any value to 1 or from 0 to any value negedge sig: –Change of sig from any value to 0 or from 1 to any value sig:Any chage in sig value Event-Based Timing Control (cont.)

Regular event control begin A = B&C; clock1) A = clock2) A = B&C; clock3) begin A = B&C; end

Named event control –You can declare (name) an event, and then trigger and recognize it. –Verilog keyword for declaration: event event event1; –Verilog symbol for triggering: -> ->event1 –Verilog symbol begin end Event-Based Timing Control (cont.)

Event OR control –Used when need to trigger a block upon occurrence of any of a set of events. –The list of the events: sensitivity list –Verilog keyword: or –Look at the handout Event OR control Example: ( reset or clock ) begin if ( reset ) q= 1’b0; else q= d; end

wait Statement –The wait statement allows a procedural statement or a block to be delayed until a condition becomes true. –The difference between the behavior of a wait statement and an event is that the wait statement is level sensitive clock); is triggered by a signal transition or is edge sensitive. –For Example: wait (A == 3) begin A = B&C; End Timing Control (cont.)

System tasks $display $finish $monitor $stop

System tasks (cont.) Standard tasks to do routine operations ; appear in form $ $display, $monitor ( similar to “printf” in C programming) Format strings : %d, %b,%s %h etc. $monitor is used to continuously monitors the values of variables and displays all parameters in list whenever value of any variable changes

System tasks (cont.) System Tasks contd. $stop is used to stop during simulation. ( suspend simulation) $finish is used to terminate simulation Compiler Directives : All are defined by using ‘ e.g. ‘define, ‘include { similar to C programming }