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

Similar documents
Verilog Tutorial. Introduction. T. A.: Hsueh-Yi Lin. 2008/3/12 VLSI Digital Signal Processing 2

Writing Circuit Descriptions 8

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

Digital Design with SystemVerilog

Lecture 15: System Modeling and Verilog

Verilog introduction. Embedded and Ambient Systems Lab

Digital Design with FPGAs. By Neeraj Kulkarni

Introduction to Digital Design with Verilog HDL

Synthesizable Verilog

Introduction to Verilog HDL. Verilog 1

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

Lecture 32: SystemVerilog

ECEN 468 Advanced Logic Design

CS6710 Tool Suite. Verilog is the Key Tool

Verilog Coding Guideline

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

EECS Components and Design Techniques for Digital Systems. Lec 20 RTL Design Optimization 11/6/2007

Advanced Digital Design Using FPGA. Dr. Shahrokh Abadi

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Digital Design (VIMIAA01) Introduction to the Verilog HDL

Verilog for Synthesis Ing. Pullini Antonio

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

Lecture 3. Behavioral Modeling Sequential Circuits. Registers Counters Finite State Machines

Digital Integrated Circuits

ELCT 501: Digital System Design

Design Using Verilog

VLSI Design 13. Introduction to Verilog

Contents. Appendix D Verilog Summary Page 1 of 16

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Introduction to Verilog/System Verilog

CAD for VLSI Design - I. Lecture 21 V. Kamakoti and Shankar Balachandran

Lecture #2: Verilog HDL

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

CS6710 Tool Suite. Verilog is the Key Tool. Verilog as HDL (AHT) Verilog has a Split Personality. Quick Review. Synthesis

Xilinx ASMBL Architecture

Verilog Tutorial (Structure, Test)

Chap 6 - Introduction to HDL (b)

Introduction To Verilog Design. Chun-Hung Chou

Blocking(=) vs Nonblocking (<=) Assignment. Lecture 3: Modeling Sequential Logic in Verilog HDL. Procedural assignments

CSE140L: Components and Design Techniques for Digital Systems Lab. Verilog HDL. Instructor: Mohsen Imani UC San Diego. Source: Eric Crabill, Xilinx

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

VHDL: RTL Synthesis Basics. 1 of 59

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

Synthesis of Combinational and Sequential Circuits with Verilog

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

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 11. Introduction to Verilog II Sequential Circuits

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline

14. Introducton to Verilog

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

EEL 4783: HDL in Digital System Design

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

CSE140L: Components and Design Techniques for Digital Systems Lab

Online Verilog Resources

Verilog Sequential Logic. Verilog for Synthesis Rev C (module 3 and 4)

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

Verilog for High Performance

problem maximum score 1 10pts 2 8pts 3 10pts 4 12pts 5 7pts 6 7pts 7 7pts 8 17pts 9 22pts total 100pts

Verilog HDL. Gate-Level Modeling

14. Introducton to Verilog

Veriolog Overview. CS/EE 3710 Fall 2010

CSE140L: Components and Design

ECE 551 Digital System Design and Synthesis. Instructor: Kewal K. Saluja. Midterm Exam

UNIT V: SPECIFICATION USING VERILOG HDL

Under-Graduate Project Logic Design with Behavioral Models

ECEN 449 Microprocessor System Design. Verilog. Texas A&M University

ECEN 449 Microprocessor System Design. Verilog. Texas A&M University

yamin/

Homework deadline extended to next friday

ECE 551: Digital System *

Table of Contents. Verilog. Verilog

Register Transfer Level in Verilog: Part I

Chapter 2 Using Hardware Description Language Verilog. Overview

CSE 2021 Computer Organization. The Basics of Logic Design

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

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

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

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

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

Chap 6 Introduction to HDL (d)

Combinational Logic II

MLR Institute of Technology

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

ECE 4514 Digital Design II. Spring Lecture 7: Dataflow Modeling

Introduction to Verilog

Quick Introduction to SystemVerilog: Sequental Logic

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

Verilog HDL Introduction

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Modeling Sequential Circuits in Verilog

ECE 4514 Digital Design II. Spring Lecture 2: Hierarchical Design

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

EECS150 - Digital Design Lecture 10 Logic Synthesis

14:332:231 DIGITAL LOGIC DESIGN. Hardware Description Languages

Combinational Circuit Design

VHDL for Synthesis. Course Description. Course Duration. Goals

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

EECS150 - Digital Design Lecture 10 Logic Synthesis

Brief Introduction to Verilog HDL (Part 1)

Transcription:

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

Different Levels of Abstraction Algorithmic the function of the system RTL the data flow the control signals the storage element and clock Gate gate-level net-list Switch transistor-level net-list Verilog-3 Hierarchical structure Represent the hierarchy of a design modules the basic building blocks ports the I/O pins in hardware input, output or inout Verilog-4

Modules module module_name (port_name); port declaration data type declaration module functionality or structure Verilog-5 Examples 4-bit adder module add4 (s,c3,ci,a,b) input [3:0] a,b ; // port declarations port input ci ; output [3:0] s : // vector output c3 ; data type wire [2:0] co ; add a0 (co[0], s[0], a[0], b[0], ci) ; Structure add a1 (co[1], s[1], a[1], b[1], co[0]) ; add a2 (co[2], s[2], a[2], b[2], co[1]) ; add a3 (c3, s[3], a[3], b[3], co[2]) ; c3 a3 a2 a1 a0 ci Verilog-6

A full-adder module add (co, s, a, b, c) input a, b,c ; output co, s ; xor (n1, a, b) ; xor (s, n1, c) ; nand (n2, a, b) ; nand (n3,n1, c) ; nand (co, n3,n2) ; Verilog-7 Sub-module module adder (co,s,a,b,c);... Mapping port positions module adder8(...) ; adder add1(c1,s1,a1,b1,1 b0), add2(.a(a2),.b(b2),.c(c1),.s (s2),.co(c2)) ;... Mapping names Verilog-8

Data type: input : default wire output : Data Type module test ( Q,S,clk ); output Q,; input S,clk; reg Q; always@(s or clk or Q) Q<=(S&clk) ; always@ (D or clk or Q)begin end reg Verilog-9 Gate-Level Modeling Net-list description built-in primitives gates A full-adder module add (co, s, a, b, c) input a, b,c ; output co, s ; xor (n1, a, b) ; xor (s, n1, c) ; nand (n2, a, b) ; nand (n3,n1, c) ; nand (co, n3,n2) ; Verilog-10

Basic logic gates only and or not buf xor nand nor xnor bufif1, bufif0 notif1, notif0 Verilog Primitives Verilog-11 Primitive Pins Are Expandable One output and variable number of inputs nand (y, in1, in2) ; nand (y, in1, in2, in3) ; nand (y, in1, in2, in3, in4) ; not and buf variable number of outputs but only one input Verilog-12

Modeling Structures Continuous assignment Procedural blocks initial block ( execute only once ) always block ( execute in a loop ) they start together at simulation time-zero Verilog-13 Continuous Assignments Describe combinational logic Operands + operators Drive values to a net assign out = a&b ; // and gate assign eq = (a==b) ; // comparator wire #10 inv = ~in ; // inverter with delay wire [7:0] c = a+b ; // 8-bit adder Avoid logic loops assign a = b + a ; asynchronous design Verilog-14

Operators { } concatenation + - * / arithmetic % modulus > >= < <= relational! logical NOT && logical AND logical OR == logical equality!= logical inequality? : conditional ~ bit-wise NOT & bit-wise AND bit-wise OR ^ bit-wise XOR ^~ ~^ bit-wise XNOR << shift left >> shift right Verilog-15 Operator Precedence [ ] bit-select or part-select ( ) parentheses!, ~ logical and bit-wise negation &,, ~&, ~, ^, ~^, ^~ reduction operators +, - unary arithmetic { }concatenation *, /, % arithmetic +, - arithmetic <<, >> shift >, >=, <, <= relational ==,!= logical equality & ^, ^~, ~^ bit-wise AND bit-wise XOR and XNOR bit-wise OR &&logical AND logical OR? : conditional Verilog-16

RTL Statements Procedural and RTL assignments reg out = a + b ; begin... end block statements group statements if... else statements case statements for loops while loops forever loops Verilog-17 Combinational Always Blocks A complete sensitivity list (inputs) always @(a or b or c) f = a&~c b&c ; Simulation results always @(a or b) f = a&~c b&c ; Parentheses always @(a or b or c or d) z = a + b + c + d ; // z = (a+b) + (c+d) ; Verilog-18

Sequential Always Blocks Inferred latches (Incomplete branch specifications) module infer_latch(d, enable, Q); input D, enable; output Q; reg Q; always @ (D or enable) begin if (enable) Q <= D; end the Q is not specified in a branch a latch like 74373 Verilog-19 Combinational Circuit Design Outputs are functions of inputs inputs comb. circuits Outputs Examples MUX decoder priority encoder adder Verilog-20

Multiplexor Net-list (gate-level) module mux2_1 (out,a,b,sel) ; output out ; input a,b,sel ; not (sel_, sel) ; and (a1, a, sel_) ; and (b1, b, sel) ; or (out, a1, b1) ; Verilog-21 Multiplexor Continuous assignment module mux2_1 (out,a,b,sel) ; output out ; input a,b,sel ; assign out = (a&~sel) (b&sel) ; RTL modeling always @(a or b or sel) if(sel) out = b; else out = a; Verilog-22

Multiplexor 4-to-1 multiplexor module mux4_1 (out, in0, in1, in2, in3, sel) ; output out ; input in0,in1,in2,in3 ; input [1:0] sel ; assign out = (sel == 2'b00)? in0 : (sel == 2'b01)? in1 : (sel == 2'b10)? in2 : (sel == 2'b11)? in3 : 1'bx ; Verilog-23 module mux4_1 (out, in, sel) ; output out ; input [3:0] in ; input [1:0] sel ; reg out ; always @(sel or in) begin case(sel) 2 d0: out = in[0] ; 2 d1: out = in[1] ; 2 d2: out = in[2] ; 2 d3: out = in[3] ; default: 1 bx ; endcase end Verilog-24

Decoder 3-to 8 decoder with an enable control module decoder(o,enb_,sel) ; output [7:0] o ; input enb_ ; input [2:0] sel ; reg [7:0] o ; always @ (enb_ or sel) if(enb_) else o = 8'b1111_1111 ; case(sel) 3'b000 : o = 8'b1111_1110 ; 3'b001 : o = 8'b1111_1101 ; 3'b010 : o = 8'b1111_1011 ; 3'b011 : o = 8'b1111_0111 ; 3'b100 : o = 8'b1110_1111 ; 3'b101 : o = 8'b1101_1111 ; 3'b110 : o = 8'b1011_1111 ; 3'b111 : o = 8'b0111_1111 ; default : o = 8'bx ; endcase Verilog-25 Priority Encoder always @ (d0 or d1 or d2 or d3) if (d3 == 1) {x,y,v} = 3 b111 ; else if (d2 == 1) {x,y,v} = 3 b101 ; else if (d1 == 1) {x,y,v} = 3 b011 ; else if (d0 == 1) {x,y,v} = 3 b001 ; else {x,y,v} = 3 bxx0 ; Verilog-26

RTL modeling module adder(c,s,a,b) ; output c ; output [7:0] s ; input [7:0] a,b ; assign {c,s} = a + b ; Adder Logic synthesis CLA adder for speed optimization ripple adder for area optimization Verilog-27 Procedural Assignments Blocking assignments always @(posedge clk) begin end rega = data ; regb = rega ; Non-blocking assignments always @(posedge clk) begin end regc <= data ; regd <= regc ; rega t =data regb t =data regc t =data regd t =regc t-1 Verilog-28

Sequential Circuit Design Inputs Combinational circuit Memory elements Outputs a feedback path the state transition synchronous circuits asynchronous circuits Verilog-29 Examples D flip-flop D latch register shifter counter pipeline FSM Verilog-30

Flip-Flop Synchronous clear module d_ff (q,d,clk,clr_) ; output q ; input d,clk,clr_ ; reg q ; always @ (posedge clk) if (~clr_) q = 0 ; else q = d ; Asynchronous clear always @ (posedge clk or negedge clr_) if (~clr_) q = 0 ; else q = d ; Verilog-31 Register module register (q,d,clk,clr_, set_) ; output [7:0] q ; input [7:0] d ; input clk,clr_, set_ ; reg [7:0] q ; always @ (posedge clk or negedge clr_ or negedge set_) if (~clr_) q = 0 ; else if (~set_) q = 8 b1111_1111 ; else q = d ; Verilog-32

D latch always @ (enable or data) if (enable) D Latches q = data ; D latch with gated asynchronous data always @ (enable or data or gate) if (enable) q = data & gate ; Verilog-33 Shifter module shifter (so,si,d,clk,ld_,clr_) ; output so ; input [7:0] d ; input si,clk,ld_,clr_ ; // asynchronous clear and synchronous load reg [7:0] q ; assign so = q[7] ; always @ (posedge clk or negedge clr_) if (~clr_) ld_ d q = 0 ; else if (~ld_) si so q = d ; shifter clk else q[7:0] = {q[6:0],si} ; Verilog-34

Finite State Machine Moore model inputs comb. circuit next state memory elements current state comb. circuit outputs Mealy model inputs comb. circuit next state memory elements current state comb. circuit outputs Verilog-35 Inefficient Description module count (clock, reset, and_bits, or_bits, xor_bits); input clock, reset; output and_bits, or_bits, xor_bits; reg and_bits, or_bits, xor_bits; reg [2:0] count; always @(posedge clock) begin if (reset) count = 0; else count = count + 1; and_bits = & count; or_bits = count; xor_bits = ^ count; end Verilog-36

Six implied registers Verilog-37 Efficient Description Separate combinational and sequential circuits module count (clock, reset, and_bits, or_bits, xor_bits); input clock, reset; output and_bits, or_bits, xor_bits; reg and_bits, or_bits, xor_bits; reg [2:0] count; always @(posedge clock) begin if (reset) count = 0; else count = count + 1; end // combinational circuits always @(count) begin and_bits = & count; or_bits = count; xor_bits = ^ count; end Verilog-38

Three registers are used Verilog-39 Pipelines comb. circuits comb. circuits comb. circuits flipflops flipflops flipflops An example a b n-sum Dff sum p Dff out c Dff d_c assign n_sum = a+b assign p = sum * d_c // plus D flip-flops always @ (posedge clk) sum = n_sum ; Verilog-40

Memory module memory (data, addr, read, write); input read, write; input [4:0] addr; inout [7:0] data; reg [7:0] data_reg; reg [7:0] memory [0:8'hff]; parameter load_file = "cput1.txt"; assign data = (read)? memory [addr] : 8'hz; always @ (posedge write) memory[addr] = data; initial $readmemb (load_file, memory); Verilog-41