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

Similar documents
Digital Design with FPGAs. By Neeraj Kulkarni

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Nikhil Gupta. FPGA Challenge Takneek 2012

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

Chap 6 Introduction to HDL (d)

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

Synthesizable Verilog

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

Hardware Description Language VHDL (1) Introduction

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

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

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

ECE 353 Lab 3 (Verilog Design Approach)

Hardware Description Languages (HDLs) Verilog

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

Introduction to Verilog/System Verilog

Synthesis of Combinational and Sequential Circuits with Verilog

VHDL VS VERILOG.

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

Digital Integrated Circuits

Register Transfer Level in Verilog: Part I

DIGITAL SYSTEM DESIGN

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

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

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

Verilog Hardware Description Language ROOM: B405

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

ELCT 501: Digital System Design

CS429: Computer Organization and Architecture

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

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

ENEE245 Digital Circuits and Systems Lab Manual

ACS College of Engineering. Department of Biomedical Engineering. Logic Design Lab pre lab questions ( ) Cycle-1

Writing Circuit Descriptions 8

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

Design Using Verilog

FPGA Design Challenge Techkriti Digital Logic Design using Verilog Part 2 By Neeraj Kulkarni

EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline

CSE140L: Components and Design Techniques for Digital Systems Lab

Digital Design with SystemVerilog

Verilog 1 - Fundamentals

Lecture 15: System Modeling and Verilog

HDLs and SystemVerilog. Digital Computer Design

CSE140L: Components and Design

ENEE245 Digital Circuits and Systems Lab Manual

Online Verilog Resources

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

Lecture 32: SystemVerilog

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Introduction to Verilog HDL. Verilog 1

Lecture 12 VHDL Synthesis

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

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

Code No: R Set No. 1

Introduction to Verilog HDL

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

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis

Verilog 1 - Fundamentals

Verilog introduction. Embedded and Ambient Systems Lab

EEL 4783: HDL in Digital System Design

Verilog Tutorial (Structure, Test)

Register Transfer Level


EECS150 - Digital Design Lecture 10 Logic Synthesis

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

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

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

Code No: R Set No. 1

Verilog for High Performance

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

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

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

Digital Design (VIMIAA01) Introduction to the Verilog HDL

C-Based Hardware Design

Contents. Appendix D Verilog Summary Page 1 of 16

Verilog for Synthesis Ing. Pullini Antonio

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

Lab 3: Standard Combinational Components

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

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

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

DIGITAL SYSTEM DESIGN

Department of Computer Science & Engineering. Lab Manual DIGITAL LAB. Class: 2nd yr, 3rd sem SYLLABUS

Combinational Logic II

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

EECS150 - Digital Design Lecture 10 Logic Synthesis

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

VERILOG. Deepjyoti Borah, Diwahar Jawahar

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

Finite-State Machine (FSM) Design

Topics. Midterm Finish Chapter 7

Injntu.com Injntu.com Injntu.com R16

Chapter 2 Using Hardware Description Language Verilog. Overview

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

Verilog Design Principles

Introduction to Verilog

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

Introduction. Why Use HDL? Simulation output. Explanation

Transcription:

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

Digital Design : Bottom Up Approach Basic Block - Gates

Digital Design : Bottom Up Approach Gates -> Flip Flops

Digital Design : Bottom Up Approach Flip Flops-> Counter

Digital Design : Bottom Up Approach Finally a processor can be designed from basic building blocks

HDLs : Motivation How do we design the circuit? Do we draw it on pen and paper? Became tedious when the number of gates increased exponentially! Hardware Descriptive languages (HDLs) comes to the rescue. We describe the digital circuits in terms of its structure and functionality.

Verilog Verilog is A Hardware Descriptive Language used to describe a circuit. Syntax is similar to C, but is not a programming language Synthesized ( analogous to compiled in C ) to give the circuit logic diagram VHDL is another HDL commonly used

Synthesis of Verilog

FPGA Field Programmable Gate Array A fully configurable IC FPGAs contain programmable logic components called logic blocks. Hierarchy of reconfigurable interconnects that allow the blocks to be wired together. FPGA can be made to work as a XOR gate, a Counter or even bigger- an entire Processor!

FPGA : Logic Blocks

Programming FPGA Configured using a Hardware Descriptive Language Can be configured in any way by the user

Coding in Verilog Consists of various building blocks called Modules Communication between a module and its environment is achieved by using Ports Ports are of three types: input, output, inout

Module A Black Box in Verilog with inputs, outputs and internal logic working. So, a module can be used to implement a counter. A module is defined as module <specific type>(<port list>);

4029 Counter One Input port for CLK Four binary output ports At every rising edge of clock, increment output by 1

Declaring Module Way 1: module 4029(clk, a, b, c, d, reset, enable); //Assuming two more input pins, reset and //enable with their corresponding functioning Way 2: module 4029(clk, out, reset, enable); What is the difference in the two?

Declaring Ports Way 1: input clk; input reset; input enable; output a,b,c,d; Way 2: input clk; input reset; input enable; output [3:0] out;

Types of Ports We need drivers for this module in order to interact with other modules Driver is a way of defining something which can drive a load Two types of drivers: Can store a value (for example, flip-flop) Cannot store a value, but connects two points (for example, a wire) In Verilog, a driver which can store a value is called reg and the one which cannot is called wire

Drivers for 4029 modules Ports defined as wires? clk reset enable We do not need to stores the values of these ports in our logical block. Ports defined as reg? a,b,c,d out We need to store them so that we could modify their values when required.

Defining drivers for 4029 Way 1: wire clk; wire reset; wire enable; reg a,b.c,d; Way 2: wire clk; wire reset; wire enable; reg [3:0] out;

Complete definition of module module 4029( clk, out, reset, enable); input wire clk; input wire reset; input wire enable; output reg [3:0] out; endmodule

Wire Vs Reg reg can store a value, wire simply connects Most of the times, inputs are wire and outputs are reg Output of flip flop wire or reg? Output of XOR gate wire or reg? Output of multiplexer wire or reg?

What now? We have seen how to define the outer structure of the modules we will use. Time to define the internal structure and functioning?

Operational and Conditional Statements All the arithmetic as well as logical operators in Verilog are similar to C, except ++ and - which are not available in Verilog. Conditional statements are also similar to C with following modifications: { is replaced by begin. } is replaced by end.

Combinatorial Circuits Combinational circuits are acyclic interconnections of gates. And, Or, Not, Xor, Nand, Nor Multiplexers, Decoders, Encoders. Adders, Multipliers. OUTPUT DEPENDS ON THE PRESENT INPUT ONLY. How are these gates, muxs etc. abstracted in Verilog? Gates, Add, Multiply : by simple operators like in C Multiplexers : by control statements like if-else, case, etc. Gate level implementation of above high level operators done by Verilog synthesizer.

Control Statements if-else, case : Exactly like C. Hardware view: implemented using multiplexers for loops, repeat: for-loops are synthesizable only if length of iteration is determined at compile time & finite. repeat -similar to for loop. Hardware view: All loops are unrolled during synthesis.

Control Statement Syntax

Assign statements Continuous assignment statement. Used for modeling only combinational logic. module BusInverter( input wire A, output wire B ); assign B = ~A; endmodule Basically B is shorted to ~A. RHS should have variable of wire type.

Example-1 bit Full Adder module full_adder( input wire a, input wire b, input wire cin, output wire sum, output wire carry ); assign sum = a & ~b & ~cin ~a & b & ~cin ~a & ~b & cin a & b & cin; assign carry = a & b a & cin b & cin; module full_adder( input wire a, input wire b, input wire cin, output wire sum, output wire carry ); assign { carry, sum } = a+b+cin; endmodule endmodule Gate Level Description Behavioral Description

Sequential Circuits Circuits containing state elements are called sequential circuits OUTPUT DEPENDS ON THE PRESENT INPUT AS WELL AS ON ITS PRESENT STATE. The simplest synchronous state element: Edge triggered D Flip Flop How do you implement such an element in Verilog?

always @ block It is an abstraction provided in Verilog to mainly implement sequential circuits. Also used for combinational circuits. always @(#sensitivity list#) begin. //No assign statements inside always@ end Execution of always block depends on the sensitivity list.

Sensitivity List Run continuously. (mostly used in Test Benches) always Run when any variable changes its value. always @(*) //for combinational ckts Run when the variables `a' or `b' change their value. always @(a, b) Run when a positive edge is detected on CLK. always @(posedge CLK) //for sequential ckt

initial block An initial block is executed only once when simulation starts This is useful in writing test benches If we have multiple initial blocks, then all of them are executed at the beginning of simulation

Counter Example module Counter( input wire CLK, output reg [3:0] OUT ); initial OUT <= 0; always @(posedge CLK) OUT <= OUT + 1; endmodule

Blocking and Non-blocking statement Non-blocking assignments happen in parallel. always @ ( #sensitivity list # ) begin B <= A ; C <= B ; // (A,B) = (1,2) -> (B,C) = (1,2) end Blocking assignments happen sequentially. always @ ( #sensitivity list # ) begin B=A; C = B ; // (A,B) = (1,2) -> (B,C) = (1,1) end

Points to note Use always@(*) block with blocking assignments for combinational circuits. Use always@(posedge clk) block with nonblocking assignments for sequential combinational circuits. Do not mix blocking and non-blocking statements.

Complete 4029 module module 4029( clk, out, reset, enable); input wire clk; input wire reset; input wire enable; output reg [3:0] out; always @(posedge clk) begin if (reset == 0 && enable == 0) begin out <= out +1; end end // continued to next page

Complete 4029 module always @(reset or enable) begin if (reset == 1 b1) begin out <= 0; end end endmodule

Extras : bit literals If no size given, number is assumed to be 32 bits. If <size> is smaller than value MSB of value truncated If <size> is greater than value MSB of value filled with zeros e.g. - hexadecimal: 4 hb If no base given, number assumed to be decimal. e.g. - 11

For Tommorrow Modular Circuits Test Benches Demonstration Problem Statement Discussion