Chapter 3: Dataflow Modeling

Slides:



Advertisements
Similar presentations
Verilog HDL -Introduction
Advertisements

Simulation executable (simv)
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Chap. 6 Dataflow Modeling
Verilog Intro: Part 1.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
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.
The Multicycle Processor II CPSC 321 Andreas Klappenecker.
Reconfigurable Computing (EN2911X, Fall07) Lecture 05: Verilog (1/3) Prof. Sherief Reda Division of Engineering, Brown University
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
Digital System Design EEE344 Lecture 3 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1.
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Chapter 6. Dataflow Modeling. Continuous Assignments The left hand side always be a scalar or vector net or a concatenation of scalar and vector nets.
Programmable Logic Architecture Verilog HDL FPGA Design Jason Tseng Week 5.
ECE 2372 Modern Digital System Design
ECE/CS 352 Digital Systems Fundamentals
Workshop Topics - Outline
Module 1.3 Verilog Basics UNIT 1 : Introduction to Verilog Data Types.
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.
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
CEC 220 Digital Circuit Design Introduction to VHDL Wed, February 25 CEC 220 Digital Circuit Design Slide 1 of 19.
M.Mohajjel. Continuous Assignments Continuously Drive a value onto a net Left hand side must be net Right hand side registers nets function calls Keyword.
Introduction to ASIC flow and Verilog HDL
Sharif University of Technology Department of Computer Engineering Verilog ® HDL Basic Concepts Alireza Ejlali.
Introduction to Verilog. Data Types A wire specifies a combinational signal. – Think of it as an actual wire. A reg (register) holds a value. – A reg.
Introduction to Verilog
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.
Chapter1: Introduction Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 1-1 Chapter 1: Introduction Prof. Ming-Bo.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
CEC 220 Digital Circuit Design Introduction to VHDL Wed, Oct 14 CEC 220 Digital Circuit Design Slide 1 of 19.
Digital System Design Verilog ® HDL Dataflow Modeling Maziar Goudarzi.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Structural Description
Hardware Description Languages: Verilog
Basic Language Concepts
The Machine Model Memory
ELEN 468 Advanced Logic Design
Introduction to Verilog
Discussion 2: More to discuss
KARTHIK.S Lecturer/ECE S.N.G.C.E
Supplement on Verilog adder examples
Lecture 2 Supplement Verilog-01
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Chapter 4 Combinational Logic
Introduction to Verilog
Behavioral Modeling in Verilog
Chapter 2a: Structural Modeling
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
COE 202 Introduction to Verilog
Chapter 4: Behavioral Modeling
Chapter 8: Combinational Logic Modules
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
Logic Circuits I Lecture 3.
Introduction to Verilog
Supplement on Verilog adder examples
Introduction to Verilog
The Verilog Hardware Description Language
Introduction to Verilog
EEE2243 Digital System Design Chapter 1: Verilog HDL (Combinational) by Muhazam Mustapha, February 2012.
Verilog HDL Basic Syntax
COE 202 Introduction to Verilog
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

Chapter 3: Dataflow Modeling Prof. Ming-Bo Lin Department of Electronic Engineering National Taiwan University of Science and Technology

Syllabus Objectives Dataflow modeling Operands Operators

Objectives After completing this chapter, you will be able to: Describe what is the dataflow modeling Describe how to use continuous assignments Describe how to specify delays in continuous assignments Describe the data types allowed in Verilog HDL Describe the operation of the operators used in Verilog HDL Describe the operands may be used associated with a specified operator

Syllabus Objectives Dataflow modeling Operands Operators Introduction Continuous assignment Expressions Delays Operands Operators

Why Dataflow ? Any digital system interconnecting registers combinational logic circuits

Features of Dataflow A powerful way to implement a design Logic synthesis tools can be used to create a gate-level netlist RTL (register transfer level) is a combination of dataflow and behavioral modeling

Syllabus Objectives Dataflow modeling Operands Operators Introduction Continuous assignment Expressions Delays Operands Operators

Basic Statements Continuous assignments Variations Net declaration assignments Implicit net declarations

Continuous Assignments Syntax assign [delay] net_lvalue = expression; assign [delay] net1_lvalue = expr1, [delay] net2_lvalue = expr2, ..., [delay] netn_lvalue = exprn; assign #5 {c_out, sum[3:0]} = a[3:0] + b[3:0] + c_in;

Net Declaration Assignments Only one net declaration assignment per net wire out; // regular continuous assignment assign out = in1 & in2; wire out = in1 & in2; // net declaration assignment

Implicit Net Declarations A feature of Verilog HDL wire in1, in2; assign out = in1 & in2;

Syllabus Objectives Dataflow modeling Operands Operators Introduction Continuous assignment Expressions Delays Operands Operators

Expressions expression = operators + operands Operators Operands

Operators

Operands constants parameters nets variables (reg, integer, time, real, realtime) bit-select part-sel array element function calls

Syllabus Objectives Dataflow modeling Operands Operators Introduction Continuous assignment Expressions Delays Operands Operators

Three Ways of Specifying Delays Regular assignment delay Net declaration assignment delay Net declaration delay

Regular Assignment Delays The inertial delay model is defaulted wire in1, in2, out; assign #10 out = in1 & in2;

Net Declaration Assignment Delays To specify both the delay and assignment on the net The inertial delay model is defaulted // net declaration assignment delay wire #10 out = in1 & in2; // regular assignment delay wire out; assign #10 out = in1 & in2;

Net Declaration Delays Associate a delay value with a net declaration // net delays wire #10 out; assign out = in1 & in2; // regular assignment delay wire out; assign #10 out = in1 & in2;

Syllabus Objectives Dataflow modeling Operands Operators Constants Data types Operators

Types of Constants integer real string

Integer Constants -123 Simple decimal form Base format notation 12345 Base format notation 16’habcd 2009 4’sb1001 // -7

Real Constants Decimal notation Scientific notation 1.5 // 1.5 // .3 // illegal 1294.872 // Scientific notation 15E12 32E-6 26.176_45_e-12

String Constants A sequence of characters enclosed by double quotes ("") Can only be specified in a single line Each character is represented as an 8-bit ASCII code

Syllabus Objectives Dataflow modeling Operands Operators Constants Data types Operators

Data Types Nets Variables Any hardware connection points Any data storage elements

Types of Variable Data Types reg integer time real realtime

The reg Variable Hold a value between assignments May be used to model hardware registers Examples reg a, b; reg [7:0] data_a; reg [0:7] data_b; reg signed [7:0] d;

The integer Variable Contains integer values Has at least 32 bits Is treated as a signed reg variable with the LSB being bit 0 integer i, j; integer data[7:0];

The time Variable Used for storing and manipulating simulation time Used in conjunction with the $time system task Only unsigned value and at least 64 bits, with the LSB being bit 0 time events; time current_time;

The real and realtime Variables Cannot use range declaration Defaulted to zero (0.0) real events; realtime current_time;

Vectors A vector = multiple bit width A scalar = 1-bit vector [high:low] or [low:high] The leftmost bit is the MSB include nets and reg data types A scalar = 1-bit vector

Bit-Select and Part-Select integer and time are allowed real and realtime are not allowed Constant part select: data_bus[3:0], bus[3] Variable part select: [<starting_bit>+:width]: data_bus[8+:8] [<starting_bit>-:width]: data_bus[15-:8]

Array and Memory Elements All net and variable data types are allowed An array element can be a scalar or a vector wire a[3:0]; reg d[7:0]; wire [7:0] x[3:0]; reg [31:0] y[15:0]; integer states [3:0]; time current[5:0];

Memory Memory Reference model ROM, RAM, or register files a whole word or a portion of a word of memory reg [7:0] mema [7:0]; reg [7:0] memb [3:0][3:0]; wire sum [7:0][3:0]; mema[4][3] mema[5][7:4] memb[3][1][1:0] sum[5][0]

Syllabus Objectives Dataflow modeling Operands Operators Bitwise operators Arithmetic operators Concatenation/replication operators Reduction operators Logical operators Relational/equality operators Shift operators Conditional operator

Bitwise Operators A bit-by-bit operation A z is treated as x The shorter operand is zero-extended

An Example --- A 4-to-1 MUX // using basic and, or , not logic operators assign out = (~s1 & ~s0 & i0) | (~s1 & s0 & i1) | (s1 & ~s0 & i2) | (s1 & s0 & i3) ;

Syllabus Objectives Dataflow modeling Operands Operators Bitwise operators Arithmetic operators Concatenation/replication operators Reduction operators Logical operators Relational/equality operators Shift operators Conditional operator

Arithmetic Operators The result is x if any operand bit has a value x Negative numbers are represented as 2’s complement

Syllabus Objectives Dataflow modeling Operands Operators Bitwise operators Arithmetic operators Concatenation/replication operators Reduction operators Logical operators Relational/equality operators Shift operators Conditional operator

Concatenation/Replication Operators Concatenation operator y = {a, b[0], c[1]}; Replication operator y = {a, {4{b[0]}}, c[1]};

An Example --- A 4-Bit Full Adder // specify the function of a 4-bit adder assign {c_out, sum} = x + y + c_in;

A 4-Bit Two’s Complement Adder // specify the function of a two's complement adder assign t = y ^ {4{c_in}}; assign {c_out, sum} = x + t + c_in;

Syllabus Objectives Dataflow modeling Operands Operators Bitwise operators Arithmetic operators Concatenation/replication operators Reduction operators Logical operators Relational/equality operators Shift operators Conditional operator

Reduction Operators Perform only on one vector operand Carry out a bit-wise operation Yield a 1-bit result Work bit by bit from right to left

A 9-Bit Parity Generator // dataflow modeling using reduction operator assign ep = ^x; // even parity generator assign op = ~ep; // odd parity generator

An All-Bit-Zero/One Detector // dataflow modeling assign zero = ~(|x); // all-bit zero assign one = &x; // all-bit one

Syllabus Objectives Dataflow modeling Operands Operators Bitwise operators Arithmetic operators Concatenation/replication operators Reduction operators Logical operators Relational/equality operators Shift operators Conditional operator

Logical Operators Always evaluate to a 1-bit value, 0, 1, or x The result is x (a false condition) if any operand bit is x or z

Syllabus Objectives Dataflow modeling Operands Operators Bitwise operators Arithmetic operators Concatenation/replication operators Reduction operators Logical operators Relational/equality operators Shift operators Conditional operator

Relational Operators The result is 1 if the expression is true and 0 if the expression is false Return x if any operand bit is x or z

Equality Operators Compare the two operands bit by bit The shorter operand is zero-extended Return 1 if the expression is true and 0 if the expression is false

Equality Operators The operators (==, !=) The operators (===, !==) yield an x if any operand bit is x or z The operators (===, !==) yield a 1 if the two operands exactly match 0 if the two operands not exactly match

A 4-B Magnitude Comparator // dataflow modeling using relation operators assign Oaeqb = (a == b) && (Iaeqb == 1); // = assign Oagtb = (a > b) || ((a == b)&& (Iagtb == 1)); // > assign Oaltb = (a < b) || ((a == b)&& (Ialtb == 1)); // <

Syllabus Objectives Dataflow modeling Operands Operators Bitwise operators Arithmetic operators Concatenation/replication operators Reduction operators Logical operators Relational/equality operators Shift operators Conditional operator

Shift Operators Logical shift operators Arithmetic shift operators

An Example of Shift Operators input signed [3:0] x; output [3:0] y; output signed [3:0] z; assign y = x >> 1; assign z = x >>> 1;

Syllabus Objectives Dataflow modeling Operands Operators Bitwise operators Arithmetic operators Concatenation/replication operators Reduction operators Logical operators Relational/equality operators Shift operators Conditional operator

The Conditional Operator Usage: condition_expr ? true_expr: false_expr; If condition_expr = x or z: the result = true_expr & false_expr (0 and 0 gets 0, 1 and 1 gets 1, others gets x ) For example assign out = selection ? in_1: in_0;

An Example --- A 4-to-1 MUX // using conditional operator (?:) assign out = s1 ? ( s0 ? i3 : i2) : (s0 ? i1 : i0) ;