Introduction to Verilog design. Design flow (from the book) Hierarchical Design. Lecture 2

Similar documents
Introduction to Verilog design. Design flow (from the book)

Verilog Tutorial (Structure, Test)

Advanced Digital Design with the Verilog HDL

Introduction to Digital Design with Verilog HDL

Graduate Institute of Electronics Engineering, NTU Basic Concept of HDL

Advanced Digital Design Using FPGA. Dr. Shahrokh Abadi

Online Verilog Resources

EECS 427 Lecture 14: Verilog HDL Reading: Many handouts/references. EECS 427 W07 Lecture 14 1

Programmable Logic Devices Verilog VII CMPE 415

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

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

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

Introduction to Verilog HDL. Verilog 1

ECEN 468 Advanced Digital System Design

CSE241 VLSI Digital Circuits Winter Recitation 1: RTL Coding in Verilog

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

UNIT V: SPECIFICATION USING VERILOG HDL

Contents. Appendix D Verilog Summary Page 1 of 16

The Verilog Language COMS W Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science

What is Verilog HDL? Lecture 1: Verilog HDL Introduction. Basic Design Methodology. What is VHDL? Requirements

Graduate Institute of Electronics Engineering, NTU. Lecturer: Chihhao Chao Date:

Federal Urdu University of Arts, Science and Technology, Islamabad VLSI SYSTEM DESIGN. Prepared By: Engr. Yousaf Hameed.

Course Topics - Outline

VERILOG QUICKSTART. Second Edition. A Practical Guide to Simulation and Synthesis in Verilog

RIZALAFANDE CHE ISMAIL TKT. 3, BLOK A, PPK MIKRO-e KOMPLEKS PENGAJIAN KUKUM. SYNTHESIS OF COMBINATIONAL LOGIC (Chapter 8)

OVERVIEW: ============================================================ REPLACE

Brief Introduction of Cell-based Design. Ching-Da Chan CIC/DSD

Combinational Logic Design with Verilog. ECE 152A Winter 2012

Verilog HDL Introduction

Gate level or structural modeling

Lecture 15: System Modeling and Verilog

A Tutorial Introduction 1

ECEN 468 Advanced Logic Design

430 Index. D flip-flop, from nands, 189, 191, 192 D flip-flop, verilog, 37

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

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

Verilog Design Principles

Speaker: Shao-Wei Feng Adviser: Prof. An-Yeu Wu Date: 2010/09/28

MLR Institute of Technology

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

DIGITAL SYSTEM DESIGN

Verilog HDL. Testing & Verification Dept. of Computer Science & Engg,, IIT Kharagpur

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

Synthesizable Verilog

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

Verilog Design Principles

In this lecture, we will focus on two very important digital building blocks: counters which can either count events or keep time information, and

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

The Verilog Hardware Description Language

Chapter 2 Using Hardware Description Language Verilog. Overview

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

The QR code here provides a shortcut to go to the course webpage.

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

DIGITAL SYSTEM DESIGN

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

Combinational Logic II

Lecture 32: SystemVerilog

Why Should I Learn This Language? VLSI HDL. Verilog-2

Tutorial on Verilog HDL

Synthesis of Combinational and Sequential Circuits with Verilog

Verilog Overview. The Verilog Hardware Description Language. Simulation of Digital Systems. Simulation of Digital Systems. Don Thomas, 1998, Page 1

Design Using Verilog

Modeling Concepts. Introduction

VERILOG QUICKSTART. James M. Lee Cadence Design Systems, Inc. SPRINGER SCIENCE+BUSINESS MEDIA, LLC

Digital Design with SystemVerilog

Digital System Design Verilog-Part III. Amir Masoud Gharehbaghi

EECS150 - Digital Design Lecture 10 Logic Synthesis

EECS150 - Digital Design Lecture 10 Logic Synthesis

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

N-input EX-NOR gate. N-output inverter. N-input NOR gate

CSE140L: Components and Design Techniques for Digital Systems Lab

Topics. Midterm Finish Chapter 7

Verilog Overview. The Verilog Hardware Description Language. Simulation of Digital Systems. Simulation of Digital Systems. Don Thomas, 1998, Page 1

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

CSE140L: Components and Design

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

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

Hardware description languages

ECE 3401 Lecture 10. More on VHDL

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

Verilog Overview. The Verilog Hardware Description Language. Simulation of Digital Systems. Simulation of Digital Systems. Don Thomas, 1998, Page 1

14. Introducton to Verilog

VLSI Design 13. Introduction to Verilog

101-1 Under-Graduate Project Digital IC Design Flow

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

Verilog 1 - Fundamentals

Digital Design with FPGAs. By Neeraj Kulkarni

Chapter 2a: Structural Modeling

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Sequential Logic Design

Verilog Lecţia 1. Primitive porţi. Primitive porţi de transmisie. Sintaxa generală de instanţiere a porţilor:

Announcements. Midterm 2 next Thursday, 6-7:30pm, 277 Cory Review session on Tuesday, 6-7:30pm, 277 Cory Homework 8 due next Tuesday Labs: project

TOPIC : Verilog Synthesis examples. Module 4.3 : Verilog synthesis

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Homework deadline extended to next friday

EEL 4783: HDL in Digital System Design

Chapter 5: Tasks, Functions, and UDPs

Transcription:

Introduction to Verilog design Lecture 2 ECE 156A 1 Design flow (from the book) ECE 156A 2 Hierarchical Design Chip Modules Cells Primitives A chip contain many modules A module may contain other modules no recursion A module uses predefined cells Everything is based on primitives ECE 156A 3 1

Hierarchical design flow Multi-Core system SW/HW co-design, multiple cores (SW/HW system verification) Full chip Functional units Block designs Processor, DSP, MPEG, etc. (Functionality is specified in books) ALU, Float Point Unit, Filter, Memory Management, Scheduler, etc. (RTL verification can be hard) Arithmetic blocks, common bus structures, Cross-bar switches, decoders, etc. (May be custom designed) Cell Library Certify that layouts can be manufactured with high yield (This may be Fab dependent) ECE 156A 4 Advantages When working at a particular level of design, we don t need to worry about all detail below When putting a system together, you don t need to worry about how a processor is designed Optimization can be done independently at each level Since no detail is involved, it is easier to replace the designs with other implementations You can easily change the processor to another implementation without changing the system You can change the technology from 0.45 micron to 0.32 micron without changing the verilog RTL ECE 156A 5 Primtives and design model Verilog includes 26 predefined models of logic gates called primitives Primitives are the most basic functional components that can be used to build (model) a design Their functions are built into the language by internal truth table The output port of a primitive is the first in the list ECE 156A 6 2

Verilog primitives for combinational logic n-input and nand or nor xor xnor n-output, 3-state buf not bufif0 bufif1 notif0 notif1 n-input: Any number of inputs and 1 output n-output: Any number of outputs and 1 input ECE 156A 7 List of Verilog primitives Gates and, nand, or, nor, xor, xnor, buf, not Tri-State bufif0, bufif1, notif0, notif1 MOS nmos, pmos, rnmos, rpmos CMOS cmos, rcmos Bi-directional tran, tranif0, tranif1, rtran, rtranif0, rtranif1 Pull pullup, pulldown ECE 156A 8 Standard cells vs. Primitives Verilog primitives are abstract building blocks used to model your design They are not real Standard cells are real building blocks used to implement your design Each has a corresponding layout Each has a timing model Cells are stored in a cell library Cell library is NOT free; you need to buy ECE 156A 9 3

Structural Verilog model ECE 156A 10 Verilog Behavior of D FF rst data_in clk q Block Diagram module Flip_flop (q, data_in, clk, rst); input data_in, clk, rst; output q; reg q; always @ (posedge clk) begin if (rst == 1) q = 0; else q = data_in; end Declaration of Synchronous Behavior Procedural Statements ECE 156A 11 Block diagram view a b Add_half sum Block Diagram Block Diagram a b _bar sum One Implementation Schematic ECE 156A 12 4

Comparison Block vs. Implementation Block view Specify inputs and outputs No internal detail Implementation Include specific detail One block view can have many implementations Structural vs. Behavior Structural model Specify how a function is achieved Behavior model Specify only the function One behavior can have many structural models ECE 156A 13 Hierarchical design example Top module Add_rca_4 Add_full Add_full Add_full Add_full Add_half Add_half or xor nand not xor nand not Primitives An half adder (behavior/structural) module Add_half_2 (sum,, a, b); input a, b; output, sum; assign {, sum} = a + b; a b Add_half_2 sum module Add_half_1 (sum,, a, b); input a, b; output sum, ; wire _bar; xor (sum, a, b); nand (_bar, a, b); not (, _bar); a b Add_half_1 sum ECE 156A 15 5

A full adder (structural) Add_full c_in a b a sum Add_half b M1 w1 (a b) w2 a sum Add_half b w3 M2 ab (a b) c_in (a b) c_in (a b) c_in + ab sum module Add_full (sum,, a, b, c_in); input a, b, c_in; output, sum; wire w1, w2, w3; Add_half M1 (w1, w2, a, b); Add_half M2 (sum, w3, w1, c_in); or (, w2, w3); // parent module module instance name // child module // child module // primitive instantiation ECE 156A 16 4-bit adder Module Add_full(sum,, a, b, c_in) module array_of_adders (sum,, a, b, c_in); input [3:0] a,b; input c_in; output [3:0] sum; output ; wire [3:1] carry; Add_full M [3:0] (sum, {, carry[3:1]}, a, b, {carry[3:1], c_in}); Same as saying Add_full M[0](sum[0], carry[1], a[0], b[0], c_in) Add_full M[1](sum[1], carry[2], a[1], b[1], carry[1]) Add_full M[2](sum[2], carry[3], a[2], b[2], carry[2]) Add_full M[3](sum[3],, a[3], b[3], carry[3]) Behavior model of a 4-bit adder module adder_4_rtl (a, b, c_in, sum, ); output [3:0] sum; output ; input [3:0] a, b; input c_in; Continuous Assignment assign {, sum} = a + b + c_in; a b c_in 4 4 adder_4_rtl 4 sum Concatenation ECE 156A 18 6

16-bit adder a[15:0] b[15:0] 16 16 c_in Add_rca_16 16 sum[15:0] a[15:12] b[15:12] a[11:8]b[11:8] a[7:4] b[7:4] a[3:0] b[3:0] c_in 4 4 4 4 4 4 4 4 Add_rca_4 Add_rca_4 Add_rca_4 Add_rca_4 M4 M3 M2 M1 c_in12 c_in8 c_in4 Add_rca_16 sum[15:12] sum[15:8] sum[7:4] sum[3:0] a[3] b[3] a[2] b[2] a[1] b[1] a[0] b[0] c_in G4 G3 G2 G1 Add_full Add_full Add_full Add_full c_in4 c_in3 c_in2 Add_rca_4 sum[3] sum[2] sum[1] sum[0] ECE 156A 19 16-bit Adder module Add_rca_16 (sum,, a, b, c_in); output [15:0] sum; output ; input [15:0] a, b; input c_in; wire c_in, c_in4, c_in8, c_in12, ; Add_rca_4 M1 (sum[3:0], c_in4, a[3:0], b[3:0], c_in); Add_rca_4 M2 (sum[7:4], c_in8, a[7:4], b[7:4], c_in4); Add_rca_4 M3 (sum[11:8], c_in12, a[11:8], b[11:8], c_in8); Add_rca_4 M4 (sum[15:12],, a[15:12], b[15:12], c_in12); module Add_rca_4 (sum,, a, b, c_in); output [3:0] sum; output ; input [3:0] a, b; input c_in; wire c_in4, c_in3, c_in2; Add_full G1 (sum[0], c_in2, a[0], b[0], c_in); Add_full G2 (sum[1], c_in3, a[1], b[1], c_in2); Add_full G3 (sum[2], c_in4, a[2], b[2], c_in3); Add_full G4 (sum[3],, a[3], b[3], c_in4); The concept of Design Entry Design Entry The entry point to do your design Select design data representation(s) Behavior, RTL, Gate-Transistor Schematics Schematic Draw your design with gates/transistors/lines For high-performance blocks Hardware Description Language Describe your design with Verilog/VHDL Just like writing a program No need to worry about structural detail ECE 156A 21 7

Unit level verification Each block or unit should be verified through extensive testbench simulation ECE 156A 22 A testbench example ECE 156A 23 Generic testbench design New version of Verilog has a lot more features to support testbench development ECE 156A 24 8

Delay model in verilog module Add_half_1 (sum,, a, b); input a, b; output sum, ; wire _bar; xor #2 (sum, a, b); nand #2 (_bar, a, b); not #1 (, _bar); These delays have no physical meaning They are used only for simulation The ordering of events is what being specified Not the actual timing Relative delays are more important than absolute numbers ECE 156A 25 Cell Delay Characterization module and123 (o, a, b); input a, b; output o; and (o, a, b); specify specparam Tpd_0_1 = 1.13, 3.09, 7.75 Tpd_1_0 = 0.93, 2.50, 7.34 (a => o) = (Tpd_0_1, Tpd_1_0); (b => o) = (Tpd_0_1, Tpd_1_0); endspecify The delays are only estimations Maybe from SPICE simulation of the actual layout This can only be done for very small cells ECE 156A 26 Inertial delay concept In the upper example, the event of rising transition is de-scheduled by the simulator because the pulse width is less than the propagation delay ECE 156A 27 9

User-defined primitives Basic constructs in your design Contain detailed table-like description Use the keywords primitive endprimitive Differentiate themselves from Modules In test, verification, and simulation, never goes inside primitives (black-boxes) User-defined primitives Instantiated in the same manner as and, or, not, nor, nand, etc. Always has one output port! Output port must be declared as net in a combinational primitive Output port must be declared as reg in a sequential primitive No inout Specify everything (anything left unspecified will be treated as X) 2-bit multiplexer Z input is treated as X! select primitive mux_prim (mux_out, select, a, b); output mux_out; a input select, a, b; mux_prim b table // select a b : mux_out 0 0 0 : 0; // Table order = port order 0 0 1 : 0; // One output, multiple inputs, no inout 0 0 x : 0; // Only 0, 1, x on input and output 0 1 0 : 1; // A z input in simulation is treated as x 0 1 1 : 1; // Last column is the output 0 1 x : 1; mux_out // select a b : mux_out 1 0 0 : 0; 1 1 0 : 0; 1 x 0 : 0; 1 0 1 : 1; 1 1 1 : 1; 1 x 1 : 1; x 0 0 : 0; // Reduces pessimism x 1 1 : 1; endtable // Note: Combinations not explicitly specified will drive x endprimitive // under simulation 10

Shorthand notation? table // Shorthand notation; //? represents iteration of the table entry over the values 0, 1, x. // i.e., don t care on the input // select a b : mux_out 0 0? : 0; //? = 0, 1, x shorthand notation 0 1? : 1; 1? 0 : 0; 1? 1 : 1;? 0 0 : 0;? 1 1 : 1; endtable Primitive notations 0, 1, x:? : {0, 1, x} b : {0, 1} - : no change (vw) : v {0, 1, x} ---> w {0, 1, x} * : {0, 1, x} ---> {0, 1, x} r : (01) f : (10) p : (01), (0x), (x1), (0z), (z1) n : (10), (1x), (x0), (1z), (z0) Sequential Primitives n inputs 1 state and 1 output n+2 columns <n inputs>, <state>, <output>=<next state> Two types: Level sensitive Achieve transparent latch (a latch can be made invisible ) Edge sensitive 11

A Transparent Latch primitive latch (q_out, enable, data); enable output q_out; input enable, data; reg q_out; data Transparent Latch table // en data state: q_out/next state 1 1 :? : 1; 1 0 :? : 0; 0? :? : -; // Note: - denotes no change. // The state is the residual value of q_out endtable // Note: Combinations not explicitly specified will drive x endprimitive // under simulation 1 data q_out t sim 0 10 20 30 40 50 1 enable 0 10 20 30 40 t sim 50 1 q_out t sim 0 10 20 30 40 50 Rising Edge-Sensitive Latch primitive d_prim1 (q_out, clock, data); output q_out; input clock, data; data d_flop q_out reg q_out; clock table // clock data state : q_out/next state (01) 0 :? : 0; // Rising clock edge (01) 1 :? : 1; (0x)? :? : X; (?0)? :? : -; // Falling clock edge? (??) :? : -; // Steady clock, ignore data endtable endprimitive Level-S Dominates Edge-S primitive jk_prim (q_out, clock, j, k, preset, clear); output q_out; input clock, j, k, preset, clear; reg q_out; table // clk j k pre cir state q_out/next_state // Preset Logic??? 0 1? 1; : :??? * 1 : 1 : 1; // Clear Logic??? 1 0 :? : 0;??? 1 * : 0 : 0; // Normal Clocking // clk j k pre cir state q_out/next_state r 0 0 0 0 0 1; : : r 0 0 1 1 :? : -; r 0 1 1 1 :? : 0; r 1 0 1 1 :? : 1; r 1 1 1 1 : 0 : 1; r 1 1 1 1 : 1 : 0; f???? :? : -; // j and k cases // clk j k pre cir state q_out/next_state b *???? -; : : b? *?? :? : -: p 0 0 1 1 :? : -: p 0? 1? : 0 : -: p? 0? 1 : 1 : -: (?0)???? :? : -: (1x) 0 0 1 1 :? : -: (1x) 0? 1? : 0 : -: (1x)? 0? 1 : 1 : -: x * 0? 1 : 1 : -: x 0 * 1? : 0 : -: endtable endprimitive preset j k q_out clk clear 12

Summary Each row specify a transition on only 1 input All no-effect transitions should be stated or the results will be X Only 0,1,x,- are allowed for outputs (no?) Z is X in a primitive Input order = specification order State initialization You can use the initial command In reality, it won t initialize itself You better not count on it in real implementation primitive d_prim2 (q_out, clock, data); output q_out; input clock, data; reg q_out; initial q_out = 0; // Optional -- Declares // initial value of q_out table // clk data state : q_out/next state (01) 0 :? : 0; // Rising clock edge (01) 1 :? : 1; (0?) 1 : 1 : 1; (?0)? :? : -; // Falling clock edge? (??) :? : -; // Steady clock, ignore data endtable endprimitive 13