Verilog Fundamentals Shubham Singh Junior Undergrad. Electrical Engineering.

Slides:



Advertisements
Similar presentations
VERILOG: Synthesis - Combinational Logic Combination logic function can be expressed as: logic_output(t) = f(logic_inputs(t)) Rules Avoid technology dependent.
Advertisements

ENEL111 Digital Electronics
Simulation executable (simv)
The Verilog Hardware Description Language
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Synchronous Sequential Logic
Combinational Logic.
Register Transfer Level
Table 7.1 Verilog Operators.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
16/04/20151 Hardware Descriptive Languages these notes are taken from Mano’s book It can represent: Truth Table Boolean Expression Diagrams of gates and.
Anurag Dwivedi.  Verilog- Hardware Description Language  Modules  Combinational circuits  assign statement  Control statements  Sequential circuits.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
Give qualifications of instructors: DAP
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
EELE 367 – Logic Design Module 2 – Modern Digital Design Flow Agenda 1.History of Digital Design Approach 2.HDLs 3.Design Abstraction 4.Modern Design Steps.
Verilog - 1 Writing Hardware Programs in Abstract Verilog  Abstract Verilog is a language with special semantics  Allows fine-grained parallelism to.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
ECE 353 Computer Systems Lab I Verilog Hardware Description Language.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
Lecture 7 Verilog Additional references Structural constructs
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
1 VERILOG Fundamentals Workshop סמסטר א ' תשע " ה מרצה : משה דורון הפקולטה להנדסה Workshop Objectives: Gain basic understanding of the essential concepts.
Introduction to FPGA AVI SINGH. Prerequisites Digital Circuit Design - Logic Gates, FlipFlops, Counters, Mux-Demux Familiarity with a procedural programming.
ECE 2372 Modern Digital System Design
Synthesis Presented by: Ms. Sangeeta L. Mahaddalkar ME(Microelectronics) Sem II Subject: Subject:ASIC Design and FPGA.
System Arch 2008 (Fire Tom Wada) /10/9 Field Programmable Gate Array.
Introduction Verilog is a HARDWARE DESCRIPTION LANGUAGE (HDL) A hardware description language is a language or means used to describe or model a digital.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
Digital System 數位系統 Verilog HDL Ping-Liang Lai (賴秉樑)  
ECE/CS 352 Digital System Fundamentals© 2001 C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Spring 2001 Chapters 3 and 4: Verilog – Part 2 Charles R.
Module 1.2 Introduction to Verilog
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Slide 1 2. Verilog Elements. Slide 2 Why (V)HDL? (VHDL, Verilog etc.), Karen Parnell, Nick Mehta, “Programmable Logic Design Quick Start Handbook”, Xilinx.
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
February 6, 2009http://csg.csail.mit.edu/6.375/L02-1 Verilog 1 - Fundamentals Complex Digital Systems Arvind February 6, 2009 FA module adder( input.
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
Verilog 1 - Fundamentals Complex Digital Systems Krste Asanovic February 9, 2007 FA module adder( input [3:0] A, B, output cout, output [3:0] S );
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
Introduction to FPGAs Getting Started with Xilinx.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Introduction to Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals.
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
Adapted from Krste Asanovic
Reg and Wire:.
Discussion 2: More to discuss
Verilog Introduction Fall
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Introduction to Verilog
SYNTHESIS OF SEQUENTIAL LOGIC
Levels in computer design
VHDL Introduction.
The Verilog Hardware Description Language
The Verilog Hardware Description Language
Introduction to Digital IC Design
Presentation transcript:

Verilog Fundamentals Shubham Singh Junior Undergrad. Electrical Engineering

VERILOG FUNDAMENTALS  HDLs HISTORY  HOW FPGA & VERILOG ARE RELATED  CODING IN VERILOG

HDLs HISTORY HDL – HARDWARE DESCRIPTION LANGUAGE

EARLIER DESIGNERS USED BREADBOARDS FOR DESIGNING PRINTED CIRCUIT BOARD SOLDERLESS BREADBOARD

HDLs ENABLED LOGIC LEVEL SIMULATION AND TESTING MANUAL SIMULATE GATE LEVEL DESCRIPTION

THEN DESIGNERS BEGAN TO USE HDLs FOR HIGHER LEVEL DESIGN MANUAL SIMUALTE SIMULATE BEHAVIOURAL ALGORITHM REGISTER TRANSFER LEVEL GATE LEVEL

HDLs LED TO TOOLS FOR AUTOMATIC TRANSLATION AUTOPLACE & ROUTE GATE LEVEL REGISTER TRANSFER LEVEL LOGIC SYNTHESIS MANUAL BEHAVIOURAL ALGORITHM SIMULATE

THE CURRENT SITUATION C,C++ BEHAVIOURAL VERILOG MATLAB STRUCTURAL VERILOG GATE LEVEL COMPILERS ARE NOT AVAILABLE TO CONVERT BEHAVIOURAL LEVEL TO REGISTER TRANSFER LEVEL LOGIC SYNTHESIS

MUX 4 : GATE LEVEL DESIGNING modulemux4(input a,b,c,d, input[1:0] sel, output out); wire[1:0] sel_b; not not0( sel_b[0], sel[0] ); not not1( sel_b[1], sel[1] ); wire n0, n1, n2, n3; and and0( n0, c, sel[1] ); and and1( n1, a, sel_b[1] ); and and2( n2, d, sel[1] ); and and3( n3, b, sel_b[1] ); wirex0, x1; nor nor0( x0, n0, n1 ); nor nor1( x1, n2, n3 ); wirey0, y1; or or0( y0, x0, sel[0] ); or or1( y1, x1, sel_b[0] ); nand nand0( out, y0, y1 ); endmodule

MUX 4 : REGISTER TRANSFER LEVEL Module mux4( input a, b, c, d input[1:0] sel, Output out ); wire out, t0, t1; assign out = ( sel == 0 ) ? a : ( sel == 1 ) ? b : ( sel == 2 ) ? c : ( sel == 3 ) ? d : 1’bx; endmodule

VERILOG & FPGAs

VERILOG  Verilog is a HARDWARE DESCRIPTION LANGUAGE.  HDLs are used to describe a digital system  Not a programming language despite the syntax being similar to C  Synthesized (analogous to compiled for C) to give the circuit logic diagram

FPGAs  Field Programmable Gate Array  A Fully configurable IC  FPGAs contain programmable logic components called logic blocks.  Contain hierarchy of reconfigurable interconnects that allow the blocks to be wired together.  Logic Blocks can be configured to any complex circuit.  FPGA can be made to work as a Xor gate, a Counter or even bigger- an entire Processor!

An FPGA

Logic Blocks

HOW TO PROGRAM FPGAs  Configured using a Hardware Description Language  Can be configured by any way by the user  Basic Idea : BEHAVIOURAL DESCRIPTION OF REQUIRED CIRCUIT A COMPLETE CIRCUIT DIAGRAM VERILOG SYNTHESISER

Synthesis of VERILOG :

CODING IN VERILOG BREAKING CIRCUITS INTO VARIOUS BUILDING BLOCKS CALLED “MODULE” DEFINING MODULE CONNECTING VARIOUS MODULES

CODING IN VERILOG  Communication between a module and its environment is achieved by using Ports  Ports are of three types: input, output, inout

AN EXAMPLE : 4029 COUNTER Name: 4029 Input Ports: One Output Ports: Four Size Driver type Internal Logic: At every rising edge of the clock, increment the output by one

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 ( );

DEFINING 4029 MODULE  Way 1: module 4029(clk,out,reset,enable);  Way 2: module 4029(clk, a, b, c, d, reset, enable);  Input and Output Ports in each of the above?  EVERY PORT MUST HAVE A DIRECTION AND BITWIDTH  Every module ends with the statement endmodule

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;

DRIVERS IN VERILOG  We need drivers for this module in order to interact with the ports and describe its logical working.  Two types of drivers: Can store a value (for example, flip-flop) : REG Cannot store a value, but connects two points (for example, a wire) : WIRE

DRIVERS IN 4029  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;

Defining Internal Logic

OPERATORS AND CONDITIONAL OPERATORS  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.

COMBINATIONAL CIRCUITS  Combinational circuits are acyclic interconnections of gates. And, Or, Not, Xor, Nand, Nor …… Multiplexers, Decoders, Encoders ….  OUTPUT IS A FUNCTION OF 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.

SEQUENTIAL CIRCUITS  Circuits containing state elements are called sequential circuits  OUTPUT DEPENDS ON THE PRESENT INPUT AS WELL AS ON ITS PRESENT STATE.  How do you implement such an element in Verilog?

always block  Syntax begin //Code end  Blocks starting with keyword always run simultaneously. symbol is used to specify the condition which should be satisfied for the execution of this block.

Usage of always block  always The code in this block will keep on executing.  The code in this block will be executed every time the value of a changes.  clk) This block is executed at every positive edge of clk.

BLOCK  It is an abstraction provided in Verilog to mainly implement sequential circuits.  Also used for combinational circuits.

BLOCKING AND NON-BLOCKING ASSIGNMENTS  Non-blocking assignments happen in parallel. ( #sensitivity list # ) begin B <= A ; C (B,C) = (1,2) end  Blocking assignments happen sequentially. ( #sensitivity list # ) begin B = A ; C = B ;(A,B) = (1,2) -> (B,C) = (1,1) end

POINTS TO NOTE  Use block with blocking assignments for combinational circuits  Use posedge CLK) block with non- blocking assignments for sequential circuits.  Do not mix blocking and non-blocking assignments.

A COMPLETE 4029 MODULE module 4029 ( input wire clk, input wire reset, input wire enable, output [3:0] reg out); //You can declare direction as well as data type //in the module definition.

clk) begin if (reset == 0 && enable == 0) begin out <= out +1; end

or enable) begin if (reset == 1’b1) begin out <= 0; end endmodule

AN EXAMPLE

ANOTHER EXAMPLE

WRONG SOLUTION

ANOTHER WAY : MULTIPLE always BLOCK

WRONG SOLUTION

Connecting Various Modules

 Various modules are interconnected to make a larger circuit (or module).  Each sub-module has a separate Verilog file.  A sub-module may have another sub- module in its circuit.  One needs to indicate the top level module before synthesis.

EXAMPLE  module 4029(input wire clk, output [3:0]reg out);  module 7447(input [3:0] reg in, output [6:0] reg bcd);  module TOP(input wire clk, output [6:0] reg bcd);

INSTANTIATION  USED TO INTERCONNECT VARIOUS MODULES  In the above example, we need to instantiate the two sub-modules in the top level module  THIS IS DONE AS FOLLOWS: wire [3:0] c; 4029 counter (.clk(clk),.out(c) ); 7447 decoder (.in(c),.bcd(bcd));

Problem Statement  Level 1 : Theoretical Questions on basic syntax of Verilog  Level 2 : Design a digital system using Verilog. (weightage will be given to how much modular your circuit is )