Digital System Design EEE344 Lecture 3 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1.

Slides:



Advertisements
Similar presentations
Verilog HDL -Introduction
Advertisements

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.
Combinational Logic.
Chap. 6 Dataflow Modeling
Verilog Intro: Part 1.
Hardware Description Language (HDL)
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value Z:high-impedance.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
ELEN 468 Lecture 151 ELEN 468 Advanced Logic Design Lecture 15 Synthesis of Language Construct I.
CS 3850 Lecture 4 Data Type. Physical Data Types The primary data types are for modeling registers (reg) and wires (wire). The reg variables store the.
First Steps in Verilog CPSC 321 Computer Architecture Andreas Klappenecker.
The Multicycle Processor II CPSC 321 Andreas Klappenecker.
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value Z:high-impedance.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
Reconfigurable Computing (EN2911X, Fall07) Lecture 05: Verilog (1/3) Prof. Sherief Reda Division of Engineering, Brown University
Digital System Design Verilog ® HDL Behavioral Modeling (1) Maziar Goudarzi.
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Overview Logistics Last lecture Today HW5 due today
RTL Coding tips Lecture 7,8 Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock.
each of these is an instantiation of “full_adder”
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
ECE 2372 Modern Digital System Design
Workshop Topics - Outline
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.
Module 1.2 Introduction to Verilog
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
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.
Introduction to ASIC flow and Verilog HDL
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Chapter 3: Dataflow Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 3-1 Chapter 3: Dataflow Modeling.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
Structural Description
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
Adapted from Krste Asanovic
ELEN 468 Advanced Logic Design
SystemVerilog for Verification
Verilog Introduction Fall
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Hardware Description Language
Behavioral Modeling in Verilog
Chapter 3: Dataflow Modeling
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
Hardware Description Language
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
COE 202 Introduction to Verilog
Hardware Description Language
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
Hardware Description Language
Hardware Description Language
COE 202 Introduction to Verilog
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

Digital System Design EEE344 Lecture 3 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1

CONTENTS  Logic Values  Nets  Registers  Variable Declaration  Constants  Four Levels of Abstraction

Logic Values  A bit in verilog may contain 4 values: 20’b 0011_1010_101x_x0z0_011z

Nets  Nets are physical connections between components.  The net data types are wire, tri, wor, trior, wand, triand, tri0, tri1, supply0, supply1 and trireg.  Commonly used net is wire wire c // simple wire wand d; assign d = a; // value of d is the logical AND of assign d = b; // a and b

Registers  A register type variable is denoted by reg. Other registers are integer, time and real

Variable Declaration wire signed [ ] ; The range is declared as [Most Significant bit (MSb): Least Significant bit (LSb)]. reg signed [ ] ;

.. Memory declaration: reg [ ] [ : ]; A variable of type reg can also be initialised as: reg x1 =1’b0; // 1-bit reg variable x1 initialize to 0 at declaration Examples

Constants

Four Levels of Abstraction  switch level  gate level  dataflow level  behavioral or algorithmic level.

Switch Level  The code consists of transistors primitives  Not used in practical designing

Gate Level or Structural Modeling  The code is composed of verilog gate primitives

Dataflow Level  It higher level than gate level  The code contain Expressions, operands and operators  Example assign c = a + b;  The value on wire c is continuously driven by the result of the arithmetic operation.  This assignment statement is also called ‘continuous assignment’. In this statement the right hand side must be a variable of type wire, whereas the operands on the left hand side may be of type wire or reg.

Arithmetic Operators

Conditional Operators examples 1. assign out = sel ? a : b; 2. assign out = sel[1] ? ( sel[0] ? in3 : in2 ) : ( sel[0] ? in1 : in0 );

Concatenation and Replication Operators

Replication  A replication operator simply replicates a signal multiple times. Example A 2’b01; B {4{A}} // the replication operator. The operator replicates A four times and assigns the replicated value to B. Thus B = 8’b

Logical Operators They operate on logical operands and result in a logical TRUE or FALSE A= 4; B=0; A&&B= 0, A ||B= 1 Any value that is not equal 0 is considered as 1 If any operand bit is x or z it is considered as x and that operand is treated as 0 by simulator

Logic and Arithmetic Shift Operators Arithmetic Shift right: It Shifts right specified number of bits, fill with value of sign bit if expression is signed, otherwise fill with zero. Arithmetic Shift left: It shifts left specified number of bits and fill with zero.

Logical shift example If we want to shift logically A= 6’b by 2: assign B = A >> 2; This drops two LSBs and appends two zeros at the MSB position, thus: B is 6’b001011

Arithmetic shift example assign B = A >>> 2; This operation will drop two LSBs and appends the sign bit to two MSB locations. Thus B is 6’b

Relational Operators

Reduction Operators.

example  Apply the & reduction operator to a 4-bit number A=4’b1011: assign out= &A;  This operation is equivalent to performing a bitwise & operation on all the bits of A: out = A[0] & A[1] & A[2] & A[3];

Bitwise Arithmetic Operators

If we perform bitwise | (or) operation on two 4-bit numbers A = 4’b1011 and B=4b0011. The Verilog expression computes a 4-bit C:  assign C = A | B; This performs the OR operation on corresponding bits of A and B and the operation is equivalent to: C[0] =A[0] | B[0] C[1] =A[1] | B[1] C[2] =A[2] | B[2] C[3] =A[3] | B[3]

Equality Operators  While comparing A=4’b101x and B=4’b101x using == and===, out = (A==B) will be x and out = (A===B) will be 1

Example 1

Results verification

Example 2

Result verification

Block diagram

Behavioral Level  The behavioral level is the highest level of abstraction in Verilog.  This level provides high level language constructs like for, while, repeat, if else and case.  Verilog restricts all the behavioral statements to be enclosed in a procedural block.

Behavioral Level  In a procedural block all variables on the left hand side of the statements must be declared as of type reg, whereas operands on the right hand side in expressions may be of type reg or wire.  There are two types of procedural block, always and initial.

Initial Procedural Block  The initial block executes only once, starting at t=0 simulation time  The characteristics of an initial block are as follows. This block starts with the initial keyword. If multiple statements are used in the block, they are enclosed within begin and end constructs

This block is non synthesizable. This block is used only in a stimulus. There are usually more than one initial blocks in the stimulus. All initial blocks execute concurrently in arbitrary order, starting at simulation time 0. The simulator kernel executes the initial block until the execution comes to a #delay operator. Then the execution is suspended and the simulator kernel places the execution of this block in the event list for delay time units in the future. After completing delay time units, the execution is resumed where it was left off.

Always block  An always block executes continuously at t=0 and repeatedly thereafter.  An always block is synthesizable provided it adheres to coding guidelines for synthesis.  From the perspective of its execution in a simulator, an always block behaves like an initial block except that, once it ends, it starts repeating itself.

Format of writing procedural blocks

Blocking and Non-blocking Procedural Assignments  Blocking assignment is represented by = in an always block.  The = blocks further statements from execution. Example (a or b) begin c=a && b; d= a || b; end c= a &&b will first complete its execution then d= a || b; will be executed

Non-blocking  In contrast to blocking procedural assignments, non blocking procedural assignments do not block other statements in the block and these statements execute in parallel.  The simulator executes this functionality by assigning the output of these statements to temporary variables, and at the end of execution of the block these temporary variables are assigned to actual variables.

Sensitivity list styles

Example

END