Introduction to Digital VLSI Design מבוא לתכנון VLSI ספרתי

Similar documents
Chapter 3: Dataflow Modeling

Verilog Dataflow Modeling

Chap 6 - Introduction to HDL (b)

Arithmetic Operators There are two types of operators: binary and unary Binary operators:

ECE Digital System Design & Synthesis Exercise 1 - Logic Values, Data Types & Operators - With Answers

ECEN 468 Advanced Logic Design

Course Topics - Outline

ECE 4514 Digital Design II. Spring Lecture 7: Dataflow Modeling

Lab 4: Arithmetic Logic Unit (ALU)

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

Verilog Design Principles

14:332:231 DIGITAL LOGIC DESIGN. Hardware Description Languages

Lecture #2: Verilog HDL

Chapter 3: Operators, Expressions and Type Conversion

EN2911X: Reconfigurable Computing Lecture 05: Verilog (2)

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Unit 3. Operators. School of Science and Technology INTRODUCTION

Introduction to Verilog. Garrison W. Greenwood, Ph.D, P.E.

Combinational Logic II

Design Using Verilog

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Verilog HDL Introduction

Lab 5: Arithmetic Logic Unit (ALU)

Schematic design. Gate level design. 0 EDA (Electronic Design Assistance) 0 Classical design. 0 Computer based language

VERILOG 2: LANGUAGE BASICS

JAVA OPERATORS GENERAL

IT T35 Digital system desigm y - ii /s - iii

Operators. Java operators are classified into three categories:

Under-Graduate Project Logic Design with Behavioral Models

Contents. Appendix D Verilog Summary Page 1 of 16

Introduction. Purpose. Intended Audience. Conventions. Close

Introduction to Digital VLSI Design מבוא לתכנון VLSI ספרתי

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

EN164: Design of Computing Systems Lecture 06: Lab Foundations / Verilog 2

Introduction. Why Use HDL? Simulation output. Explanation

Verilog Design Principles

A Verilog Primer. An Overview of Verilog for Digital Design and Simulation

In this lecture, we will go beyond the basic Verilog syntax and examine how flipflops and other clocked circuits are specified.

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur

Department of Computer Science and Electrical Engineering. Intro to Verilog II

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

The Arithmetic Operators

CT 229. Java Syntax 26/09/2006 CT229

Operators in C. Staff Incharge: S.Sasirekha

Spring 2017 EE 3613: Computer Organization Chapter 5: Processor: Datapath & Control - 2 Verilog Tutorial

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators

carry in carry 1101 carry carry

Lecture 3 Tao Wang 1

Expression and Operator

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output?

Verilog Tutorial - Edited for CS141

SECTION II: LANGUAGE BASICS

UNIT V: SPECIFICATION USING VERILOG HDL

Computer Aided Design Basic Syntax Gate Level Modeling Behavioral Modeling. Verilog

RUBY OPERATORS. Ruby Arithmetic Operators: Ruby Comparison Operators:

Verilog Language Concepts

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

EE 8351 Digital Logic Circuits Ms.J.Jayaudhaya, ASP/EEE

Verilog. Reminder: Lab #1 due tonight! Fall 2008 Lecture 3

Introduction To Verilog Design. Chun-Hung Chou

a, b sum module add32 sum vector bus sum[31:0] sum[0] sum[31]. sum[7:0] sum sum overflow module add32_carry assign

Department of Computer Science

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3

Fundamentals of Programming

Operators and Type Conversion. By Avani M. Sakhapara Assistant Professor, IT Dept, KJSCE

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

COMP 122/L Lecture 2. Kyle Dewey

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1

Verilog. Like VHDL, Verilog HDL is like a programming language but:

register:a group of binary cells suitable for holding binary information flip-flops + gates

This Lecture. Some components (useful for the homework) Verilog HDL (will continue next lecture)

CS 64 Week 1 Lecture 1. Kyle Dewey

Chapter 2 Using Hardware Description Language Verilog. Overview

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

Lecture 2: Data Types, Modeling Combinational Logic in Verilog HDL. Variables and Logic Value Set. Data Types. Why use an HDL?

Spiral 1 / Unit 4 Verilog HDL. Digital Circuit Design Steps. Digital Circuit Design OVERVIEW. Mark Redekopp. Description. Verification.

Fundamental of Programming (C)

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Unsigned Binary Integers

Unsigned Binary Integers

Register Transfer Level in Verilog: Part I

Introduction to Verilog/System Verilog

Variables and Operators 2/20/01 Lecture #

Digital Design (VIMIAA01) Introduction to the Verilog HDL

Lab #1. Topics. 3. Introduction to Verilog 2/8/ Programmable logic. 2. Design Flow. 3. Verilog --- A Hardware Description Language

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.

LAB K Basic Verilog Programming

Unit-2 (Operators) ANAND KR.SRIVASTAVA

Verilog HDL:Digital Design and Modeling. Chapter 4. Expressions

Advanced Digital Design Using FPGA. Dr. Shahrokh Abadi

CMPE 415 Working with Operands and Variables Prof. Ryan Robucci

LECTURE 3 C++ Basics Part 2

Sir Muhammad Naveed. Arslan Ahmed Shaad ( ) Muhammad Bilal ( )

Chapter 2: Using Data

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

2. Integers. 9 * celsius / Celsius to Fahrenheit. Precedence. (9 * celsius / 5) + 32

Chapter 2, Part III Arithmetic Operators and Decision Making

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

Operators. Lecture 3 COP 3014 Spring January 16, 2018

Transcription:

Design מבוא לתכנון VLSI ספרתי Verilog Dataflow Modeling Lecturer: Semester B, EE Dept. BGU. Freescale Semiconductors Israel 9/3/7

Objectives Describe the continuous assignment ( assign ) statement, restrictions on the assign statement, and the implicit continuous assignment statement Eplain assignment delay, implicit assignment delay, and net declaration delay for continuous assignment statement Define epressions, operators, and operands List operator types for all possible operations arithmetic, logical, relational, equality, bit-wise, reduction, shift, concatenation, and conditional 2 9/3/7

Continuous Assignment A continuous assignment is the most basic statement in dataflow modeling, used to drive a value onto a net A continuous assignment replaces gates in the description of the circuit and describes the circuit at a higher level of abstraction A continuous assignment statement starts with the keyword assign The simplest synta of an assign statement is as follows <continuous_assign> ::= assign <drive_strength>? <delay>? <list_of_assignments> Drive strength is optional and can be specified in terms of strength levels (the default value for drive strength is strong and strong) The delay value is also optional and can be used to specify delay on the assign statement 3 9/3/7

Continuous Assignment Continuous assignments have the following characteristics The left hand side of an assignment must always be scalar or vector net or a concatenation of scalar and vector nets (cannot be a register!!!) Continuous assignments are always active. The assignment epression is evaluated as soon as one of the right-hand-side (RHS) operands changes and the value is assigned to the left-hand-side (LHS) net The operands on the RHS can be registers or nets or function calls. Registers or nets can be scalars or vectors Delay values can be specified for assignments in terms of time units. Delay values are used to control the time when a net is assigned the evaluated value. assign out = i & i2; assign addr[5:] = addr_bits[5:] ^ addr2_bits[5:] 4 9/3/7

Implicit Continuous Assignment Instead of declaring a net and then writing a continuous assignment on the net, Verilog provides a shortcut by which a continuous assignment can be placed on a net when it is declared Can be only one implicit declaration assignment per net because a net is declared only once // Regular continuous assignment wire out; assign out = i & i2; // Same effect is achieved by an implicit continuous assignment wire out = i & i2; 5 9/3/7

Continuous Assignment: Delays Delay values control the time between the change in a RHS operand and when the new value is assigned to the LHS There are three ways of specifying delays in continuous assignment statements Regular assignment delay Implicit continuous assignment delay Net declaration delay 6 9/3/7

Regular Assignment Delay The first method is to assign a delay value in a continuous assignment statement The delay value is specified after the keyword assign Any change in values of in and in2 will result in a delay of time units before re-computation of the epression in & in2, and the result will be assigned to out If in or in2 changes value again before time units when the result propagates to out, the values of in and in2 at the time of recomputation are considered (internal delay) An input pulse that is shorter than the delay of the assignment statement does not propagate to the output assign # out = i & i2; // Delay in a continuous assignment 7 9/3/7

Implicit Continuous Assignment Delay An equivalent method is to use an implicit continuous assignment to specify both a delay and an assignment on the net The declaration below has the same effect as defining wire out and declaring a continuous assignment on out // Implicit continuous assignment delay wire # out = i & i2; // same as wire out; assign # out = i & i2; 8 9/3/7

Net Declaration Delay A delay can be specified on a net when it is declared without putting a continuous assignment on the net If a delay is specified on a net out, then any value change applied to the net out is delayed accordingly Net declaration delays can also be used in gate-level modeling // Net Delays wire # out; assign out = i & i2; // The above statement has the same effect as the following wire out; assign # out = i & i2; 9 9/3/7

Epressions, Operators and Operands Dataflow modeling describes the design in terms of epressions instead of primitive gates The basis of dataflow modeling formed by Epressions constructs that combine operators and operands to produce a result Operands can be constants, integers, real numbers, nets, registers, times, bit-select, part-select, memories or function calls Operators acts on the operands to produce desired results. Verilog provides various types of operators. 9/3/7

Verilog Operator Types () Operators Type Operator Symbol Operation Performed Number of Operands Arithmetic * Multiply / Divide + Add - Subtract % modulus Logical! Logical negation One && Logical and Logical or Relational > Greater than < Less than >= Greater than or equal to <= Less than or equal to 9/3/7

Verilog Operator Types (2) Operators Type Operator Symbol Operation Performed Number of Operands Equality == Equality!= Inequality === Case equality!== Case inequality Bitwise ~ Bitwise negation One & Bitwise and Bitwise or ^ Bitwise or ^~ or ~^ Bitwise nor Reduction & / ~& Reduction and / nand One / ~ Redaction or / nor One ^ / ^~ or ~^ Reduction or / nor One 2 9/3/7

Verilog Operator Types (3) Operators Type Operator Symbol Operation Performed Number of Operands Shift << Right shift >> Left shift Concatenation { } Concatenation Any number Replication { { } } Replication Any number Conditional?: Conditional Three 3 9/3/7

Operators in Verilog: Arithmetic Operators There are two types of arithmetic operators: binary and unary Binary arithmetic operators are multiply (*), divide (/), add (+), subtract (-), and modulus (%) If any operand bit has a value, then the result of the entire epression is (this seems intuitive because if an operand value is not known precisely, the result should be an unknown Modulus operators produce the reminder from the division of two numbers The operators + and - can also work as unary operators They are used to specify the positive or negative sign of the operands and have higher precedence than the binary + or - operators Negative numbers are represented as 2 s complement internally in Verilog (negative numbers of the type <sss> <base> <nnn> should be avoided!!!) Use negative numbers only of the type integer or real in epressions!!! 4 9/3/7

Operators in Verilog: Logical Operators Logical operators are logical -and (&&), -or ( ) and -not (!) Operators && and are binary operators. Operator! Is a unary operator Logical operators follow these conditions Logical operators always evaluate a -bit value, (false), (true), or (ambiguous) In an operand is not equal to zero, it is equivalent to a logical (true condition). If it is equal to zero, it is equivalent to a logical (false condition). If any operand bit is or z, it is equivalent to (ambiguous condition) and it is normally treated by simulators as a false condition Logical operators take variables or epressions as operands Use of parentheses to group logical operands is highly recommended to improve readability (also user does not have to remember the precedence of operators) 5 9/3/7

9/3/7 6 Operators in Verilog: Bitwise Operators Bitwise operators are negation (~), and (&), or ( ), or (^), and nor (^~, ~^) A z is treated as an in bitwise operation Logic tables for the bitwise computation and or or nor Result not

Operators in Verilog: Reduction Operators Reduction operators are and (&), nand (~&), or ( ), nor (~ ), or (^), and nor (^~, ~^) Reduction operators take only one operand Reduction operators perform a bitwise operation on a single vector operand and yield -bit result The logic tables are the same as shown for bitwise operators The difference is that bitwise operation are on bits from two different operands, whereas reduction operations are on the bits of the same operand Reduction operators work bit by bit from right to left Reduction nand, reduction nor, and reduction nor are computed by inverting the result of the reduction and, reduction or, and reduction or, respectively 7 9/3/7

Operators in Verilog: Unary Operators a = and b = Bit-Wise Negation Logical Negation Unary Reduction ~ a =! a = & a = & b = ~ b =! b = a = b = ^ a = ^ b = The bit-wise negation operator inverts the value of each bit of the operand, to produce result with the same number of bits as the operand The logical negation operator reduces an operand to its logical inverse. If an operand contains all zeroes, it is false (logic ). If it is non-zero, it is true (logic ). If it is unknown, its logical value is ambiguous Unary reduction operators and the logical negation operators on all bits of a single operand to produce a single-bit result 8 9/3/7

Operators in Verilog: Binary Operators a = b = c = Bit-Wise Logical a b = a b = a & b = a && b = a c = a c = a & c = a && c = The bit-wise binary operator performs bit-wise manipulation on two operands. They compare each bit in one operand with its corresponding bit in the other operand to calculate each bit for the result Logical binary operators operate on logic values. If an operand contains all zeros, it is false (logic ). If it is non-zero, it is true (logic ). If it is unknown, its logical value is ambiguous Because the operands can be declared to be of different size, the smaller operand is zero-etended to the size of the larger operand during the operation 9 9/3/7

Operators in Verilog: Relation Operators Relation operators are greater-than (>), less-than (<), greater-thanor-equal-to (>=), and less-than-or-equal-to (<=) If relational operators are used in an epression, the epression returns a logical value of (true condition) if the epression is true and logical value of (false condition) if the epression is false If there are any unknown or z bits in the operands, the epression takes the value (ambiguous condition) 2 9/3/7

Operators in Verilog: Equality Operators Equality operators are logical equality (==), logical inequality (!=), case equality (===), and case inequality (!==) When used in an epression, equality operators return logical value if true, if false These operators compare the two operands bit by bit, with zero filling if the operands are of unequal length == z === z a = 2 b; b = 2 b; z a = 2 b; b = 2 b; z if (a == b) $display( a is equal to b ); else $display( a is not equal to b ); if (a === b) $display( a is identical to b ); else $display( a is not identical to b ); 2 9/3/7

Operators in Verilog: Shift Operators Shift operators are right shift (>>) and left shift (<<) These operators shift a vector operand to the right or the left by a specified number of bits The operands are the vector and the number of bits to shift When the bits are shifted, the vacant bit positions are filled with zeros Shift operations do not wrap around // X = 4 b Y = X >> ; Y = X << ; Y = X << 2; // Y is 4 b. Shift right bit. filled in MSB position // Y is 4 b. Shift left bit. filled in LSB position // Y is 4 b. Shift left 2 bits 22 9/3/7

Operators in Verilog: Concatenation Operator The concatenation operator ({, }) provides a mechanism to append multiple operands The operands must be sized (unsized operands are not allowed) Concatenations are epressed as operands within braces, with commas separating the operands Operands can be scalar nets or registers, vector nets or registers, bitselect, part-select, or sized constant // A = b, B = 2 b, C = 2 b, D = 3 b Y = {B, C}; // Result Y is 4 b Y = {A, B, C, D, 3 b}; // Result Y is b Y = {A, B[], C[]}; // Result Y is 3 b 23 9/3/7

Operators in Verilog: Replication Operator Repetitive concatenation of the same number can be epressed by using a replication constant A replication constant specifies how many times to replicate the number inside the brackets ({ }) reg A; reg [:] B, C; reg [2:] D; wire Y[9:]; A = b; B = 2 b; C = 2 b; D = 3 b; Y = { 4{A}}; // Result Y is 4 b Y = { 4{A}, 2{B}}; // Result Y is 8 b Y = { 4{A}, 2{B}, C}; // Result Y is b 24 9/3/7

Operators in Verilog: Conditional Operator The conditional operator (?: ) takes three operands: <LHS> = <condition_epr>? <true_epr> : <false epr> The condition epression (condition_epr) is first evaluated. If the result is true (logical ), then the true_epr is evaluated If the result is false (logical ), then the false_epr is evaluated If the result is (ambiguous), then both true_epr and false_epr are evaluated and their results are compared, bit by bit, to return for each bit position an is the bits are different and the value of the bits if they are the same false_epr true_epr LHS cond_epr 25 9/3/7

Operators in Verilog: Conditional Operator The action of a conditional operator is similar to a multipleer. Alternately, it can be compared to the if-else epression // Model functionality of a tristate buffer assign addr_bus = drive_enable? addr_out : 35 bz; // Model functionality of a 2-to- mu assign out = control? in : in; Conditional operators can be nested. Each true_epr or false_epr can itself be a conditional operation // Check that A==3 and control are the two select signals of // 4-to- mu with n, m,, y as the inputs and out as the // output signal assign out = (A == 3)? ( control? : y ) : ( control? m : n ); 26 9/3/7

Operators in Verilog: Operator Precedence Type of Operators Concatenate & Replicate Unary Arithmetic Logical shift Relational Equality Binary (bit-wise) Binary (logical) Conditional Eamples { } {{ }}! ~ & ^ * / % + - << >> < > >= <= == ===!=!== & ^ ~^ &&?: Degree (highest) Precedence (lowest) 27 9/3/7

Dataflow Modeling Summary Continuous assignment is one of the main constructs used in dataflow modeling. A continuous assignment is always active and the assignment epression is evaluated as soon as one of the RHS variables changes. The LHS of a continuous assignment must be a net. Any logic function can be realized with continuous assignments Delay values control the time between the change in a RHS variable and when the new value is assigned to the LHS. Delays on a net can be defined in the assign statement, implicit continuous assignment, or net declaration Assignment statements contain epressions, operators, and operands The operator types are arithmetic, logical, relational, equality, bitwise, reduction, shift, concatenation, replication, and conditional. Unary operators require one operand, binary operators require two operands, and ternary require three operands. The concatenation operator can take any number of operands The conditional operator behaves like multipleer in hardware or like the if-then-else statement in programming language 28 9/3/7