EECS150 - Digital Design Lecture 8 - Hardware Description Languages

Similar documents
EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline

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

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

EECS150 - Digital Design Lecture 6 - Logic Simulation

CS61C: Verilog Tutorial

EECS150 - Digital Design Lecture 7 - Computer Aided Design (CAD) - Part II (Logic Simulation) Finite State Machine Review

Introduction To HDL. Verilog HDL. Debdeep Mukhopadhyay Dept of CSE, IIT Madras 1

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

CS250 VLSI Systems Design Lecture 3: Hardware Design Languages. Fall Krste Asanovic, John Wawrzynek with John Lazzaro and Brian Zimmer (TA)

Hardware Description Languages (HDLs) Verilog

EECS150 - Digital Design Lecture 6 - Logic Simulation. Encoder Example

EECS150 - Digital Design Lecture 10 Logic Synthesis

EECS150 - Digital Design Lecture 10 Logic Synthesis

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

Introduction To HDL. Verilog HDL. Debdeep Mukhopadhyay How it started!

Digital Design with FPGAs. By Neeraj Kulkarni

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

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

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

Hardware description languages

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

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

EECS150 - Digital Design Lecture 6 - Field Programmable Gate Arrays (FPGAs)

Outline. EECS150 - Digital Design Lecture 6 - Field Programmable Gate Arrays (FPGAs) FPGA Overview. Why FPGAs?

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

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

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Hardware Description Languages: Verilog

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

CSE140L: Components and Design Techniques for Digital Systems Lab

Synthesis of Combinational and Sequential Circuits with Verilog

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

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

CSE140L: Components and Design

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

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

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

Chap 6 Introduction to HDL (d)

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

VHDL VS VERILOG.

Online Verilog Resources

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

Lecture #2: Verilog HDL

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

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

Introduction to Verilog HDL

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

Tutorial on VHDL and Verilog Applications

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

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

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

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

Lab 3 Verilog Simulation Mapping

Nikhil Gupta. FPGA Challenge Takneek 2012

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

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

Lecture 15: System Modeling and Verilog

Advanced Digital Design Using FPGA. Dr. Shahrokh Abadi

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

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

Design Using Verilog

RTL Coding General Concepts

Introduction to Verilog HDL. Verilog 1

Programming with HDLs

EN2911X: Reconfigurable Computing Lecture 05: Verilog (2)

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

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

Introduction to Verilog. Mitch Trope EECS 240 Spring 2004

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

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

Verilog Module 1 Introduction and Combinational Logic

Review. EECS Components and Design Techniques for Digital Systems. Lec 05 Boolean Logic 9/4-04. Seq. Circuit Behavior. Outline.

EEL 4783: HDL in Digital System Design

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

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

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

HDLs and SystemVerilog. Digital Computer Design

Introduction. Why Use HDL? Simulation output. Explanation

ENGR 3410: MP #1 MIPS 32-bit Register File

Synthesizable Verilog

Verilog Design Entry, Synthesis, and Behavioral Simulation

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

EECS150 Lab Lecture 0

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

Review from last time. CS152 Computer Architecture and Engineering Lecture 6. Verilog (finish) Multiply, Divide, Shift

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

Verilog Design Principles

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

Introduction to Verilog

101-1 Under-Graduate Project Digital IC Design Flow

Course Topics - Outline

Verilog Overview. Verilog Overview. Simple Example. Simple Example. Simple Example. Simple Example

Chapter 2 Using Hardware Description Language Verilog. Overview

VLSI Design 13. Introduction to Verilog

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

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

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

Transcription:

EECS150 - Digital Design Lecture 8 - Hardware Description Languages September 19, 2002 John Wawrzynek Fall 2002 EECS150 - Lec08-HDL Page 1 Netlists Design flow What is a HDL? Verilog history examples Outline Fall 2002 EECS150 - Lec08-HDL Page 2

A key data structure (or representation) in the design process is the netlist : Network List A netlist lists components and connects them with nodes: ex: n1 n2 n3 n4 n5 n6 g1 "and" n1 n2 n5 g2 "and" n3 n4 n6 g3 "or" n5 n6 n7 n7 Netlist Alternative format: n1 g1.in1 n2 g1.in2 n3 g2.in1 n4 g2.in2 n5 g1.out g3.in1 n6 g2.out g3.in2 n7 g3.out g1 "and" g2 "and" g3 "or" Netlist is what is needed for simulation and implementation. Could be at the transistor level, gate level,... Could be hierarchical or flat. How do we generate a netlist? Fall 2002 EECS150 - Lec08-HDL Page 3 Design Entry Design Flow High-level Technology Mapping Low-level Fall 2002 EECS150 - Lec08-HDL Page 4

Design Flow Design Entry High-level Technology Mapping Low-level Circuit is described and represented: Graphically (Schematics) Textually (HDL) Result of circuit specification (and compilation) is a netlist of: generic primitives - logic gates, flip-flops, or technology specific primitives - LUTs/CLBs, transistors, discrete gates, or higher level library elements - adders, ALUs, register files, decoders, etc. Fall 2002 EECS150 - Lec08-HDL Page 5 Design Flow Design Entry High-level Technology Mapping Low-level High-level is used to verify: correct function rough: timing power cost Common tools used are: simulator - check functional correctness, and static timing analyzer estimates circuit delays based on timing model and delay parameters for library elements (or primitives). Fall 2002 EECS150 - Lec08-HDL Page 6

Design Flow Design Entry High-level Technology Mapping Low-level Technology Mapping: Converts netlist to implementation technology dependent details Expands library elements, performs: partitioning, placement, routing Low-level Simulation and Static Tools perform low-level checks with: accurate timing models, wire delay For FPGAs this step could also use the actual device. Fall 2002 EECS150 - Lec08-HDL Page 7 Design Flow Design Entry High-level Technology Mapping Netlist: used between and internally for all steps. Low-level Fall 2002 EECS150 - Lec08-HDL Page 8

Design Entry Schematic entry/editing used to be the standard method in industry Used in EECS150 until last semester Schematics are intuitive. They match our use of gate-level or block diagrams. Somewhat physical. They imply a physical implementation. Require a special tool (editor). Unless hierarchy is carefully designed, schematics can be confusing and difficult to follow. Hardware Description Languages are the new standard except for PC boards Fall 2002 EECS150 - Lec08-HDL Page 9 HDLs Basic Idea: Language constructs describe circuit structure Structural descriptions similar to hierarchical netlist. Behavioral descriptions use higherlevel constructs (similar to conventional programming). Originally designed to help in abstraction and simulation. Now logic synthesis tools exist to automatically convert from behavioral descriptions to gate netlist. Greatly improves designer productivity. However, this may lead you to falsely believe that hardware design can be reduced to writing programs! Structural example: Decoder(output x0,x1,x2,x3; inputs a,b) { wire abar, bbar; inv(bbar, b); inv(abar, a); nand(x0, abar, bbar); nand(x1, abar, b ); nand(x2, a, bbar); nand(x3, a, b ); } Behavioral example: Decoder(output x0,x1,x2,x3; inputs a,b) { case [a b] 00: [x0 x1 x2 x3] = 0x0; 01: [x0 x1 x2 x3] = 0x2; 10: [x0 x1 x2 x3] = 0x4; 11: [x0 x1 x2 x3] = 0x8; endcase; } Fall 2002 EECS150 - Lec08-HDL Page 10

Verilog A brief history: Originated at Automated Integrated Design Systems (renamed Gateway) in 1985. Acquired by Cadence in 1989. Invented as simulation language. Synthesis was an afterthought. Many of the basic techniques for synthesis were developed at Berkeley in the 80 s and applied commercially in the 90 s. Around the same time as the origin of Verilog, the US Department of Defense developed VHDL. Because it was in the public domain it began to grow in popularity. Afraid of losing market share, Cadence opened Verilog to the public in 1990. An IEEE working group was established in 1993, and ratified IEEE Standard 1394 in 1995. Verilog is the language of choice of Silicon Valley companies, initially because of high-quality tool support and its similarity to C-language syntax. VHDL is still popular within the government, in Europe and Japan, and some Universities. Most major CAD frameworks now support both. Latest HDL: C++ based. OSCI (Open System C Initiative). Fall 2002 EECS150 - Lec08-HDL Page 11 Basic Example: 2-to1 mux //2-input multiplexor in gates module mux2 (in0, in1, select, out); input in0,in1,select; wire s0,w0,w1; not and or (s0, select); (w0, s0, in0), (w1, select, in1); (out, w0, w1); endmodule // mux2 comments module port list declarations wire type primitive gates Fall 2002 EECS150 - Lec08-HDL Page 12

Announcements Fall 2002 EECS150 - Lec08-HDL Page 13 2-to-1 mux behavioral description // Behavioral model of 2-to-1 // multiplexor. behavioral descriptions use the module mux2 (in0,in1,select,out); keyword always followed by input in0,in1,select; procedural assignments Target output of procedural // assignments must of of type reg reg out; Unlike wire types where the always @ (in0 or in1 or select) target output of an assignment if (select) out=in1; may be continuously updated, a reg type retains it value until a else out=in0; new value is assigned (the endmodule // mux2 assigning statement is executed). Fall 2002 EECS150 - Lec08-HDL Page 14

Hierarchy & Bit Vectors //Assuming we have already // defined a 2-input mux (either // structurally or behaviorally, //4-input mux built from 3 2-input muxes module mux4 (in0, in1, in2, in3, select, out); input in0,in1,in2,in3; input [1:0] select; wire w0,w1; instantiation similar to primitives select is 2-bits wide named port assignment mux2 m0 (.select(select[0]),.in0(in0),.in1(in1),.out(w0)), m1 (.select(select[0]),.in0(in2),.in1(in3),.out(w1)), m3 (.select(select[1]),.in0(w0),.in1(w1),.out(out)); endmodule // mux4 Fall 2002 EECS150 - Lec08-HDL Page 15 //Does not assume that we have // defined a 2-input mux. Behavioral 4-to1 mux //4-input mux behavioral description module mux4 (in0, in1, in2, in3, select, out); input in0,in1,in2,in3; Definition: A structural input [1:0] select; description is one where the reg out; function of the module is defined by the instantiation and always @ (in0 in1 in2 in3 select) interconnection of sub-modules. case (select) 2 b00: out=in0; 2 b01: out=in1; 2 b10: out=in2; 2 b11: out=in3; endcase endmodule // mux4 No instantiation Case construct equivalent to nested if constructs. A behavioral description uses higher level language constructs and operators. Verilog allows modules to mix both behavioral constructs and sub-module instantiation. Fall 2002 EECS150 - Lec08-HDL Page 16

Behavioral with Bit Vectors //Behavioral model of 32-bit // wide 2-to-1 multiplexor. module mux32 (in0,in1,select,out); inputs, outputs 32-bits wide input [31:0] in0,in1; input select; output [31:0] out; // reg [31:0] out; always @ (in0 or in1 or select) if (select) out=in1; else out=in0; endmodule // Mux //Behavioral model of 32-bit adder. module add32 (S,A,B); input [31:0] A,B; output [31:0] S; reg [31:0] S; // always @ (A or B) S = A + B; endmodule // Add Fall 2002 EECS150 - Lec08-HDL Page 17 Dataflow Descriptions of Logic //Dataflow description of mux module mux2 in0, in1, select, out); dataflow modeling provides a way input in0,in1,select; to describe combinational logic by its function rather than gate structure. assign out = (~select & in0) The assign keyword is used to (select & in1); indicate a continuous assignment. endmodule // mux2 Whenever anything on the RHS changes the LHS is updated. Alternative: assign out = select? in1 : in0; Fall 2002 EECS150 - Lec08-HDL Page 18

Sequential Logic //Parallel to Serial converter module ParToSer(LD, X, out, CLK); input [3:0] X; input LD, CLK; reg out; reg [3:0] Q; assign out = Q[0]; always @ (posedge CLK) if (LD) Q=X; else Q = Q>>1; endmodule // mux2 module FF (CLK,Q,D); input D, CLK; output Q; reg Q; always @ (posedge CLK) Q=D; always @ (posedge CLK) forces Q register to be rewritten every simulation cycle. >> operator does right shift (shifts in a zero on the left). Shifts on non-reg variables can be done with concatenation: wire [3:0] A, B; assign B = {1 b0, A[3:1]} endmodule // FF Fall 2002 EECS150 - Lec08-HDL Page 19 module testmux; reg a, b, s; wire f; reg expected; end initial $monitor( Testbench #10 s=1; a=0; b=1; expected=1; Top-level modules written specifically to test sub-modules. Generally no ports. mux2 mymux (.select(s),.in0(a),.in1(b),.out(f)); initial begin initial block similar to always s=0; a=0; b=1; expected=0; except only executes once (at #10 a=1; b=0; expected=1; beginning of simulation) #n s needed to advance time $monitor - prints output "select=%b in0=%b in1=%b out=%b, expected out=%b time=%d", s, a, b, f, expected, $time); endmodule // testmux A variety of other system functions, similar to monitor exist for displaying output and controlling the simulation. Fall 2002 EECS150 - Lec08-HDL Page 20

Verilog does not turn hardware design into writing programs! The fact that Verilog looks similar to programming languages fools some people into thinking that they can design hardware by writing programs. Not so. Verilog is a hardware description language. The best way to use it is to first figure out the circuit you want, then figure out how to express it in Verilog. The behavioral constructs hide a lot of the circuit details but you as the designer must still manage the structure, data-communication, parallelism, and timing of your design. Not doing so leads to very inefficient designs. Fall 2002 EECS150 - Lec08-HDL Page 21 More Verilog Help The lecture notes only cover the very basics of Verilog and mostly just the conceptual issues. The Mano textbook covers Verilog with many examples. The Bhasker book is a good tutorial. On reserve in the Engineering library (starting Friday). The complete language specification from the IEEE is available on the class website under Refs/Links Fall 2002 EECS150 - Lec08-HDL Page 22