ELEN 468 Lecture 21 ELEN 468 Advanced Logic Design Lecture 2 Hardware Modeling.

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

Verilog.
The Verilog Hardware Description Language
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Supplement on Verilog adder examples
ELEN 468 Lecture 61 ELEN 468 Advanced Logic Design Lecture 6 Delay Models.
Combinational Logic.
Review for Exam 2 Using MUXs to implement logic
Table 7.1 Verilog Operators.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
16/04/20151 Hardware Descriptive Languages these notes are taken from Mano’s book It can represent: Truth Table Boolean Expression Diagrams of gates and.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
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.
CSE 341 Verilog HDL An Introduction. Hardware Specification Languages Verilog  Similar syntax to C  Commonly used in  Industry (USA & Japan) VHDL 
ECE 551 Digital System Design & Synthesis Lecture 08 The Synthesis Process Constraints and Design Rules High-Level Synthesis Options.
 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.
Lecture 2: Hardware Modeling with Verilog HDL
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
ELEN 468 Lecture 121 ELEN 468 Advanced Logic Design Lecture 12 Synthesis of Combinational Logic I.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
Verilog Module Module declaration Module instantiation module Add_full (sum, c_out, a, b, c_in); // parent module input a, b, c_in; output c_out, sum;
ENEE 408C Lab Capstone Project: Digital System Design Spring 2006 Class Web Site:
ECEN ECEN475 Introduction to VLSI System Design Verilog HDL.
ELEN468 Lecture 11 ELEN468 Advanced Logic Design Lecture 1Introduction.
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Lecture Note on Verilog, Course # , EE, NTU, C.H Tsai Basic Logic Design with Verilog TA: Chen-han Tsai.
ECE 2372 Modern Digital System Design
ECE/CS 352 Digital Systems Fundamentals
Introduction Verilog is a HARDWARE DESCRIPTION LANGUAGE (HDL) A hardware description language is a language or means used to describe or model a digital.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
Digital System 數位系統 Verilog HDL Ping-Liang Lai (賴秉樑)  
CPEN Digital System Design
CH71 Chapter 7 Hardware Description Language (HDL) By Taweesak Reungpeerakul.
Module 1.2 Introduction to Verilog
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
Introduction to Verilog
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
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.
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
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.
Introduction to Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals.
Hardware Description Languages: Verilog
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
ELEN 468 Advanced Logic Design
Discussion 2: More to discuss
Verilog Introduction Fall
KARTHIK.S Lecturer/ECE S.N.G.C.E
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Hardware Description Language
Introduction to Verilog
102-1 Under-Graduate Project Verilog
Hardware Descriptive Languages these notes are taken from Mano’s book
332:437 Lecture 8 Verilog and Finite State Machines
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
Chapters 4 – Part3: Verilog – Part 1
The Verilog Hardware Description Language
332:437 Lecture 8 Verilog and Finite State Machines
COE 202 Introduction to Verilog
Presentation transcript:

ELEN 468 Lecture 21 ELEN 468 Advanced Logic Design Lecture 2 Hardware Modeling

ELEN 468 Lecture 22 Overview Verilog modules Verilog primitives Structural descriptions Behavioral descriptions Hierarchical design Language conventions

ELEN 468 Lecture 23 Verilog Module Description of internal structure/function Implicit semantic of time associated with each data object/signal Implementation is hidden to outside world Communicate with outside through ports Port list is optional Achieve hardware encapsulation module Add_half ( sum, c_out, a, b ); inputa, b; outputsum, c_out; wire c_out_bar; xor (sum, a, b); nand (c_out_bar, a, b); not (c_out, c_out_bar); endmodule c_out a b sum c_out_bar

ELEN 468 Lecture 24 Behavioral Description module Add_half ( sum, c_out, a, b ); inputa, b; outputsum, c_out; assign { c_out, sum } = a + b; // Continuous assignment endmodule a b Add_half sum c_out Concatenation

ELEN 468 Lecture 25 Module Instantiation Accomplished by entering Module name as a module item within a parent module Signal identifiers at appropriate ports Module instantiation needs a module identifier A module is never declared within another module The order of ports in instantiation usually matches the order in module declaration

ELEN 468 Lecture 26 Design a Full Adder sum HA = a  b c_out HA = a b sum FA = a  b  c_in c_out FA = a b + b c_in + a c_in sum FA = (a  b)  c_in c_out FA = (a  b) c_in + a b a + b = a(b+b’) + (a+a’)b = ab + ab’ + a’b ab + bc + ac = ab + (a+b)c = ab + (a  b+ab)c = ab + a  b c+abc = ab + (a  b)c

ELEN 468 Lecture 27 Full Adder  2 Half Adders sum HA = a  b c_out HA = a b sum FA = (a  b)  c_in c_out FA = (a  b) c_in + a b Add_half (a  b)c_in a b Add_half abab ab c_in (a  b)  c_in (a  b) c_in + a b

ELEN 468 Lecture 28 Module instance name Full Adder in Verilog module Add_full ( sum, c_out, a, b, c_in );// parent module input a, b, c_in; output c_out, sum; wire w1, w2, w3; Add_half M1 ( w1, w2, a, b ); Add_half M2 ( sum, w3, w1, c_in );// child module or ( c_out, w2, w3 );// primitive instantiation endmodule module Add_full ( sum, c_out, a, b, c_in );// parent module input a, b, c_in; output c_out, sum; wire w1, w2, w3; Add_half M1 ( w1, w2, a, b ); Add_half M2 ( sum, w3, w1, c_in );// child module or ( c_out, w2, w3 );// primitive instantiation endmodule Add_half (a  b)c_in a b Add_half abab ab c_in (a  b)  c_in (a  b) c_in + a b w1 w2 w3 sum c_out

ELEN 468 Lecture 29 Verilog Primitives Basic element to build a module, such as nand, nor, buf and not gates Never used stand-alone in design, must be within a module Pre-defined or user-defined Identifier (instance name) is optional Output is at left-most in port list Default delay = 0

ELEN 468 Lecture 210 Symmetric Delay Assignment module AOI_4 ( y, x1, x2, x3, x4 ); input x1, x2, x3, x4; output y; wire y1, y2; and#1 ( y1, x1, x2 ); and #1 ( y2, x3, x4 ); nor#1 ( y, y1, y2 ); endmodule x1 x2 x3 x4 y1 y2 y

ELEN 468 Lecture 211 Asymmetric Delay Assignment module nand1 ( O, A, B ); input A, B; output O; nand ( O, A, B ); specify specparam T01 = 1.13:3.09:7.75; T10 = 0.93:2.50:7.34; ( A=>O ) = ( T01, T10 ); ( B=>O ) = ( T01, T10 ); endspecify endmodule Min delay Typical delay Max delay Falling time Rising time

ELEN 468 Lecture 212 Smart Primitives module nand3 ( O, A1, A2, A3 ); input A1, A2, A3; outputO; nand ( O, A1, A2, A3 ); endmodule Same primitive can be used to describe for any number of inputs This works for only pre-defined primitives, not UDP

ELEN 468 Lecture 213 Explicit Structural Descriptions module AOI_4 ( y, x1, x2, x3, x4 ); input x1, x2, x3, x4; output y; wire y1, y2; and#1 ( y1, x1, x2 ); and #1 ( y2, x3, x4 ); nor#1 ( y, y1, y2 ); endmodule x1 x2 x3 x4 y1 y2 y

ELEN 468 Lecture 214 Implicit Structural Description module nand2_RTL ( y, x1, x2 ); input x1, x2; outputy; assign y = x1 ~& x2; endmodule module nand2_RTL ( y, x1, x2 ); input x1, x2; outputy; wire y = x1 ~& x2; endmodule Explicit continuous assignmentImplicit continuous assignment Continuous assignment – Static binding between LHS and RHS No mechanism to eliminate or alter the binding

ELEN 468 Lecture 215 Multiple Instantiations module multiple_gates ( y1, y2, y3, a1, a2, a3, a4 ); input a1, a2, a3, a4; outputy1, y2, y3; nand #1 G1(y1, a1, a2, a3), (y2, a2, a3, a4), (y3, a1, a4); endmodule module multiple_gates ( y1, y2, y3, a1, a2, a3, a4 ); input a1, a2, a3, a4; outputy1, y2, y3; nand #1 G1(y1, a1, a2, a3), (y2, a2, a3, a4), (y3, a1, a4); endmodule The delay element #1 is effective for all instances

ELEN 468 Lecture 216 Multiple Assignments module multiple_gates ( y1, y2, y3, a1, a2, a3, a4 ); input a1, a2, a3, a4; outputy1, y2, y3; assign #1 y1 = a1 ^ a2, y2 = a2 | a3, y3 = a1 + a4; endmodule module multiple_gates ( y1, y2, y3, a1, a2, a3, a4 ); input a1, a2, a3, a4; outputy1, y2, y3; assign #1 y1 = a1 ^ a2, y2 = a2 | a3, y3 = a1 + a4; endmodule

ELEN 468 Lecture 217 Structural Connections By order By name Empty port module child( a, b, c ); … endmodule module parent; wire u, v, w; child m1( u, v, w ); child m2(.c(w),.a(u),.b(v) ); child m3( u,, w ); endmodule

ELEN 468 Lecture 218 Behavioral Descriptions: Data Flow module and4( y, x ); input [3:0]x; outputy; assign y = & x; endmodule module Flip_flop ( q, data_in, clk, rst ); input data_in, clk, rst; output q; reg q; ( posedge clk ) begin if ( rst == 1) q = 0; else q = data_in; end endmodule

ELEN 468 Lecture 219 Behavioral Descriptions: Algorithm-based module and4_algo ( y, x ); input [3:0]x; output y; reg y; integerk; ( x ) begin: and_loop y = 1; for ( k = 0; k <= 3; k = k+1 ) if ( x[k] == 0 ) begin y = 0; disable and_loop; end endmodule module and4_algo ( y, x ); input [3:0]x; output y; reg y; integerk; ( x ) begin: and_loop y = 1; for ( k = 0; k <= 3; k = k+1 ) if ( x[k] == 0 ) begin y = 0; disable and_loop; end endmodule Optional name Enable “disable” x[0] or x[1] or x[2] or x[3]

ELEN 468 Lecture 220 Description Styles Explicit structural Implicit structural Explicit continuous assignment Implicit continuous assignment Data flow/RTL Algorithm-based Structural Behavioral

ELEN 468 Lecture 221 Hierarchical Description Add_half a b c_in M1 M2 sum c_out xornandnot Add_half xornandnot Add_halfor Add_full M1 M2 Nested module instantiation to arbitrary depth

ELEN 468 Lecture 222 Structured Design Methodology Design: top-down Verification: bottom-up Example 2.18 in textbook pg 45

ELEN 468 Lecture 223 Arrays of Instances module flop_array(q, in, clk, rst); input [7:0]in; inputclk, rst; output [7:0] q; Flip_flop M[7:0] (q, in, clk, rst); endmodule module pipeline(q, in, clk, rst ); input [7:0]in; inputclk, rst; output [7:0] q; wire [23:0]pipe; flop_array M[3:0] ({q, pipe}, {pipe, in}, clk, rst); endmodule rst clk in[7:0]q[7:0]pipe[7:0]pipe[23:16]

ELEN 468 Lecture 224 Verilog for Synthesis module comp(lt,gt,eq,a0,a1,b0,b1); inputa0, a1, b0, b1; outputlt, gt, eq; wirew1, w2, w3, w4, w5, w6, w7; or (lt, w1, w2, w3); nor (gt, lt, eq); and (w1, w6, b1); and (w2, w6, w7, b0); and (w3, w7, b0, b1); not (w6, a1); not (w7, a0); xnor (w4, a1, b1); xnor (w5, a0, b0); endmodule module comp(lt,gt,eq,a0,a1,b0,b1); inputa0, a1, b0, b1; outputlt, gt, eq; wirew1, w2, w3, w4, w5, w6, w7; or (lt, w1, w2, w3); nor (gt, lt, eq); and (w1, w6, b1); and (w2, w6, w7, b0); and (w3, w7, b0, b1); not (w6, a1); not (w7, a0); xnor (w4, a1, b1); xnor (w5, a0, b0); endmodule module comp(lt, gt, eq, a, b); input [1:0]a, b; outputlt, gt, eq; assign it = ( a < b ); assign gt = ( a > b ); assign eq = ( a == b ); endmodule module comp(lt, gt, eq, a, b); input [1:0]a, b; outputlt, gt, eq; assign it = ( a < b ); assign gt = ( a > b ); assign eq = ( a == b ); endmodule Figure 2.30 Figure 2.28

ELEN 468 Lecture 225 Language Conventions Case sensitive Instance of a module must be named Keywords are lower-case Comments start with “//”, or blocked by “/* */”

ELEN 468 Lecture 226 Numbers in Verilog Binary, decimal, octal, hex … Table 2.2