EN2911X: Reconfigurable Computing Lecture 05: Verilog (2)

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

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

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

EN164: Design of Computing Systems Lecture 07: Lab Foundations / Verilog 3

ENGN1640: Design of Computing Systems Topic 02: Lab Foundations

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

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

EN2911X: Reconfigurable Computing Lecture 06: Verilog (3)

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

Register Transfer Level in Verilog: Part I

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

Verilog Behavioral Modeling

ECE 4514 Digital Design II. Spring Lecture 7: Dataflow Modeling

ECEN 468 Advanced Logic Design

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

ECEN 468 Advanced Logic Design

Course Topics - Outline

Contents. Appendix D Verilog Summary Page 1 of 16

Introduction to Verilog/System Verilog

Lecture #2: Verilog HDL

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

Chapter 3: Dataflow Modeling

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

Digital Design with FPGAs. By Neeraj Kulkarni

Lab 3: Standard Combinational Components

Verilog Design Principles

Verilog Module 1 Introduction and Combinational Logic

Introduction to Digital VLSI Design מבוא לתכנון VLSI ספרתי

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

EEL 4783: HDL in Digital System Design

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

CSE140L: Components and Design Techniques for Digital Systems Lab

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

Verilog Dataflow Modeling

UNIT V: SPECIFICATION USING VERILOG HDL

Spring 2017 EE 3613: Computer Organization Chapter 5: Processor: Datapath & Control - 2 Verilog Tutorial

Chapter 2 Using Hardware Description Language Verilog. Overview

CSE140L: Components and Design

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

Introduction. Why Use HDL? Simulation output. Explanation

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

Verilog Essentials Simulation & Synthesis

Laboratory Exercise 7

Introduction to Verilog HDL

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

Under-Graduate Project Logic Design with Behavioral Models

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

Verilog for High Performance

Verilog Coding Guideline

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

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

Laboratory Exercise 1

Introduction To Verilog Design. Chun-Hung Chou

Verilog HDL Introduction

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

Register Transfer Level

Announcements. Midterm 2 next Thursday, 6-7:30pm, 277 Cory Review session on Tuesday, 6-7:30pm, 277 Cory Homework 8 due next Tuesday Labs: project

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

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

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

Verilog Design Entry, Synthesis, and Behavioral Simulation

EECS150 - Digital Design Lecture 10 Logic Synthesis

Hardware Description Languages (HDLs) Verilog

DIGITAL SYSTEM DESIGN

ES611 FPGA Based System Design. Behavioral Model

ENEE245 Digital Circuits and Systems Lab Manual

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

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

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

Online Verilog Resources

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

Arithmetic Operators There are two types of operators: binary and unary Binary operators:

CPE 200L LABORATORY 4: INTRODUCTION TO DE2 BOARD UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND:

Chap 6 Introduction to HDL (d)

Digital Design (VIMIAA01) Introduction to the Verilog HDL

Verilog introduction. Embedded and Ambient Systems Lab

Synthesis of Combinational and Sequential Circuits with Verilog

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

Design Using Verilog

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

ENEE245 Digital Circuits and Systems Lab Manual

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

Programmable Logic Devices Verilog VII CMPE 415

MPLEMENTATION. Part 1: Implementation of the TOC on the DE2 Board using Verilog - Performed in Lab #1

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

Verilog for Synthesis Ing. Pullini Antonio

Digital System Design Verilog-Part III. Amir Masoud Gharehbaghi

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

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

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

yamin/

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

University of Hawaii EE 361L. Getting Started with Spartan 3E Digilent Basys2 Board. Lab 4.1

EN2911X: Reconfigurable Computing Lecture 13: Design Flow: Physical Synthesis (5)

Brief Introduction to Verilog HDL (Part 1)

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University

Introduction to Digital Design with Verilog HDL

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

VERILOG 2: LANGUAGE BASICS

Transcription:

EN2911X: Lecture 05: Verilog (2) Prof. Sherief Reda Division of Engineering, Brown University Fall 09 http://scale.engin.brown.edu

Dataflow modeling Module is designed by specifying the data flow, where the designer is aware of how data flows between hardware registers and how the data is processed in the design The continuous assignment is one of the main constructs used in dataflow modeling assign out = i1 & i2; assign addr[15:0] = addr1[15:0] ^ addr2[15:0]; assign {c_out, sum[3:0]}=a[3:0]+b[3:0]+c_in; A continuous assignment is always active and the assignment expression is evaluated as soon as one of the right-hand-side variables change Assign statements describe hardware that operates concurently -> ordering does not matter Left-hand side must be a scalar or vector net. Right-hand side operands can be registers, nets, integers, real,

Operator types in dataflow expressions Operators are similar to C except that there are no ++ or Arithmetic: *, /, +, -, % and ** Logical:!, && and Relational: >, <, >= and <= Equality: ==,!=, === and!== Bitwise: ~, &,, ^ and ^~ Reduction: &, ~&,, ~, ^ and ^~ Shift: <<, >>, >>> and <<< Concatenation: { } Replication: {{}} Conditional:?:

Examples of 2x1 MUX and 4x1 MUX module mux2to1(s, a, b, y); output y; input s, a, b; assign y = (b & s) ( a & ~s); // OR THIS WAY assign y = s? b : a; endmodule module mux4to1(out, i0, i1, i2, i3, s1, s0); output out; input i0, i1, i2, i3; output s1, s0; assign out = (~s1 & ~s0 & i0) (~s1 & s0 & i1) (s1 & ~s0 & i2) (s1 & s0 & i3); // OR THIS WAY assign out = s1? (s0? i3:i2) : (s0? i1:i0); endmodule

Example: 4-bit 2x1 MUX [Example from Thornton & Reese]

Difference between HLL and Verilog assign [Example from Thornton & Reese]

Difference between HLL and Verilog assign can only work with tri-state drivers [Example from Thornton & Reese]

Example of a dataflow 4-bit adder [Example from Thornton & Reese]

Behavioral modeling (combinational) Design is expressed in algorithmic level, which frees designers from thinking in terms of logic gates or data flow. Designing at this model is very similar to programming in C. All algorithmic statements in Verilog can appear only inside two statements: always and initial. Each always and initial statement represents a separate activity flow in Verilog. Remember that activity flows in Verilog run in parallel. You can have multiple initial and always statements but you can t nest them. reg a, b, c; initial a=1 b0; always begin b = a ^ 1 b1; c = a + b; end

initial statements An initial block start at time 0, executes exactly once and then never again. If there are multiple initial blocks, each blocks starts to execute concurrently at time 0 and each blocks finish execution independently of the others. Multiple behavioral statements must be grouped using begin and end. If there is one statement then grouping is not necessary. reg x, y, m; initial m=1 b0; initial begin x=1 b0; y=1 b1; end

always statement The always statement starts at time 0 and executes the statements in the always block continuously in a looping fashion. Powerful constructs like if, if-else, case, and looping are only allowed inside always blocks. always statements can be used to implement both combinational or sequential logic It models a block of activity that is repeated continuously in a digital circuit. Multiple behavioral statements must be grouped using begin and end. multiple always statement can appear in a module

Events-based timing control An event is the change in the value on a register or a net. Events can be utilized to trigger the execution of a statement of a block of statements. The @ symbol is used to specify an event control. For combinational logic, any net that appears on the right side of an = operator in the always block should be included in the event list. [for sequential ignore for now] Statements can be executed on changes in signal value or at a positive (posedge) or negative (negedge) transition of the signal.

always statements Any net that is assigned within an always block must be declared as a reg type; this does not imply that this net is driven by a register or sequential logic. The = operator when used in an always block is called a blocking assignment If there is some logic path through the always block that does not assign a value to the output net The logic synthesized assumed the assignments are evaluated sequentially. This means that the order in which assignments are written in an always blocks affects the logic that is synthesized.

always statements Because of the sequential nature of an always block, the same net can be assigned multiple times in an always block; the last assignment takes precedence. [Example from Thornton & Reese]

Conditional statements Very similar to C Can always appear inside always and initial blocks if(x) begin y= 1 b1; z= 1 b0; end expression if (count < 10) count = count+1; else count = 0; if(alu_control == 0) y = x + z; else if (alu_control == 1) y = x z; else if (alu_control == 2) y = x * z; else y = x; reg [1:0] alu_control;. case (alu_control) 2 d0 : y = x + z; 2 d1 : y = x z; 2 d2 : y = x * z; default: y=x; endcase

Example: Mux4x1 module mux4x1(out, i0, i1, i2, i3, s1, s0); output out; input i0, i1, i2, i3; input s1, s0; reg out; always @(s1 or s0 or i0 or i1 or i2 or i3) begin case({s1, s0}) 2 d0: out = i0; 2 d1: out = i1; 2 d2: out = i2; 2 d3: out = i3; endcase endmodule

DE2 board overview CLOCK_50 HEX0[6:0] HEX7[6:0] LEDG[0] LEDG[8] LEDR[0] LEDR[17] SW[0] SW[17] KEY[0] KEY[3] Import the given pin assignment file to make life easy!

DE2 example module test2(sw, LEDG); input [3:0] SW; output [8:0] LEDG; reg x; always @(SW[0] or SW[1] or SW[2] or SW[3]) begin x = SW[3]; if(sw[0]) x = SW[2]; if(sw[1]) x = 0; end assign LEDG[0] = x; endmodule

Lab 1 Please go through the lab0 tutorial to get familiar with the tool and the synthesis environment Please check the class webpage for helpful resources Deliverables include Working design (.sof file) which will be tested Written documentation includes Verilog source code with comments Report the amount of logic and routing area utilized in the FPGA Snapshot of the final layout of the FPGA as produced by the synthesis tool