EEE2243 Digital System Design Chapter 3: Verilog HDL (Combinational) by Muhazam Mustapha, January 2011.

Slides:



Advertisements
Similar presentations
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Advertisements

The Verilog Hardware Description Language
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Supplement on Verilog adder examples
Chapter 11 Verilog HDL Application-Specific Integrated Circuits Michael John Sebastian Smith Addison Wesley, 1997.
Verilog Intro: Part 1.
Combinational Logic with Verilog Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer.
Anurag Dwivedi.  Verilog- Hardware Description Language  Modules  Combinational circuits  assign statement  Control statements  Sequential circuits.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
CSE 341 Verilog HDL An Introduction. Hardware Specification Languages Verilog  Similar syntax to C  Commonly used in  Industry (USA & Japan) VHDL 
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Verilog - 1 Writing Hardware Programs in Abstract Verilog  Abstract Verilog is a language with special semantics  Allows fine-grained parallelism to.
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.
B. RAMAMURTHY Hardware Description Language 8/2/
Lecture 7 Verilog Additional references Structural constructs
Lecture # 12 University of Tehran
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.
Programmable Logic Architecture Verilog HDL FPGA Design Jason Tseng Week 5.
Outline Analysis of Combinational Circuits Signed Number Arithmetic
ECE 2372 Modern Digital System Design
ECE/CS 352 Digital Systems Fundamentals
Introduction to Chapter 6  Digital circuits are frequently used for arithmetic operations  Fundamental arithmetic operations on binary numbers and digital.
Figure 5.1. Conversion from decimal to binary.. Table 5.1. Numbers in different systems.
Figure 5.1. Conversion from decimal to binary.. Table 5.1. Numbers in different systems.
Verilog HDL: A solution for Everybody By, Anil Kumar Ram Rakhyani
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
EEE2243 Digital System Design Chapter 4: Verilog HDL (Sequential) by Muhazam Mustapha, January 2011.
CPEN Digital System Design
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.
Use of HDLs in Teaching of Computer Hardware Courses Zvonko Vranesic and Stephen Brown University of Toronto.
Hardware Description Languages Digital Logic Design Instructor: Kasım Sinan YILDIRIM.
Introduction to Combinational Verilog EECS270 rev 9/25/12.
Introduction to ASIC flow and Verilog HDL
Verilog hdl – II.
Number Representation and Arithmetic Circuits
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,
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.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Hardware Description Languages: Verilog
TODAY’S OUTLINE Introduction to Verilog Verilog coding format
Lecture 2 Supplement Verilog-01
Learning Outcome By the end of this chapter, students are expected to be able to: Design State Machine Write Verilog State Machine by Boolean Algebra and.
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Chapter 4 Combinational Logic
Hardware Description Language
Behavioral Modeling in Verilog
Hardware Description Language
Hardware Description Language
Hardware Description Language
XOR, XNOR, and Binary Adders
Introduction to Verilog, ModelSim, and Xilinx Vivado
Supplement on Verilog adder examples
Chapters 4 – Part3: Verilog – Part 1
Hardware Description Language
The Verilog Hardware Description Language
XOR Function Logic Symbol  Description  Truth Table 
NTU DSD (Digital System Design) 2007
EEE2243 Digital System Design Chapter 1: Verilog HDL (Combinational) by Muhazam Mustapha, February 2012.
COE 202 Introduction to Verilog
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

EEE2243 Digital System Design Chapter 3: Verilog HDL (Combinational) by Muhazam Mustapha, January 2011

Learning Outcome By the end of this chapter, students are expected to be able to: –Quartus II –Verilog

Chapter Content Why HDL? Verilog Boolean Equation Modeling Behavior Modeling

Why HDL?

Hardware Description Language A drawing of a circuit, or schematic, contains graphical information about a design –Inverter is above the OR gate, AND gate is to the right, etc. Such graphical information may not be useful for large designs Can use textual language instead DoorOpener c h p f Vahid Slide

Hardware Description Language Hardware description language (HDL) –Intended to describe circuits textually, for a computer to read –Evolved starting in the 1970s and 1980s Popular languages today include: –VHDL –Defined in 1980s by U.S. military; Ada-like language –Verilog –Defined in 1980s by a company; C-like language –SystemC –Defined in 2000s by several companies; consists of libraries in C++ Vahid Slide

Verilog

General Structure Mohamed Khalil Hani module module_name(ports) { parameter declaration } input port_list; output port_list; wire list; reg (or integer) list; { assign continuous_statement; } { initial block; } { always block; } { gate instantiations; } { module instantiations; } endmodule

General Structure module CircuitA(Cin, x, y, X, Y, Cout, s, Bus, S) input Cin, x, y; input [3:0] X, Y; output Cout, s; output [3:0] S; inout [7:0] Bus; wire d; reg e;... endmodule Mohamed Khalil Hani Example:

Format: Constant Representation Mohamed Khalil Hani ’ 8 bit binary: 8’b bit hex: 12’habc 7 bit decimal: 7’d50 Negative 5 bit binary: -5’b01010 Negative 8 bit hex: -8’h8c Example: Negative numbers are internally represented as 2’s complement, but in the code we just use signed magnitude:

High-Z output is represented as z Undefined output is represented as x Constant Representation Mohamed Khalil Hani 8 bit binary with 4 bit z: 8’bzzzz bit binary with 4 bit x: 8’b1010xxxx

Operators Mohamed Khalil Hani Operator TypeOperator Symbol Operation Bitwise ~, &, |, ^, ~^ not, and, or, xor, xnor Logical !, &&, || not, and, or Arithmetic +, -, *, / add, sub, mul, div Relational >, =, <= gt, lt, gt or eq, lt or eq Equality ==, !=, ===, !== eq, not eq, case eq, case not eq Shift >>, >>, <<< unsigned rs, unsigned ls, signed rs, signed ls Concatenation {, } Conditional ? :

Modeling Style There are 3 coding styles in Verilog Boolean Equation –Done by writing Verilog version of Boolean equation to define output Behavioral –Done by writing the output arithmetical definition instead of the direct Boolean equation Structural –Done writing Verilog in multiple modules We will first cover Boolean equation and Behavioral Mohamed Khalil Hani

Boolean Equation Modeling

assign Keyword The pure Boolean combinational style modeling is signified by the use of assign keyword Mohamed Khalil Hani module functionA(x1, x2, x3, f); input x1, x2, x3; output f; assign f = (~x1 & ~x2 & x3) | (x1 & ~x2 & ~x3) | (x1 & ~x2 & x3) | (x1 & x2 & ~x3); endmodule Logic Function x1 x2 x3 f

Example – AND Gate module ANDGate(x, y, f); input x, y; output f; assign f = x & y; endmodule y f Quartus II version 9 Demo x

Example – Boolean Half Adder Mohamed Khalil Hani module HalfAdder(a, b, sum, carry); input a, b; output sum, carry; assign sum = a ^ b; assign carry = a & b; endmodule x1 x2 sum carry Quartus II version 9 Demo

Behavior Modeling

always Keyword The behavioral style modeling is signified by the use of always keyword Many C-like keywords can also be used For a complex design, behavioral style is more favorable Mohamed Khalil Hani module ORGate(x, y, f); input x, y; output f; reg f; or y) begin if (x == 0) && (y == 0) f = 0; else f = 1; end endmodule Also read Vahid pg 496

Example – Behavioral Half Adder module HalfAdder(a, b, sum_carry); input a, b; output [1:0] sum_carry; reg [1:0] sum_carry; or b) begin sum_carry = a + b; end endmodule Quartus II version 9 Demo