Combinational Logic Design with Verilog. ECE 152A Winter 2012

Similar documents
Verilog for Combinational Circuits

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

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

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

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

ECE 353 Lab 4. Verilog Review. Professor Daniel Holcomb With material by Professor Moritz and Kundu UMass Amherst Fall 2016

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

Contents. Appendix D Verilog Summary Page 1 of 16

Hardware Description Languages (HDLs) Verilog

DIGITAL SYSTEM DESIGN

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

Introduction to Verilog HDL

Tutorial on Verilog HDL

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

Synthesizable Verilog

Digital Design with FPGAs. By Neeraj Kulkarni

Hardware description languages

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

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

Verilog Tutorial (Structure, Test)

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Introduction to Verilog HDL. Verilog 1

101-1 Under-Graduate Project Digital IC Design Flow

HDL for Combinational Circuits. ENEL211 Digital Technology

ECE 353 Lab 3 (Verilog Design Approach)

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

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

Synthesis of Combinational and Sequential Circuits with Verilog

Chapter 2a: Structural Modeling

VLSI Design 13. Introduction to Verilog

Lecture 15: System Modeling and Verilog

ENGN1640: Design of Computing Systems Topic 02: Design/Lab Foundations

Chapter 2 Using Hardware Description Language Verilog. Overview

Lecture 2 Hardware Description Language (HDL): VHSIC HDL (VHDL)

ENGN1640: Design of Computing Systems Topic 02: Design/Lab Foundations

Hardware Design Environments. Dr. Mahdi Abbasi Computer Engineering Department Bu-Ali Sina University

EE 8351 Digital Logic Circuits Ms.J.Jayaudhaya, ASP/EEE

Lab. Course Goals. Topics. What is VLSI design? What is an integrated circuit? VLSI Design Cycle. VLSI Design Automation

ECE 353 Lab 4. Verilog Review. Professor Daniel Holcomb UMass Amherst Fall 2017

MODELING LANGUAGES AND ABSTRACT MODELS. Giovanni De Micheli Stanford University. Chapter 3 in book, please read it.

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

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

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

Topics. Midterm Finish Chapter 7

Hardware Synthesis. References

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

Lecture 8: Combinational Verilog. CSE 370, Autumn 2007 Benjamin Ylvisaker. Where We Are. Last lecture: Minimization with K!maps

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

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

Introduction to Verilog

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

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

ANADOLU UNIVERSITY DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EEM Digital Systems II

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

Combinational Logic II

Introduction to Verilog. Garrison W. Greenwood, Ph.D, P.E.

Combinational Verilog Intro. EECS 270 Labs

Verilog Module 1 Introduction and Combinational Logic

LSN 1 Digital Design Flow for PLDs

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

14. Introducton to Verilog

ECEN 468 Advanced Digital System Design

EEL 4783: Hardware/Software Co-design with FPGAs

ECE UMass, Amherst. Verilog tutorial

Don t expect to be able to write and debug your code during the lab session.

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

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

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

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

DIGITAL SYSTEM DESIGN

14. Introducton to Verilog

UNIT V: SPECIFICATION USING VERILOG HDL

CHAPTER - 2 : DESIGN OF ARITHMETIC CIRCUITS

ECE 152A LABORATORY 2

ENGN1640: Design of Computing Systems Topic 02: Lab Foundations

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

Evolution of Implementation Technologies. ECE 4211/5211 Rapid Prototyping with FPGAs. Gate Array Technology (IBM s) Programmable Logic

Chap 6 Introduction to HDL (d)

EEL 4783: Hardware/Software Co-design with FPGAs

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

MLR Institute of Technology

HDLs and SystemVerilog. Digital Computer Design

Verilog Design Entry, Synthesis, and Behavioral Simulation

EECS150 - Digital Design Lecture 10 Logic Synthesis

EEL 4783: HDL in Digital System Design

Design Using Verilog

EECS150 - Digital Design Lecture 10 Logic Synthesis

C-Based Hardware Design

Advanced Digital Design with the Verilog HDL

EN164: Design of Computing Systems Lecture 06: Lab Foundations / Verilog 2

CSE140 L. Instructor: Thomas Y. P. Lee January 18,2006. CSE140L Course Info

register:a group of binary cells suitable for holding binary information flip-flops + gates

Module 2.1 Gate-Level/Structural Modeling. UNIT 2: Modeling in Verilog

Digital System Design Verilog-Part III. Amir Masoud Gharehbaghi

P-1/26. Samir Palnitkar. Prentice-Hall, Inc. INSTRUCTOR : CHING-LUNG SU.

Nikhil Gupta. FPGA Challenge Takneek 2012

Online Verilog Resources

Structural Modeling with Verilog

Transcription:

Combinational Logic Design with Verilog ECE 152A Winter 2012

Reading Assignment Brown and Vranesic 2 Introduction to Logic Circuits 2.10 Introduction to Verilog 2.10.1 Structural Specification of Logic Circuits 2.10.2 Behavioral Specification of Logic Circuits 2.10.3 How Not to Write Verilog Code January 30, 2012 ECE 152A - Digital Design Principles 2

Reading Assignment Brown and Vranesic (cont) 1 st edition only! 4 Optimized Implementation of Logic Functions 4.12 CAD Tools 4.12.1 Logic Synthesis and Optimization 4.12.2 Physical Design 4.12.3 Timing Simulation 4.12.4 Summary of Design Flow 4.12.5 Examples of Circuits Synthesized from Verilog Code January 30, 2012 ECE 152A - Digital Design Principles 3

Programmable Logic Provides low cost and flexibility in a design Replace multiple discrete gates with single device Logical design can be changed by reprogramming the device No change in board design Logical design can be changed even after the part has been soldered onto the circuit board in modern, In-system programmable device Inventory can focus on one part Multiple uses of same device January 30, 2012 ECE 152A - Digital Design Principles 4

Programmable Logic Evolution of Programmable Logic Both in time and complexity ROM s and RAM s Not strictly programmable logic, but useful in implementing combinational logic and state machines PAL s PAL s Programmable Array Logic PLA s Programmable Logic Array GAL s Generic Logic Array January 30, 2012 ECE 152A - Digital Design Principles 5

Programmable Logic PLD s Programmable Logic Device CPLD s PLDs are (in general) advanced PALs Complex Programmable Logic Device FPGA s Multiple PLDs on a single chip Field Programmable Gate Array January 30, 2012 ECE 152A - Digital Design Principles 6

Design Entry In previous examples, design entry is schematic based TTL implementation using standard, discrete integrated circuits PLD implementation using library of primitive elements Code based design entry uses a hardware description language (HDL) for design entry Code is synthesized and implemented on a PLD January 30, 2012 ECE 152A - Digital Design Principles 7

Verilog Design Structural Verilog Looks like the gate level implementation Specify gates and interconnection Text form of schematic Referred to as netlist Allows for bottom up design Begin with primitives, instantiate in larger blocks January 30, 2012 ECE 152A - Digital Design Principles 8

Verilog Design RTL (Register Transfer Level) Verilog Allows for top down design No gate structure or interconnection specified Synthesizable code (by definition) Emphasis on synthesis, not simulation vs. high level behavioral code and test benches No timing specified in code No initialization specified in code Timing, stimulus, initialization, etc. generated in testbench (later) January 30, 2012 ECE 152A - Digital Design Principles 9

Half Adder - Structural Verilog Design Recall Half Adder description from schematic based design example Operation Truth table Circuit Graphical symbol January 30, 2012 ECE 152A - Digital Design Principles 10

Verilog Syntax Modules are the basic unit of Verilog models Functional Description Unambiguously describes module s operation Functional, i.e., without timing information Input, Output and Bidirectional ports for interfaces May include instantiations of other modules Allows building of hierarchy January 30, 2012 ECE 152A - Digital Design Principles 11

Verilog Syntax Module declaration module ADD_HALF (s,c,x,y); Parameter list is I/O Ports Port declaration Can be input, output or inout (bidirectional) output s,c; input x,y; January 30, 2012 ECE 152A - Digital Design Principles 12

Verilog Syntax Declare nodes as wires or reg Wires assigned to declaratively Reg assigned to procedurally More on this later In a combinational circuit, all nodes can, but don t have to be, declared wires Depends on how code is written Node defaults to wire if not declared otherwise wire s,c,x,y; January 30, 2012 ECE 152A - Digital Design Principles 13

Verilog Syntax Gates and interconnection xor G1(s,x,y); and G2(c,x,y); Verilog gate level primitive Gate name Internal (local) name Instance name Parameter list Output port, input port, input port January 30, 2012 ECE 152A - Digital Design Principles 14

Gate Instantiation Verilog Gates Note: notif and bufif are tri-state gates January 30, 2012 ECE 152A - Digital Design Principles 15

Verilog Syntax Close the module definition with endmodule Comments begin with // January 30, 2012 ECE 152A - Digital Design Principles 16

Half Adder - Structural Verilog Design module ADD_HALF (s,c,x,y); output s,c; input x,y; wire s,c,x,y; // this line is optional since nodes default to wires xor G1 (s,x,y); // instantiation of XOR gate and G2 (c,x,y); // instantiation of AND gate endmodule January 30, 2012 ECE 152A - Digital Design Principles 17

Half Adder PLD Implementation Functional Simulation Input 0+0 0+1 1+0 1+1 Output 00 01 01 10 January 30, 2012 ECE 152A - Digital Design Principles 18

Full Adder Structural Verilog Design Recall Full Adder description from schematic based design example Truth table Karnaugh maps Circuit January 30, 2012 ECE 152A - Digital Design Principles 19

Full Adder from 2 Half Adders January 30, 2012 ECE 152A - Digital Design Principles 20

Full Adder Structural Verilog Design module ADD_FULL (s,cout,x,y,cin); output s,cout; input x,y,cin; //internal nodes also declared as wires wire cin,x,y,s,cout,s1,c1,c2; ADD_HALF HA1(s1,c1,x,y); ADD_HALF HA2(s,c2,cin,s1); or (cout,c1,c2); endmodule January 30, 2012 ECE 152A - Digital Design Principles 21

Full Adder PLD Implementation Functional Simulation Input 0+0+0 0+0+1 0+1+0 0+1+1 1+0+0 1+0+1 1+1+0 1+1+1 Output 00 01 01 10 01 10 10 11 January 30, 2012 ECE 152A - Digital Design Principles 22

Verilog Operators The Verilog language includes a large number of logical and arithmetic operators Bit length column indicates width of result January 30, 2012 ECE 152A - Digital Design Principles 23

Behavioral Specification of Logic Circuits Continuous Assignment Operator assign sum = a ^ b; Assign to a wire (generated declaratively) Equivalent to xor (sum,a,b); Continuous and concurrent with other wire assignment operations If a or b changes, sum changes accordingly All wire assignment operations occur concurrently Order not specified (or possible) January 30, 2012 ECE 152A - Digital Design Principles 24

Full Adder from Logical Operations module ADD_FULL_RTL (sum,cout,x,y,cin); output sum,cout; input x,y,cin; //declaration for continuous assignment wire cin,x,y,sum,cout; //logical assignment assign sum = x ^ y ^ cin; assign cout = x & y x & cin y & cin; endmodule January 30, 2012 ECE 152A - Digital Design Principles 25

Full Adder from Arithmetic Operations module ADD_FULL_RTL (sum,cout,x,y,cin); output sum,cout; input x,y,cin; //declaration for continuous assignment wire cin,x,y,sum,cout; // concatenation operator and addition assign {cout, sum} = x + y + cin; endmodule January 30, 2012 ECE 152A - Digital Design Principles 26

Procedural Verilog Statements Recall: Wires assigned to declaratively Continuous / concurrent assignment Reg variables assigned to procedurally Value is registered until next procedural assignment Continuous assignment (wires) occurs immediately on input change Enables clocked (synchronous) timing January 30, 2012 ECE 152A - Digital Design Principles 27

Procedural Verilog Statements The always block Syntax is always at the occurrence (@) of any event on the sensitivity list, execute the statements inside the block (in order) always @ (x or y or cin) {cout, sum} = x + y + cin; January 30, 2012 ECE 152A - Digital Design Principles 28

RTL Design of Full Adder module ADD_FULL_RTL (sum,cout,x,y,cin); output sum,cout; input x,y,cin; //declaration for behavioral model wire cin,x,y; reg sum,cout; // behavioral specification always @ (x or y or cin) {cout, sum} = x + y + cin; endmodule January 30, 2012 ECE 152A - Digital Design Principles 29

Two-bit, Ripple Carry Adder Structural Verilog module TWO_BIT_ADD (S,X,Y,cin,cout); input cin; input [1:0]X,Y; output [1:0]S; output cout; // vectored input // and output signals wire cinternal; ADD_FULL AF0(S[0],cinternal,X[0],Y[0],cin); ADD_FULL AF1(S[1],cout,X[1],Y[1],cinternal); endmodule January 30, 2012 ECE 152A - Digital Design Principles 30

Two-bit, Ripple Carry Adder PLD Implementation Functional Simulation Base-4 Bus Representation of X, Y and Sum 0+1+3 = 4 = 10 4 1+2+2 = 5 = 11 4 0+3+0 = 3 = 03 4 1+3+3 = 7 = 13 4 January 30, 2012 ECE 152A - Digital Design Principles 31

Verilog Test Bench Device Under Test (DUT) Circuit being designed/developed Testbench Full adder for this example Provides stimulus to DUT Like test equipment on a bench Instantiate DUT in testbench Generate all signals in testbench No I/O (parameter list) in testbench January 30, 2012 ECE 152A - Digital Design Principles 32

Full Adder Testbench Example module ADDFULL_TB; reg a,b,ci; wire sum,co; initial begin a = 0; b = 0; ci = 0; end always begin #5 a = ~a; end always begin #10 b = ~b; end always begin #20 ci = ~ci; end ADD_FULL AF1(sum,co,a,b,ci); endmodule January 30, 2012 ECE 152A - Digital Design Principles 33