ECEN 475 3.1 ECEN475 Introduction to VLSI System Design Verilog HDL.

Slides:



Advertisements
Similar presentations
The Verilog Hardware Description Language
Advertisements

Supplement on Verilog adder examples
Synchronous Sequential Logic
Combinational Logic.
ELEN 468 Lecture 21 ELEN 468 Advanced Logic Design Lecture 2 Hardware Modeling.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
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 Pertemuan 9 Verilog HDL Matakuliah: H0362/Very Large Scale Integrated Circuits Tahun: 2005 Versi: versi/01.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
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.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
1 Brief Introduction to Verilog Weiping Shi. 2 What is Verilog? It is a hardware description language Allows designers to quickly create and debug large.
ELEN 468 Lecture 81 ELEN 468 Advanced Logic Design Lecture 8 Behavioral Descriptions II.
ELEN 468 Lecture 91 ELEN 468 Advanced Logic Design Lecture 9 Behavioral Descriptions III.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
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;
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
ELEN 468 Lecture 71 ELEN 468 Advanced Logic Design Lecture 7 System Tasks, Functions, Syntax and Behavioral Modeling I.
ELEN468 Lecture 11 ELEN468 Advanced Logic Design Lecture 1Introduction.
ELEN468 Lecture 11 ELEN468 Advanced Logic Design Lecture 1Introduction.
Digital System Design Verilog ® HDL Behavioral Modeling (1) Maziar Goudarzi.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Overview Logistics Last lecture Today HW5 due today
Spring 2007W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 7: Design Example,
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
1 Verilog Digital System Design Z. Navabi, 2006 Digital Design Flow  Digital Design Flow begins with specification of the design at various levels of.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
ECE 2372 Modern Digital System Design
Chapter 4: Behavioral Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 4-1 Ders – 4: Davranışsal Modelleme.
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
Digital System 數位系統 Verilog HDL Ping-Liang Lai (賴秉樑)  
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
ECE/CS 352 Digital System Fundamentals© 2001 C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Spring 2001 Chapters 3 and 4: Verilog – Part 2 Charles R.
Module 1.2 Introduction to Verilog
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
The Verilog Hardware Description Language. GUIDELINES How to write HDL code: How to write HDL code:
ELEN 468 Lecture 131 ELEN 468 Advanced Logic Design Lecture 13 Synthesis of Combinational Logic II.
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
M.Mohajjel. Structured Procedures Two basic structured procedure statements always initial All behavioral statements appear only inside these blocks Each.
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.
ELEN 468 Lecture 171 ELEN 468 Advanced Logic Design Lecture 17 Midterm1 Review.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
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,
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
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.
Hardware Description Languages: Verilog
Verilog Introduction Fall
‘if-else’ & ‘case’ Statements
Hardware Description Languages: Verilog
Verilog HDL.
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Chapter 4: Behavioral Modeling
The Verilog Hardware Description Language
The Verilog Hardware Description Language
The Verilog Hardware Description Language
COE 202 Introduction to Verilog
Presentation transcript:

ECEN ECEN475 Introduction to VLSI System Design Verilog HDL

ECEN HDLs  Hardware Description Languages  Widely used in logic design  Verilog and VHDL  Describe hardware using code  Document logic functions  Simulate logic before building  Synthesize code into gates and layout  Requires a library of standard cells

ECEN Module ports Module name Verilog keywords Taste of Verilog 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 Declaration of port modes Declaration of internal signal Instantiation of primitive gates c_out a b sum c_out_bar

ECEN Taste of Verilog module Add_full ( sum, c_out, a, b, c_in ); inputa, b, c_in; outputsum, c_out; Adder_half (s1, c1, a, b); Adder_half (sum, c2, s1, c_in); OR (c_out, c1, c2); endmodule

ECEN Behavioral Description module Add_half ( sum, c_out, a, b ); inputa, b; outputsum, c_out; reg sum, c_out; ( a or b ) begin sum = a ^ b;// Exclusive or c_out = a & b;// And end endmodule a b Add_half sum c_out

ECEN Continuous Assignment module Add_half ( sum, c_out, a, b ); inputa, b; outputsum, c_out; assign sum = a ^ b;// Exclusive or assign c_out = a & b;// And endmodule

ECEN Example of Flip-flop 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 data_in q rst clk Declaration of synchronous behavior Procedural statement

ECEN Gate Delay  and (yout, x1, x2);// default, zero gate delay  and #3 (yout, x1, x2);// 3 units delay for all transitions  and #(2,3) G1(yout, x1, x2); // rising, falling delay  and #(2,3) G1(yout, x1, x2), G2(yout2, x3, x4); // Multiple instances  and (yout, x1, x2);// default, zero gate delay  and #3 (yout, x1, x2);// 3 units delay for all transitions  and #(2,3) G1(yout, x1, x2); // rising, falling delay  and #(2,3) G1(yout, x1, x2), G2(yout2, x3, x4); // Multiple instances

ECEN Time Scales  Time scale directive: ‘ timescale /  time_unit -> physical unit of measure, time scale of delay  time_precision -> time resolution/minimum step size during simulation  time_unit  time_precision Unit/precisionDelay specification Simulator time step Delay value in simulation 1ns / 100ps#40.1ns4.0ns 100ns / ns#41ns400ns 10ns / 100ps# ns46.3ns

ECEN Net Delay … wire #2 y_tran; and #3 (y_tran, x1, x2); buf #1 (buf_out, y_tran); and #3 (y_inertial, x1, x2); … wire #2 y_tran; and #3 (y_tran, x1, x2); buf #1 (buf_out, y_tran); and #3 (y_inertial, x1, x2); … x1 x2 y_tran y_inertial buf_out x1 x2 y_inertial y_tran buf_out

ECEN Structural vs. Behavioral Descriptions module my_module(…); … assign …; // continuous assignment and (…); // instantiation of primitive adder_16 M(…); // instantiation of module begin … end initial begin … end endmodule Structural, no order Behavior, in order in each procedure

ECEN Behavioral Statements initial | always single_statement; | begin block_of_statements; end initial | always single_statement; | begin block_of_statements; end  initial  Activated from t sim = 0  Executed once  Initialize a simulation  always  Activated from t sim = 0  Executed cyclically  Continue till simulation terminates

ECEN Example of Behavioral Statement module clock1 ( clk ); parameter half_cycle = 50; parameter max_time = 1000; output clk; reg clk; initial clk = 0; always begin #half_cycle clk = ~clk; end initial #max_time $finish; endmodule module clock1 ( clk ); parameter half_cycle = 50; parameter max_time = 1000; output clk; reg clk; initial clk = 0; always begin #half_cycle clk = ~clk; end initial #max_time $finish; endmodule clk t sim

ECEN Assignment  Continuous assignment  Values are assigned to net variables due to some input variable changes  “assign …=… “  Procedural assignment  Values are assigned to register variables when certain statement is executed in a behavioral description  Procedural assignment, “=“

ECEN Example module mux4_PCA(a, b, c, d, select, y_out); input a, b, c, d; input [1:0] select; output y_out; reg y_out; or a or b or c or d) begin if (select == 0) y_out=a; else if (select == 1) y_out=b; else if (select == 2) y_out=c; else if (select == 3) y_out=d; else y_out=1’bx; end endmodule module mux4_PCA(a, b, c, d, select, y_out); input a, b, c, d; input [1:0] select; output y_out; reg y_out; or a or b or c or d) begin if (select == 0) y_out=a; else if (select == 1) y_out=b; else if (select == 2) y_out=c; else if (select == 3) y_out=d; else y_out=1’bx; end endmodule Value of ‘a’ is assigned to y_out at this time

ECEN Blocking and Non-blocking Assignment initial begin a = 1; b = 0; a = b; // a = 0; b = a; // b = 0; end initial begin a = 1; b = 0; a <= b; // a = 0; b <= a; // b = 1; end  Blocking assignment “=“  Statement order matters  A statement has to be executed before next statement  Non-blocking assignment “<=“  Concurrent assignment  If there are multiple non- blocking assignments to same variable in same behavior, latter overwrites previous

ECEN Delay Control Operator (#) initial begin #0in1 = 0; in2 = 1; #10 in3 = 1; #40 in4 = 0; in5 = 1; #60 in3 = 0; end initial begin #0in1 = 0; in2 = 1; #10 in3 = 1; #40 in4 = 0; in5 = 1; #60 in3 = 0; end

ECEN Event Control Operator ( eventA or eventB ) begin … end ( eventA or eventB ) begin … end  Event -> identifier or expression  When is reached  Activity flow is suspended  The event is monitored  Other processes keep going  posedge: 0->1, 0->x, x->1  negedge: 1->0, 1->x, x->0

ECEN Intra-assignment Delay: Blocking Assignment // B = 0 at time 0 // B = 1 at time 4 … #5 A = B; // A = 1 C = D; … A = #5 B; // A = 0 C = D; … A B; C = D; … A B; C= D; … // B = 0 at time 0 // B = 1 at time 4 … #5 A = B; // A = 1 C = D; … A = #5 B; // A = 0 C = D; … A B; C = D; … A B; C= D; …  If timing control on LHS  Blocking delay  RHS evaluated at  Assignment at  If timing control on RHS  Intra-assignment delay  RHS evaluated immediately  Assignment at

ECEN Activity Flow Control ( if … else ) if ( A == B ) P = d; if ( B < C ); if ( a >= b ) begin … end if ( A < B ) P = d; else P = k; if ( A > B ) P = d; else if ( A < B ) P = k; else P = Q; if ( A == B ) P = d; if ( B < C ); if ( a >= b ) begin … end if ( A < B ) P = d; else P = k; if ( A > B ) P = d; else if ( A < B ) P = k; else P = Q;  Syntax: if ( expression ) statement [ else statement ]  Value of expression  0, x or z => false  Non-zero number => true

ECEN Conditional Operator ( ? … : ) ( posedge clock ) yout = ( sel ) ? a + b : a – b; ( posedge clock ) yout = ( sel ) ? a + b : a – b; Conditional operator can be applied in either continuous assignments or behavioral descriptions

ECEN The case Statement module mux4 ( a, b, c, d, select, yout ); input a, b, c, d; input [1:0] select; output yout; reg yout; a or b or c or d or select ) begin case ( select ) 0: yout = a; 1: yout = b; 2: yout = c; 3: yout = d; default yout = 1`bx; endcase endmodule module mux4 ( a, b, c, d, select, yout ); input a, b, c, d; input [1:0] select; output yout; reg yout; a or b or c or d or select ) begin case ( select ) 0: yout = a; 1: yout = b; 2: yout = c; 3: yout = d; default yout = 1`bx; endcase endmodule  Case items are examined in order  Exact match between case expression and case item  casez – treats “z” as don’t cares  casex – treats both “x” and “z” as don’t cares

ECEN Switch Level NAND Gate module nand_2 ( Y, A, B ); output Y; input A, B; supply0 GND; supply1 PWR; wire w; pmos ( Y, PWR, A ); pmos ( Y, PWR, B ); nmos ( Y, w, A ); nmos ( w, GND, B ); endmodule module nand_2 ( Y, A, B ); output Y; input A, B; supply0 GND; supply1 PWR; wire w; pmos ( Y, PWR, A ); pmos ( Y, PWR, B ); nmos ( Y, w, A ); nmos ( w, GND, B ); endmodule Y V dd A A B B