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

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

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

Hardware description languages

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

Hardware Description Languages: Verilog

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

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

EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline

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

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

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

Introduction to Verilog. Mitch Trope EECS 240 Spring 2004

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

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

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

101-1 Under-Graduate Project Digital IC Design Flow

Verilog Design Principles

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

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

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

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

Advanced Digital Design Using FPGA. Dr. Shahrokh Abadi

Verilog Module 1 Introduction and Combinational Logic

Introduction to Verilog

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

Introduction to VHDL. Module #5 Digilent Inc. Course

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

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

Synthesizable Verilog

ECE 353 Lab 3 (Verilog Design Approach)

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

Physics 364, Fall 2012, reading due your answers to before the end of Wednesday s lab.

Verilog. Verilog for Synthesis

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

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

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

Hardware Description Language VHDL (1) Introduction

Physics 364, Fall 2014, reading due your answers to by 11pm on Sunday

Verilog Design Principles

ENGIN 241 Digital Systems with Lab

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

CENG 241 Digital Design 1

Introduction to Verilog HDL. Verilog 1

Chapter 2 Using Hardware Description Language Verilog. Overview

CSE140L: Components and Design Techniques for Digital Systems Lab

C-Based Hardware Design

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

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

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

EECS150 - Digital Design Lecture 10 Logic Synthesis

Introduction to Verilog HDL

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

Online Verilog Resources

CDA 4253 FPGA System Design Introduction to VHDL. Hao Zheng Dept of Comp Sci & Eng USF

Hardware description language (HDL)

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

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

EECS150 - Digital Design Lecture 8 - Hardware Description Languages

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

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

CSE140L: Components and Design

Combinational Logic II

Lecture 15: System Modeling and Verilog

EECS150 - Digital Design Lecture 10 Logic Synthesis

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

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

Digital Design with FPGAs. By Neeraj Kulkarni

תכן חומרה בשפת VERILOG הפקולטה להנדסה

Hardware Description Languages (HDLs) Verilog

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Synthesis of Combinational and Sequential Circuits with Verilog

Advanced Digital Design with the Verilog HDL

VLSI Design 13. Introduction to Verilog

HDLs and SystemVerilog. Digital Computer Design

Chapter 3 working with combinational logic

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Verilog for Combinational Circuits

EEL 4783: Hardware/Software Co-design with FPGAs

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

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

Topics of this Slideset. CS429: Computer Organization and Architecture. Digital Signals. Truth Tables. Logic Design

Week 4 Tutorial: Verilog Primer Part 2. By Steve Engels

Combinational Logic Design with Verilog. ECE 152A Winter 2012

EEL 4783: Hardware/Software Co-design with FPGAs

Modeling Concepts. Introduction

ECEN 468 Advanced Digital System Design

Overview of Verilog Part 1

LAB #3: ADDERS and COMPARATORS using 3 types of Verilog Modeling

EEL 4783: HDL in Digital System Design

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

Design Using Verilog

Register Transfer Level in Verilog: Part I

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

Lecture #2: Verilog HDL

Introduction. Why Use HDL? Simulation output. Explanation

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

CMPT 250: Computer Architecture. Using LogicWorks 5. Tutorial Part 1. Somsubhra Sharangi

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

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

Transcription:

Lecture 8: Combinational Verilog CSE 370, utumn 2007 enjamin Ylvisaker Where We re Last lecture: Minimization with K!maps This lecture: Combinational Verilog Next lecture: ROMs, PLs and PLs, oh my! Homework 3 ongoing Lab 2 done; lab 3 next week University of Washington, Comp. Sci. and Eng. 2 Specifying Circuits Schematics Structural description uild more complex circuits using hierarchy Large circuits are unreadable HDLs "Hardware description languages$ Not conventional programming languages Very restricted parallel languages Synthesize code to produce a circuit Quick History Lesson bel "#1983$ Developed by Data!I/O Targeted to PLDs Verilog "#1985$ Developed by Gateway "now part of Cadence$ Syntax similar to C Moved to public domain in 1990 VHDL "#1987$ DoD sponsored Syntax similar to da University of Washington, Comp. Sci. and Eng. 3 University of Washington, Comp. Sci. and Eng. 4

Verilog and VHDL Dominant oth &IEEE standard' languages Most tools support both Verilog is &simpler' Less, more concise syntax VHDL is more structured and Synthesis &Execute' a design with some test data Synthesis Generate a physical implementation HDL Description Synthesis Gate or Transistor Description More sophisticated type system Physical Implementation etter modularity features University of Washington, Comp. Sci. and Eng. 5 University of Washington, Comp. Sci. and Eng. 6 Functional Validation Functional/ Timing Validation Real Chip! and Synthesis "cont%d$ Model circuit behavior Can include timing estimates llows for easier design exploration Synthesis Converts HDL code to &netlists' Can still simulate the generated netlists and synthesis in the CSE curriculum 370: Learn simulation 467: Learn something about synthesis You provide an environment Use non!circuit constructs "ctive!hdl waveforms, random number generators, etc$ Can write arbitrary Verilog code Test Fixture (Specification) Circuit Description (Synthesizeable) University of Washington, Comp. Sci. and Eng. 7 University of Washington, Comp. Sci. and Eng. 8

Specifying Circuits in Verilog Data Types There are three major styles Instances (n wires Continuous assignments &always' blocks &Structural' wire E; and g1(e,,); not g2(y,c); or g3(x,e,y); wire E; assign E = & ; assign Y = ~ C; assign X = E Y; University of Washington, Comp. Sci. and Eng. 9 C 1 2 g1 g2 &ehavioral' E 3 g3 reg E, X, Y; always @ ( or or C) begin E = & ; Y = ~C; X = E Y; X Y Values on a wire 0, 1, x "unknown or con)ict$, z "unconnected$ Vectors *3:0+ vector of 4 bits: *3+, *2+, *1+, *0+ Interpreted as an unsigned binary number Indices must be constants Concatenation =,*3+, *3+, *3+, *3+, *3:0+-; =,4,*3+-, *3:0+; Style: good to use unnecessary size specs sometimes a*7:0+ = b*7:0+ + c*7:0+; uilt!in reductions: C = &*5:7+; University of Washington, Comp. Sci. and Eng. 10 Data Types That Do Not Exist structures "records$ Pointers Objects Recursive types "Remember, Verilog is not C or Java or Lisp or...$ Numbers Format: <sign><size><base format><number> 14 Decimal!4%b11 4!bit 2%s complement of 0011 12%b000_0100_0110 12 bit binary number "_%s ignored$ 12%h4b 12 bit hexadecimal number University of Washington, Comp. Sci. and Eng. 11 University of Washington, Comp. Sci. and Eng. 12

Operators Two bstraction Mechanisms Modules More structural Heavily used in 370 and &real' Verilog code Functions More behavioral Similar to C operators Used to some extent in &real' Verilog, but not much in 370 University of Washington, Comp. Sci. and Eng. 13 University of Washington, Comp. Sci. and Eng. 14 asic uilding locks: Modules Module Ports Instantiated, not called Illegal to nest module defs Instances &execute' in parallel Wires are used for connections C 1 2 g1 g2 E 3 g3 X Y Modules interact with the rest of a design through ports input output C 1 2 g1 g2 E 3 g3 X Y and, or, not built!in primitive modules List output.rst rbitrary number of inputs next Names are case sensitive Cannot begin with number // for comments // first simple example module smpl(x,y,,,c); input,,c; output X,Y; wire E; and g1(e,,); not g2(y,c); or g3(x,e,y); inout Same example with continuous assignments: // first simple example module smpl(x,y,,,c); input,,c; output X,Y; assign X = (&) ~C; assign Y = ~C; University of Washington, Comp. Sci. and Eng. 15 University of Washington, Comp. Sci. and Eng. 16

igger Structural Example module xor_gate (out,a,b); input a,b; output out; wire abar, bbar, t1, t2; not inva (abar,a); not invb (bbar,b); and and1 (t1,abar,b); and and2 (t2,bbar,a); or or1 (out,t1,t2); a b 4 5 inva invb University of Washington, Comp. Sci. and Eng. 17 abar b bbar a 6 7 8 built!in gates: and, or, nand, nor, buf, not, xor, xnor and1 and2 t1 t2 8 or1 out ehavioral Full dder Cin dder module full_addr (Sum,Cout,,,Cin); input,, Cin; output Sum, Cout; assign {Cout, Sum} = + + Cin;,Cout, Sum- is a concatenation Sum Cout University of Washington, Comp. Sci. and Eng. 18 ehavioral 4!bit dder Continuous ssignment Continuously evaluated module add4 (SUM, OVER,, ); input [3:0] ; input [3:0] ; output [3:0] SUM; output OVER; assign {OVER, SUM[3:0]} = [3:0] + [3:0]; Think of them as collections of logic gates Evaluated in parallel assign = X (Y & ~Z); assign [3:0] = 4'b01XX; assign C[15:0] = 4'h00ff; assign #3 {Cout, Sum[3:0]} = [3:0] + [3:0] + Cin; University of Washington, Comp. Sci. and Eng. 19 University of Washington, Comp. Sci. and Eng. 20

Hierarchy Example: Comparator 4!bit Comparator // Make a 4-bit comparator from 4 1-bit comparators module Compare1 (Equal, larger, larger,, ); input, ; output Equal, larger, larger; assign Equal = ( & ) (~ & ~); assign larger = ( & ~); assign larger = (~ & ); module Compare4(Equal, larger, larger, 4, 4); input [3:0] 4, 4; output Equal, larger, larger; wire e0, e1, e2, e3, l0, l1, l2, l3, 10, l1, l2, l3; Compare1 cp0(e0, l0, l0, 4[0], 4[0]); Compare1 cp1(e1, l1, l1, 4[1], 4[1]); Compare1 cp2(e2, l2, l2, 4[2], 4[2]); Compare1 cp3(e3, l3, l3, 4[3], 4[3]); assign Equal = (e0 & e1 & e2 & e3); assign larger = (l3 (l2 & e3) (l1 & e3 & e2) (l0 & e3 & e2 & e1)); assign larger = (~larger & ~Equal); University of Washington, Comp. Sci. and Eng. 21 University of Washington, Comp. Sci. and Eng. 22 Sequential assigns don%t make any sense assign = X (Y & ~Z); assign = W ; assign = Y & Z; You can%t reassign a variable with continuous assignments reg,, C; lways locks always @ (W or X or Y or Z) begin = X (Y & ~Z); = W ; = Y & Z; if ( & ) begin = Z; C = W Y; Variables that appear on the left hand side in an always block must be declared as reg s Sensitivity list 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 ) University of Washington, Comp. Sci. and Eng. 23 University of Washington, Comp. Sci. and Eng. 24

Functions Functions can be used for combinational logic that you want to reuse module and_gate (out, in1, in2); input in1, in2; output out; assign out = myfunction(in1, in2); function myfunction; input in1, in2; begin myfunction = in1 & in2; function Verilog Tips Do not write C!code Think hardware, not algorithms Verilog is inherently parallel Compilers don%t map algorithms to circuits well Do describe hardware circuits First draw a data)ow diagram Then start coding References Tutorial and reference manual are found in ctivehdl help nd in today%s reading assignment &Starter%s Guide to Verilog 2001' by Michael Ciletti copies for borrowing in hardware lab University of Washington, Comp. Sci. and Eng. 25 University of Washington, Comp. Sci. and Eng. 26 Thank You for Your ttention Thank You for Your ttention Read lab 2 Continue homework 2 Continue reading the book University of Washington, Comp. Sci. and Eng. 27 University of Washington, Comp. Sci. and Eng. 28