Lecture 7. Summary of two-level combinational-logic. Ways of specifying circuits. Solving combinational design problems. Verilog versus VHDL

Similar documents
Where We Are. Quick History Lesson. Lecture 8: Combinational Verilog. Specifying Circuits. Last lecture: Minimization with K!maps

Hardware description languages

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

Hardware Description Languages: Verilog. Quick History of HDLs. Verilog/VHDL. Design Methodology. Verilog Introduction. Verilog.

! ISP (circa 1977) - research project at CMU " Simulation, but no synthesis

Hardware Description Languages: Verilog

Outline. EECS150 - Digital Design Lecture 5 - Verilog 2. Structural Model: 2-to1 mux. Structural Model - XOR. Verilog Basics Lots of Examples

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

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

EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline

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

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

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

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Synthesizable Verilog

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Chapter 3 working with combinational logic

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

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

Advanced Digital Design Using FPGA. Dr. Shahrokh Abadi

Lab #1. Topics. 3. Introduction to Verilog 2/8/ Programmable logic. 2. Design Flow. 3. Verilog --- A Hardware Description Language

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

Administrivia. CSE 370 Spring 2006 Introduction to Digital Design Lecture 9: Multilevel Logic

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

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

2/8/2017. SOP Form Gives Good Performance. ECE 120: Introduction to Computing. K-Maps Can Identify Single-Gate Functions

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

Digital Design with FPGAs. By Neeraj Kulkarni

! Initially developed under DOD auspices, later standardized as IEEE standards , , & (standard logic data type)

Combinational Logic II

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

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

Chapter 2 Basic Logic Circuits and VHDL Description

Design Entry: Schematic Capture and VHDL ENG241: Digital Design Week #4

Lecture #2: Verilog HDL

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

Online Verilog Resources

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

Contents. Appendix D Verilog Summary Page 1 of 16

ECE 353 Lab 3 (Verilog Design Approach)

EEL 4783: Hardware/Software Co-design with FPGAs

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

Digital Logic Design (3)

Verilog. Reminder: Lab #1 due tonight! Fall 2008 Lecture 3

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1

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

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

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

Introduction. Why Use HDL? Simulation output. Explanation

VHDL for Synthesis. Course Description. Course Duration. Goals

Chapter 2 Using Hardware Description Language Verilog. Overview

Introduction to Verilog HDL

Introduction to Verilog

Register Transfer Level in Verilog: Part I

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

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

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

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

Design Using Verilog

CSE140L: Components and Design Techniques for Digital Systems Lab

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

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

CSE140L: Components and Design

Digital Fundamentals. Lab 6 2 s Complement / Digital Calculator

C-Based Hardware Design

Lecture 15: System Modeling and Verilog

ENGIN 241 Digital Systems with Lab

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Introduction to Verilog/System Verilog

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

Introduction to Verilog HDL. Verilog 1

Topics. Midterm Finish Chapter 7

ENGN1640: Design of Computing Systems Topic 02: Lab Foundations

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

EEL 4783: HDL in Digital System Design

Hardware Description Languages. Veriolog Overview. CS/EE 3710 Fall Verilog. Verilog Origins. Quick Review (2001 syntax) Quick Review HDL

INTRODUCTION TO VHDL. Lecture 5 & 6 Dr. Tayab Din Memon Assistant Professor Department of Electronic Engineering, MUET

Lecture 4. VHDL Fundamentals. George Mason University

Verilog Module 1 Introduction and Combinational Logic

Synthesis of Combinational and Sequential Circuits with Verilog

Hardware Description Languages (HDLs) Verilog

IT T35 Digital system desigm y - ii /s - iii

WELCOME TO. ENGR 303 Introduction to Logic Design. Hello my name is Dr. Chuck Brown

Verilog Hardware Description Language ROOM: B405

Hardware description language (HDL)

Chapter 4 :: Topics. Introduction. SystemVerilog. Hardware description language (HDL): allows designer to specify logic function only.

Verilog for Combinational Circuits

EEL 4783: Hardware/Software Co-design with FPGAs

Introduction to VHDL. Main language concepts

Digital Design with SystemVerilog

Verilog introduction. Embedded and Ambient Systems Lab

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Lecture 4. VHDL Fundamentals. Required reading. Example: NAND Gate. Design Entity. Example VHDL Code. Design Entity

Outline. EECS Components and Design Techniques for Digital Systems. Lec 11 Putting it all together Where are we now?

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

Verilog for Synthesis Ing. Pullini Antonio

Hardware Description Language VHDL (1) Introduction

ECEN 468 Advanced Logic Design

Abstraction of State Elements. Sequential Logic Implementation. Forms of Sequential Logic. Finite State Machine Representations

Transcription:

Lecture 7 Summary of two-level combinational-logic Logistics Homework due today Homework out today due next Wednesday First midterm a week Friday: Friday Jan 0 Will cover up to the of Multiplexers/DeMultiplexers Last lecture K-Maps Today Verilog Structural constructs Describing combinational circuits Logic functions and truth tables ND, OR, uf,, NND, NOR, OR, NOR Minimal set xioms and theorems of oolean algebra Proofs by re-writing Proofs by truth table Gate logic Networks of oolean functions NND/NOR conversion and de Morgan s theorem anonical forms Two-level forms Incompletely specified functions (don t cares) Simplification Two-level simplification (K-maps) Solving combinational design problems Ways of specifying circuits Step : Understand the problem Identify the inputs and outputs Draw a truth table Step : Simplify the logic Draw a K-map Write a simplified oolean expression SOP or POS Use don t cares Step : Implement the design Logic gates and/or Verilog Schematics Structural description Describe circuit as interconnected elements uild complex circuits using hierarchy Large circuits are unreadable HDLs Hardware description languages Not programming languages Parallel languages tailored to digital design Synthesize code to produce a circuit 4 Hardware description languages (HDLs) Verilog versus VHDL bel (~98) Developed by Data-I/O Targeted to PLDs (programmable logic devices) Limited capabilities (can do state machines) Verilog (~985) Developed by Gateway (now part of adence) Syntax similar to Moved to public domain in 990 VHDL (~987) DoD (Department of Defence) sponsored Syntax similar to da oth I standard languages Most tools support both Verilog is simpler Less syntax, fewer constructs VHDL is more structured an be better for large, complex systems etter modularization 5 6

and synthesis and synthesis (con t) xecute a design to verify correctness Synthesis Generate a physical implementation from HDL code Models what a circuit does Multiply is *, ignoring implementation options an include static timing llows you to test design options HDL Description Functional Validation Synthesis Gate or Transistor Description Functional/ Timing Validation Physical Implementation Real hip! Synthesis onverts your code to a netlist an simulate synthesized design Tools map your netlist to hardware and synthesis in the S curriculum S70: Learn simulation S467: Learn synthesis 7 8 Specifying circuits in Verilog ou provide an environment Using non-circuit constructs ctive-hdl waveforms, Read files, print Using Verilog simulation code test fixture Test Fixture (Specification) ircuit Description (Synthesizable) Note: We will ignore timing and test benches until later 9 There are three major styles Instances and wires ontinuous assignments always blocks Structural wire ; and g(,,); not g(,); or g(,,); wire ; assign = & ; assign = ~; assign = ; g g ehavioral g reg,, ; always @ ( or or ) = & ; = ~; = ; 0 Data types Data types that do not exist Values on a wire 0,, x (unknown or conflict), z (tristate or unconnected) Vectors [:0] vector of 4 bits: [], [], [], [0] Unsigned integer value Indices must be constants oncatenating bits/vectors e.g. sign ext [7:0] = {[], [], [], [], [:0]}; [7:0] = {4{[]}, [:0]}; Style: Use a[7:0] = b[7:0] + c[7:0] Not a = b + c; Legal syntax: = &[6:7]; // logical and of bits 6 and 7 of Structures Pointers Objects Recursive types (Remember, Verilog is not or Java or Lisp or!)

Numbers Operators Format: <sign><size><base format><number> 4 Decimal number 4 b 4-bit s complement binary of 00 (is 0) b0000_000_00 bit binary number (_ is ignored) h046 -digit (-bit) hexadecimal number Verilog values are unsigned [4:0] = [:0] + [:0]; if = 00 (6) and = 00( 6), then = 0000 (not 00000) is zero-padded, not sign-exted Similar to operators 4 Two abstraction mechanisms asic building blocks: Modules Modules More structural Heavily used in 70 and real Verilog code Functions More behavioral Used to some extent in real Verilog, but not much in 70 Instanced into a design (like macros) Never called Illegal to nest module defs. Modules execute in parallel Names are case sensitive // for comments Name can t with a number Use wires for connections and, or, not are keywords ll keywords are lower case Gate declarations (and, or, etc) List outputs first Inputs second g g g // first simple example module smpl (,,,,); input,,; output,; wire and g(,,); not g(,); or g(,,); module 5 6 Modules are circuit components Structural Verilog Module has ports xternal connections,,,, in example Port types input output inout (tristate) Use assign statements for oolean expressions and & or not ~ g g g // previous example as a // oolean expression module smpl (,,,,); input,,; output,; assign = (&) ~; assign = ~; module 7 module xor_gate (out,a,b); input a,b; output out; wire abar, bbar, t, t; not inva (abar,a); not invb (bbar,b); and and (t,abar,b); and and (t,bbar,a); or or (out,t,t); module abar a 4 inva b bbar b 5 invb a 6 7 8 basic gates (keywords): and, or, nand, nor buf, not, xor, xnor and and t t 8 or out 8

ehavioral Verilog ehavioral 4-bit adder Describe circuit behavior Not implementation in module full_addr (Sum,out,,,in); input,, in; output Sum, out; assign {out, Sum} = + + in; module dder Sum out module add4 (SUM, OVR,, ); input [:0] ; input [:0] ; output [:0] SUM; output OVR; assign {OVR, SUM[:0]} = [:0] + [:0]; module [:0] is a 4-wire bus labeled it is the MS it 0 is the LS {out, Sum} is a concatenation an also write [0:] it 0 is the MS it is the LS uses are implicitly connected If you write US[:], US[:0] They become part of US[:0] 9 0 ontinuous assignment xample: comparator ssignment is continuously evaluated orresponds to a logic gate ssignments execute in parallel oolean operators (~ for bit-wise negation) assign = ( & ~Z); assign [:0] = 4'b0; assign [5:0] = 6'h00ff; assign # {out, Sum[:0]} = [:0] + [:0] + in; Gate delay (used by simulator) bits can assume four values (0,,, Z) variables can be n-bits wide (MS:LS) arithmetic operator multiple assignment (concatenation) module ompare (qual, larger, larger,, ); input, ; output qual, larger, larger; assign qual = ( & ) (~ & ~); assign larger = ( & ~); assign larger = (~ & ); module Top-down design and bottom-up design are both okay Module ordering doesn t matter because modules execute in parallel omparator example (con t) Sequential assigns don t make any sense // Make a 4-bit comparator from 4 -bit comparators module ompare4(qual, larger, larger, 4, 4); input [:0] 4, 4; output qual, larger, larger; wire e0, e, e, e, l0, l, l, l, 0, l, l, l; ompare cp0(e0, l0, l0, 4[0], 4[0]); ompare cp(e, l, l, 4[], 4[]); ompare cp(e, l, l, 4[], 4[]); ompare cp(e, l, l, 4[], 4[]); assign qual = (e0 & e & e & e); assign larger = (l (l & e) (l & e & e) (l0 & e & e & e)); assign larger = (~larger & ~qual); module assign = ( & ~Z); assign = W ; assign = & Z; assign = ( & ~Z); assign = W ; assign = & Z; Reusing a variable on the left side of several assign statements is not allowed yclic depencies also are bad deps on which deps on which deps on 4

Functions lways locks Don t forget variables in this list!! always @ * can be used to represent every value change Use functions for complex combinational logic module and_gate (out, in, in); input in, in; output out; assign out = myfunction(in, in); function myfunction; input in, in; myfunction = in & in; function module enefit: Functions force a result ompiler will fail if function does not generate a result 5 reg,, ; always @ (W or or or Z) = ( & ~Z); = W ; = & Z; if ( & ) = Z; = W ; Variables that appear on the left hand side in an always block must be declared as reg s Sensitivity list: block is executed each time one of them changes value Statements in an always block are executed in sequence ll variables must be assigned on every control path!!! (otherwise you get the dreaded inferred latch ) 6 Sequential Verilog-- locking and non-blocking assignments Sequential Verilog-- ssignments- watch out! locking assignments (Q = ) Variable is assigned immediately New value is used by subsequent statements Non-blocking assignments (Q <= ) Variable is assigned after all scheduled statements are executed Value to be assigned is computed but saved for later parallel assignment Usual use: Register assignment Registers simultaneously take new values after the clock edge xample: Swap locking versus Non-blocking reg,, D; always @(posedge clk) = ; = ; D = ; reg,, D; always @(posedge clk) <= ; <= ; D <= ; always @(posedge LK) temp = ; = ; = temp; always @(posedge LK) <= ; <= ; 7 8 Verilog tips Do not write -code Think hardware, not algorithms Verilog is inherently parallel ompilers don t map algorithms to circuits well Do describe hardware circuits First draw a dataflow diagram Then start coding References Tutorial and reference manual are found in ctivehdl help http://www.cs.washington.edu/education/courses/cse70/09wi/tutorials/tutorial_.htm Starter s Guide to Verilog 00 by Michael iletti copies for borrowing in hardware lab 9