Verilog for Combinational Circuits

Similar documents
Gate-Level Minimization

Combinational Logic. Prof. Wangrok Oh. Dept. of Information Communications Eng. Chungnam National University. Prof. Wangrok Oh(CNU) 1 / 93

Register Transfer Level in Verilog: Part I

Combinational Logic II

Verilog Dataflow Modeling

Hardware Description Languages (HDLs) Verilog

Gate-Level Minimization

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

Verilog Behavioral Modeling

Combinational Logic Design with Verilog. ECE 152A Winter 2012

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

ECE Digital System Design & Synthesis Exercise 1 - Logic Values, Data Types & Operators - With Answers

Introduction to Verilog

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

Combinational Logic Circuits

Hardware description language (HDL)

EECS 3201: Digital Logic Design Lecture 4. Ihab Amer, PhD, SMIEEE, P.Eng.

Hardware Description Language (HDL)

CENG 241 Digital Design 1

Hardware description languages

Introduction to Verilog HDL

Iteration Bound. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

Verilog Tutorial (Structure, Test)

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

HDL for Combinational Circuits. ENEL211 Digital Technology

Tutorial on Verilog HDL

Course Topics - Outline

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

Introduction to Verilog HDL. Verilog 1

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

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

2/14/2016. Hardware Synthesis. Midia Reshadi. CE Department. Entities, Architectures, and Coding.

Verilog HDL. A Guide to Digital Design and Synthesis. Samir Palnitkar. SunSoft Press A Prentice Hall Title

MLR Institute of Technology

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

Chapter 3 Part 2 Combinational Logic Design

Overview of Verilog Part 1

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

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

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

Contents. Appendix D Verilog Summary Page 1 of 16

Chapter 2a: Structural Modeling

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

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

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

Workshop on Digital Circuit Design in FPGA

Chapter 2 Using Hardware Description Language Verilog. Overview

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

Chap 6 Introduction to HDL (d)

EECS150 - Digital Design Lecture 10 Logic Synthesis

Structural Modeling with Verilog

LOGIC CIRCUITS. Kirti P_Didital Design 1

Vertex Shader Design II

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

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

VLSI Design 13. Introduction to Verilog

UNIT V: SPECIFICATION USING VERILOG HDL

Software Engineering 2DA4. Slides 2: Introduction to Logic Circuits

EEL 4783: Hardware/Software Co-design with FPGAs

CET ECET CET 486. C. Sisterna Spring 2003

Advanced Digital Design with the Verilog HDL

Design Using Verilog

EECS150 - Digital Design Lecture 10 Logic Synthesis

Digital Systems and Binary Numbers

Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification

Module 4. Design of Embedded Processors. Version 2 EE IIT, Kharagpur 1

TOPIC : Verilog Synthesis examples. Module 4.3 : Verilog synthesis


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

Verilog Design Principles

Folding. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall,

Online Verilog Resources

Chap.3 3. Chap reduces the complexity required to represent the schematic diagram of a circuit Library

VHDL. Chapter 1 Introduction to VHDL. Course Objectives Affected. Outline

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 09 MULTIPLEXERS

Chap 3. Modeling structure & basic concept of Verilog HDL

60-265: Winter ANSWERS Exercise 4 Combinational Circuit Design

Gate level or structural modeling

01 Introduction to Digital Logic. ENGR 3410 Computer Architecture Mark L. Chang Fall 2008

Department of Computer Science and Electrical Engineering. Intro to Verilog II

Lab 1 Modular Design and Testbench Simulation ENGIN 341 Advanced Digital Design University of Massachusetts Boston

RTL Coding General Concepts

HW1 Modeling Concepts

Vertex Shader Design I

14:332:231 DIGITAL LOGIC DESIGN. Verilog Functions and Tasks

Verilog HDL Introduction

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

QUESTION BANK FOR TEST

EECS150 - Digital Design Lecture 8 - Hardware Description Languages

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

LAB K Basic Verilog Programming

Lab 7 (Sections 300, 301 and 302) Prelab: Introduction to Verilog

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

Introduction to VHDL. Main language concepts

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

ECE UMass, Amherst. Verilog tutorial

Transcription:

Verilog for Combinational Circuits Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall, 2014 ldvan@cs.nctu.edu.tw http://www.cs.nctu.edu.tw/~ldvan/

HDL Models of Combinational Circuits Modeling Styles Gate-level modeling using instantiations of predefined and user-defined primitive gates. Dataflow modeling using continuous assignments with keyword assign. Behavioral modeling using procedural assignments with keyword always. (Instantiations ~ the HDL counterpart of placing and connecting parts on a circuit board) 2

Gate-level Modeling The four-valued logic truth tables for the and, or, xor, and not primitives Unknown High impedance 3

Gate-level Modeling Example (identifiers having multiple bit widths, call vectors): output [0: 3] D; wire [7: 0] SUM; 1. The first statement declares an output vector D with four bits, 0 through 3. 2. The second declares a wire vector SUM with eight bits numbered 7 through 0. 4

Gate-level Modeling 1st once 5

1-Bit Half Adder Half adder 0 + 0 = 0 ; 0 + 1 = 1 ; 1 + 0 = 1 ; 1 + 1 = (10) 2 two input variables: x, y two output variables: C (carry), S (sum) truth table S = x'y+xy'=x y= (x+y)(x'+y') C = xy= (x'+y')' S' = xy+x'y' S = (C+x'y')' Lan-Da Van DCD-04-6

Logic Diagram of 1-Bit Half Adder Lan-Da Van DCD-04-7

Full-Adder The arithmetic sum of three input bits three input bits x, y: two significant bits z: the carry bit from the previous lower significant bit Two output bits: C, S 1-Bit Full Adder Su m Carry Lan-Da Van DCD-04-8

Logic Diagram of 1-Bit Full Adder Lan-Da Van DCD-04-9

Logic Diagram of 1-Bit Full Adder S = x'y'z+x'yz'+ xy'z'+xyz = x (y z) +x(y z) = x y z C = xy + xz + yz = xy + xyz + xy z + xyz + x yz = xy + z (x y + xy) = xy + z (x y) Lan-Da Van DCD-04-10

Gate-level Modeling Bottom-up hierarchical description 11

Gate-level Modeling HDL Example 4.2 (cont.) S1 C1 C2 12

Gate-level Modeling Statement of Three-state gates: gate name (output, input, control); 13

Gate-level Modeling Example (gate instantiation with three-state gates) 14

Gate-level Modeling Nets (not a keyword): a set of data types representing connections between hardware elements wire, wor, wand, tri, supply1, supply0. 15

Dataflow Modeling What s the function? Example: assign Y = (A & S) (B & ~S) B m_out A select 16

Dataflow Modeling 17

Dataflow Modeling 18

Dataflow Modeling A Verilog HDL synthesis compiler can accept the module description as input, execute synthesis algorithms, and provide an output netlist and a schematic of a circuit equivalent to the one in Fig. 4.17 (see next page), all without manual intervention! 19

Magnitude Comparator Fig. 4.17 Four-bit magnitude comparator. 20

Magnitude Comparator The comparison of two numbers outputs: A>B, A=B, A<B Design Approaches the truth table 2 2n entries - too cumbersome for large n use inherent regularity of the problem reduce design efforts reduce human errors Algorithm -> logic A = A 3 A 2 A 1 A 0 ; B = B 3 B 2 B 1 B 0 A=B if A 3 =B 3, A 2 =B 2, A 1 =B 1 and A 0 =B 0 equality: x i = A i B i +A i 'B i ' (A=B) = x 3 x 2 x 1 x 0 (A>B) = A 3 B 3 '+x 3 A 2 B 2 '+x 3 x 2 A 1 B 1 '+x 3 x 2 x 1 A 0 B 0 ' (A<B) = A 3 'B 3 +x 3 A 2 'B 2 +x 3 x 2 A 1 'B 1 +x 3 x 2 x 1 A 0 'B 0 Implementation x i = (A i B i '+A i 'B i )' Lan-Da Van DCD-04-21

Dataflow Modeling Conditional operator (?:) condition? true-expression : false-expression B m_out A select 22

Behavioral Modeling If statement: if (select) OUT = A; B m_out A select 23

Behavioral Modeling 24

initial block Writing a Simple Test Bench Inputs specified by a three-bit truth table // #10: delayed by 10ns 25

Writing a Simple Test Bench Stimulus module 26

Writing a Simple Test Bench Interaction between stimulus and design modules 27

Writing a Simple Test Bench System tasks for display Syntax for $display, $write, and $monitor: Task-name (format specification, argument list); Example: Example: 28

Writing a Simple Test Bench B m_out A select 29

Writing a Simple Test Bench B m_out A select 30

Writing a Simple Test Bench a full adder 31

Writing a Simple Test Bench 32