TODAY’S OUTLINE Testbench Circuit Verilog Operators

Slides:



Advertisements
Similar presentations
An Introduction to Verilog: Transitioning from VHDL
Advertisements

Verilog.
The Verilog Hardware Description Language
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Chap. 6 Dataflow Modeling
Chapter 11 Verilog HDL Application-Specific Integrated Circuits Michael John Sebastian Smith Addison Wesley, 1997.
Table 7.1 Verilog Operators.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
1 Brief Introduction to Verilog Weiping Shi. 2 What is Verilog? It is a hardware description language Originally designed to model and verify a design.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
ELEN 468 Lecture 151 ELEN 468 Advanced Logic Design Lecture 15 Synthesis of Language Construct I.
ENEE 408C Lab Capstone Project: Digital System Design Spring 2006 Class Web Site:
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
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.
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.
Introduction to Verilog Tahir Muhammad FPGA Based System Design.
ECE 2372 Modern Digital System Design
Week Four Design & Simulation Example slides. Agenda Review the tiny example (Minako “logic”)from last week – look at the detailed static timing report.
Basic Operators. What is an operator? using expression is equal to 9. Here, 4 and 5 are called operands and + is the operator Python language supports.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
EEE2243 Digital System Design Chapter 3: Verilog HDL (Combinational) by Muhazam Mustapha, January 2011.
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.
Doing math In java.
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
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
Introduction to Verilog. Structure of a Verilog Program A Verilog program is structured as a set of modules, which may represent anything from a collection.
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
EMT 351/4 DIGITAL IC DESIGN Verilog Behavioral Modeling  Constructs for Activity Flow Control  Task & Function  System Tasks for Timing Checks.
1 A hardware description language is a computer language that is used to describe hardware. Two HDLs are widely used Verilog HDL VHDL (Very High Speed.
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
IAY 0600 Digital Systems Design
An Introduction to Verilog: Transitioning from VHDL
TODAY’S OUTLINE Introduction to Verilog Verilog coding format
Supplement on Verilog for Algorithm State Machine Chart
TODAY’S OUTLINE Verilog Codings Concurrent and Sequential If-else
ELEN 468 Advanced Logic Design
Operators and Expressions
Lecture 3: Combinational Logic in SystemVerilog
Introduction to Verilog
Discussion 2: More to discuss
Hardware Description Languages: Verilog
TODAY’S OUTLINE Procedural Assignments Verilog Coding Guidelines
By: Muhammad Zidny Naf’an
Introduction to Verilog
Behavioral Modeling in Verilog
Developing More Advanced Testbenches
COE 202 Introduction to Verilog
Tri-state buffer A circuit which allows an input to go to output when desired Otherwise it behaves as if “nothing” is connected to the wire An equivalent.
Introduction to Verilog
EMT 511/3 DIGITAL SYSTEM DESIGN
Introduction to Verilog, ModelSim, and Xilinx Vivado
Introduction to Verilog
The Verilog Hardware Description Language
Foundations for Datapath Design
The Verilog Hardware Description Language
Introduction to Verilog
Operators In Java Programming By Rajanikanth B.
Supplement on Verilog combinational circuit examples
EEE2243 Digital System Design Chapter 1: Verilog HDL (Combinational) by Muhazam Mustapha, February 2012.
COE 202 Introduction to Verilog
Combination Logic & FPGAs.
Presentation transcript:

TODAY’S OUTLINE Testbench Circuit Verilog Operators Concatenation operator Logical operators Bitwise operators Conditional operators Shift operators Equality operators Reduction operators Arithmetic operators

Testbench A testbench is an environment which surrounds a DUT (Design Under Test) and forces stimulus into the DUT while monitoring the output ports of the DUT In other words, a testbench is an environment to verify the functionality of a design

Cont.. input DUT output Testbench

How does waveform looks like? Example Testbench module ANDgate_tb (); reg A, B; wire Y; integer i; initial begin for (i=0; i<4; i=i+1) {A, B} = i; #10; end ANDgate ANDgate_inst (A, B, Y); endmodule How does waveform looks like? DUT module ANDgate (A, B, Y); input A, B; output Y; reg Y; always @ (A or B) begin Y = A & B; end endmodule

TODAY’S OUTLINE Testbench Circuit Verilog Operators Concatenation operator Logical operators Bitwise operators Conditional operators Shift operators Equality operators Reduction operators Arithmetic operators

Concatenation Operator Single bits of signal can be combined to form a bus or multi-bits signal The concatenation operator is identified by the symbol “{” and “}” Example: module ………; input [1:0] A, B, C; assign output = {A, B, C}; endmodule

Logical Operators Logical operators return a single bit result. It is either “1” (true) or “0” (false). Operation Symbol and && or || not !

Example Sketch the output waveform.. module test1 (A, B, C, D, Y); input A, B, C; input [2:0] D; output [2:0] Y; reg Y; assign Y = D || {A, B, C}; endmodule Sketch the output waveform..

Bitwise Operators Bitwise operators operate on buses and return the result in bus form Operation Symbol and & or | not ~ xor ^

Try to avoid using logical operator Example module test1 (A, B, C, D, Y); input A, B, C; input [2:0] D; output [2:0] Y; reg Y; assign Y = D | {A, B, C}; endmodule Try to avoid using logical operator Sketch the output waveform..

Conditional Operators Conditional operators are widely used for conditional checking Commonly used to model combinational logic Consist of 3 operands: input, select/control and output

Example module ……; assign Y = control ? inputA : inputB; endmodule Conditional operators can be use to represent multiplexer

Shift Operators Two types of shift operator Shift left for shifting left Shift right for shifting right Shift right is identified by symbol “>>” Shift left identified by symbol “<<”

Example module ……; assign Y = inputA << 1; endmodule module ……;

Equality Operators Two types of equality operator: Logical equal - identified by symbol “==” for equal and “!=” for not equal - results returned are either “0” (false), “1” (true) or “X” (unknown)

Cont… Case equal - identified by symbol “===” for equal and “!==” for not equal - always produces results that are “1” (true) or “0” (false) - can identify values of “X” and “Z”

Example module ……; if (inputA == 1’b1) outputA = 1; else outputA = 0; if (inputA != inputB) outputA = 0; else outputA = 1; endmodule

Reduction Operators Reduction operators are functionally the same as logical operators, except that it operates on itself 6 types of reduction operators:

Cont.. Operation Symbol and & or | xor ^ nand ~& nor ~| xnor ~^

Example module …….; assign outputA = &inputA; endmodule

Arithmetic Operators 4 types of arithmetic operators: Operation Symbol addition + subtraction - multiplication * division /

Assignments Write a Verilog code with a module named ‘exercise1’ and the interface signals shown: - function of outputA is logical NOT of inputA - function of outputB is logical OR of inputC or inputA - function of outputC is logical AND of inputC and inputA - function of outputD is logical AND of inputD and concatenation of inputA, inputB and inputC

Cont.. Create a testbench for the design exercise1 and sketch the waveform based on the stimulus written. Noted, outputD and inputD is 3-bit. InputA, inputB and inputC are 1-bit.

Cont.. Write a Verilog code with a module named ‘exercise2’ and the interface signals shown: - function of outputA is bitwise NOT of inputA - function of outputB is bitwise OR of inputC or inputA - function of outputC is bitwise AND of inputC and inputA - function of outputD is bitwise AND of inputD and concatenation of inputA, inputB and inputC

Cont.. Create a testbench for the design exercise2 and sketch the waveform based on the stimulus written. Noted, outputD and inputD is 3-bit. InputA, inputB and inputC are 1-bit.

Cont.. 3. Write a Verilog code using conditional operators with a module named “exercise3” based on schematic below. inputA 1 outputY inputB 1 inputC Sel[1:0]

Cont.. Create a testbench for the design exercise3 and sketch the waveform based on the stimulus written.

Cont.. 4. Write a Verilog code with a module named ‘exercise4’ for the arithmetic operation below: - function of outputW is arithmetic operation of inputA add inputB - function of outputX is arithmetic operation of inputA substract inputB - function of outputY is arithmetic operation of inputA multiply inputB - function of outputZ is arithmetic operation of inputA divide inputB

Cont.. Create a testbench for the design exercise4 and sketch the waveform based on the stimulus written. Noted, all inputs and outputs are 4-bit.

Lab 1 (Introduction to ModelSim) will start on next week.. Be prepared.. That’s all for today. See u on Tuesday (25 July 2006), 8.30am..