SlideShare uma empresa Scribd logo
1 de 31
What is HDL?
hardware    description       language describes the
 hardware of digital systems in textual form.
One can design any hardware at any level
Simulation of designs before fabrication
With the advent of VLSI, it is not possible to verify a
 complex design with millions of gates on a
 breadboard, HDLs came into existence to verify the
 functionality of these circuits.
Most Commonly used HDLs
Verilog
  Verilog HDL is commonly used in the US industry.
   Major digital design companies in Pakistan use
   Verilog HDL as their primary choice.
  most commonly used in the design, verification, and
   implementation of digital logic chips
VHDL (VHSIC (Very High Speed Integrated Circuits) hardware
 description language)
  VHDL is more popular in Europe.
  commonly used as a design-entry language for field-
    programmable gate arrays. Field-Programmable Gate
    Array is a type of logic chip that can be programmed.
Verilog Simulator
There are many logic simulators used for Verilog
HDL. Most common are:
Xilinx
Veriwell
Model Sim


For Beginners Veriwell is good choice and is very user
friendly.
Xilinx and ModelSim are widely used.
Levels of Abstraction
There are four different levels of abstraction in verilog:

Behavioral /Algorithmic
Data flow
Gate level
Switch level.

We will cover Gate level, Data flow and Behavioral
Level modeling
Getting started…
A verilog program for a particular application consists
of two blocks

Design Block (Module)
Testing Block (Stimulus)
Design Block
Design Methodologies:
Two types of design methodologies
 Top Down Design
 Bottom Up Design




        inputs          Design      outputs
                        Block
In Top Down design methodology, we define the top level
block and identify the sub-blocks necessary to build the top
level block. We further divide the sub-block until we come
to the leaf cells, which are the cells which cannot be
divided.
In a Bottom Up design methodology, we first identify the
building blocks , we build bigger blocks using these building
blocks. These cells are then used for high level block until
we build the top level block in the design
EXAMPLE
FOUR BIT ADDER (Ripple carry adder)
Module Representation
Verilog provides the concept of module
A module is a
 Basic Building block in Verilog
 Basic Building block in Verilog
 It can be a single element or collection of lower design blocks

A verilog code starts with module
Syntax:
module <module-name>(inputs, outputs);
//Define inputs and outputs Every verilog program starts with the
       …………                 keyword module and ends with the keyword
         …………               endmodule
         …………
 endmodule
Input Output Definition
Once the module is defined at the start the inputs and
 outputs are to be defined explicitly. e.g.
input a , b           //means there are 2 inputs of one bit
 each
If input or output is more than 1 bit i.e. two or more bits,
 then the definition will be:
 input [3:0] A, B;       //4 bit inputs A3-A0 and B3-B0
 output [3:0] C;
Levels of Abstraction
Gate Level Modeling
In gate level modeling a circuit can be defined by use of
logic gates.
These gates predefined in verilog library.
The basic gates and their syntax is as follows:
               and gate_name(output, inputs);
                or gate_name(output, inputs);
              not gate_name (output, inputs);
               xor gate_name(output, inputs);
               nor gate_name(output, inputs);
              nand gate_name(output, inputs);
              xnor gate_name(output, inputs);
Data Flow Modeling
Continuous assignment statement is used.
Keyword assign is used followed by =
Most common operator types are
        Operator Types Operator Symbol   Operation          Number of
                                         performed          Operands
     Arithmetic        *                 Multiply           Two
                       /                 Divide             Two
                       +                 Add                Two
                       -                 Subract            two

     Bitwise Logical   ~                 Bitwise negation   One
                       &                 Bitwise and        Two
                       |                 Bitwise or         Two
                       ^                 Bitwise xor        Two
                       ^~ or ~^          Bitwise xnor       two
     Shift             >>                Shift right        Two
                       <<                Shift left         Two

     Concatenation     {}                Concatenation      Any number


     Conditional       ?:                Conditional        three
Examples
1. assign x = a + b;
2. assign y = ~ x ;                // y=x’
3. assign y = a & b;               // y= ab
4. assign w = a ^ b;               //y= a     b
5. assign y = x >> 1;              //shift right x by 1
6. assign y = {b, c};              //concatenate b with c
   e.g. b = 3’b101, c =3’b 111
        y = 101111
assign {cout , sum} = a + b + cin; //concatenate sum and cout
7. assign y = s ? b : a                 // 2×1 multiplexer
   when s = 1 , y = b          when s = 0 , y = a
  assign y = s1 ? ( s0 ? d : c ) : ( s0 ? b : a );    // 4×1 MUX
Module Instantiation
Module instantiation is a process of connecting one
 module to another.

For example in a test bench or stimulus the top level
 design has to be instantiated
Testing Block (Stimulus)
In order to test your circuit a test bench code is
 to be written which is commonly called Stimulus.
The design block has to be instantiated/called
It displays the output of the design based on the
 inputs.
Example

          2- Input AND Gate




The Design and Stimulus blocks will be as
follows:
Design Block

   1)Gate Level Modeling

   module practice (y, a, b); //module definition
   input a, b;                 // inputs(by default it takes 1
   bit input
   output y;                  // one bit output
   and gate_1(y, a, b) ;
   endmodule
2) Data Flow Modeling

 module practice (y, a, b);     //module definition
 input a, b;                   // by default it takes 1 bit input
 output y;                    // one bit output
 assign y = a & b;
 endmodule
Stimulus Block
module stimulus;                    #5 $stop;      // stop the simulation
reg a, b;                           #5 $finish;    // terminate the simulation
wire y;                             end
//Instantiate the practice module   initial
practice p0(y, a, b);               begin
initial                             $display("|%b| and |%b| = ", a, b);
begin                               $monitor ($time, "|%b |" , y);
  a=0; b=0;                         end
#5 a=1; b=1;                        //initial
 #5 a=0; b=1;                       //$vw_dumpvars; // display the
                                      simulation in the form of timing diagram
#5 a=1; b=0;
                                    endmodule
#5 a=1; b=1;
Example #2:
4 bit ripple carry adder
Full Adder
Bottom Level module
//Define a full adder                 //full adder logic configuration

module fulladder (sum, c_out, a, b,   xor ( s1,a,b);
 c_in);
                                      and (c1,a,b);

//I/O Port declaration
                                      xor (sum,s1,c_in);
                                      and (c2,s1,c_in);
output sum, c_out;
input a, b, c_in;
                                      or (c_out,c2,c1);

//Internal nets
                                      endmodule

wire s1, c1, c2;
TOP LEVEL MODULE
        //Define a 4 bit 4 adder
module toplevel_fa(sum,c_out,a,b,c_in);
        //I/O port declaration
output [3:0] sum;
output c_out;
input [3:0] a, b;
input c_in;
        //internal nets
wire c1,c2,c3;
  //Instantiate four 1-bit full adder
fulladder fa0(sum[0],c1,a[0],b[0],c_in);
fulladder fa1(sum[1],c2,a[1],b[1],c1);
fulladder fa2(sum[2],c3,a[2],b[2],c2);
fulladder fa3(sum[3],c_out,a[3],b[3],c3);
endmodule
Test Bench (stimulus)
   //define stimulus toplevel module
module stimulus;

reg [3:0]a,b;   //set up variables
reg c_in;
wire [3:0] sum;
wire c_out;

//Instantiate the toplevelmodule(ripple carry adder) call it tl

toplevel_fa tl(sum,c_out,a,b,c_in);
//stimulate inputs
initial
begin
 a = 4'b0000; b = 4'b0010; c_in = 1'b0;
 #1 $display (“ a = %b, b = %b, c_in = %b, sum = %b", a, b, c_in, sum);

  a = 4'd1; b = 4'd2; c_in = 1'b1;
  #2$display (“ a = %b, b = %b, c_in = %b, sum = %b", a, b, c_in, sum);

   a = 4'hf; b = 4'ha; c_in = 1'b0;
   #2$display (“ a = %b, b = %b, c_in = %b, sum = %b", a, b, c_in,
sum);
end
endmodule
Verilog Keywords
Verilog uses about 100 predefined keywords. All the
  keywords are represented in colored font (either green,
  blue or red). if it is not shown in a colored font it means
  there must be some typing error.

All the verilog statements are terminated with a
  semicolon(;) except for the statements (keywords) like
  initial, begin, always, if, for, while etc…

Verilog is case sensitive i.e. the keywords are written in
  lower case.
Continued……
 Most common keywords are
        module, endmodule
        input, output
        wire, reg
        $display, $print, $monitor
        always, for, while, if
        initial, begin
        and, or, not, xor, xnor, nard, nor
        posedge , negedge, clock, reset, case
        $vw_dumpvars, $stop, $finish
 Single line comment is given by // ( two consecutive slash)
     and multi-line comment is given by /*……… */
   for e.g        // This is the first session of verilog
                 /* this is the first
                  session of verilog*/

Mais conteúdo relacionado

Mais procurados

Verilog operators.pptx
Verilog  operators.pptxVerilog  operators.pptx
Verilog operators.pptxVandanaPagar1
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL BasicRon Liu
 
Delays in verilog
Delays in verilogDelays in verilog
Delays in verilogJITU MISTRY
 
Overview of digital design with Verilog HDL
Overview of digital design with Verilog HDLOverview of digital design with Verilog HDL
Overview of digital design with Verilog HDLanand hd
 
Verilog full adder in dataflow & gate level modelling style.
Verilog full adder in dataflow  & gate level modelling style.Verilog full adder in dataflow  & gate level modelling style.
Verilog full adder in dataflow & gate level modelling style.Omkar Rane
 
Combinational Circuits & Sequential Circuits
Combinational Circuits & Sequential CircuitsCombinational Circuits & Sequential Circuits
Combinational Circuits & Sequential Circuitsgourav kottawar
 
Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDLanand hd
 
Verilog data types -For beginners
Verilog data types -For beginnersVerilog data types -For beginners
Verilog data types -For beginnersDr.YNM
 
Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Bharti Airtel Ltd.
 

Mais procurados (20)

Verilog operators.pptx
Verilog  operators.pptxVerilog  operators.pptx
Verilog operators.pptx
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
 
Switch level modeling
Switch level modelingSwitch level modeling
Switch level modeling
 
Data types in verilog
Data types in verilogData types in verilog
Data types in verilog
 
Delays in verilog
Delays in verilogDelays in verilog
Delays in verilog
 
Overview of digital design with Verilog HDL
Overview of digital design with Verilog HDLOverview of digital design with Verilog HDL
Overview of digital design with Verilog HDL
 
Verilog
VerilogVerilog
Verilog
 
Data Flow Modeling
Data Flow ModelingData Flow Modeling
Data Flow Modeling
 
Verilog full adder in dataflow & gate level modelling style.
Verilog full adder in dataflow  & gate level modelling style.Verilog full adder in dataflow  & gate level modelling style.
Verilog full adder in dataflow & gate level modelling style.
 
Verilog Tasks and functions
Verilog Tasks and functionsVerilog Tasks and functions
Verilog Tasks and functions
 
Vlsi design flow
Vlsi design flowVlsi design flow
Vlsi design flow
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
 
Combinational Circuits & Sequential Circuits
Combinational Circuits & Sequential CircuitsCombinational Circuits & Sequential Circuits
Combinational Circuits & Sequential Circuits
 
Logic families
Logic familiesLogic families
Logic families
 
Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDL
 
Verilog data types -For beginners
Verilog data types -For beginnersVerilog data types -For beginners
Verilog data types -For beginners
 
verilog
verilogverilog
verilog
 
Vhdl programming
Vhdl programmingVhdl programming
Vhdl programming
 
Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer
 
Design for Testability
Design for Testability Design for Testability
Design for Testability
 

Semelhante a Verilog hdl

vlsi design using verilog presentaion 1
vlsi design using verilog   presentaion 1vlsi design using verilog   presentaion 1
vlsi design using verilog presentaion 1MANDHASAIGOUD1
 
gate level modeling
gate level modelinggate level modeling
gate level modelingVandanaBR2
 
Verilog_Overview.pdf
Verilog_Overview.pdfVerilog_Overview.pdf
Verilog_Overview.pdfQuangHuyDo3
 
CombVerilog.pdf
CombVerilog.pdfCombVerilog.pdf
CombVerilog.pdfashwkr07
 
SKEL 4273 CAD with HDL Topic 2
SKEL 4273 CAD with HDL Topic 2SKEL 4273 CAD with HDL Topic 2
SKEL 4273 CAD with HDL Topic 2alhadi81
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhtsBéo Tú
 
Gate level design -For beginners
Gate level design -For beginnersGate level design -For beginners
Gate level design -For beginnersDr.YNM
 
0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1manhduc1811
 
Verilog 語法教學
Verilog 語法教學 Verilog 語法教學
Verilog 語法教學 艾鍗科技
 
Verilog Final Probe'22.pptx
Verilog Final Probe'22.pptxVerilog Final Probe'22.pptx
Verilog Final Probe'22.pptxSyedAzim6
 
Hardware Description Language
Hardware Description Language Hardware Description Language
Hardware Description Language Prachi Pandey
 
Advanced Digital Design With The Verilog HDL
Advanced Digital Design With The Verilog HDLAdvanced Digital Design With The Verilog HDL
Advanced Digital Design With The Verilog HDLTony Lisko
 
VIT_Workshop.ppt
VIT_Workshop.pptVIT_Workshop.ppt
VIT_Workshop.pptVINOTHRAJR1
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modellingVandanaPagar1
 

Semelhante a Verilog hdl (20)

vlsi design using verilog presentaion 1
vlsi design using verilog   presentaion 1vlsi design using verilog   presentaion 1
vlsi design using verilog presentaion 1
 
gate level modeling
gate level modelinggate level modeling
gate level modeling
 
Verilog_Overview.pdf
Verilog_Overview.pdfVerilog_Overview.pdf
Verilog_Overview.pdf
 
CombVerilog.pdf
CombVerilog.pdfCombVerilog.pdf
CombVerilog.pdf
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
SKEL 4273 CAD with HDL Topic 2
SKEL 4273 CAD with HDL Topic 2SKEL 4273 CAD with HDL Topic 2
SKEL 4273 CAD with HDL Topic 2
 
Verilogforlab
VerilogforlabVerilogforlab
Verilogforlab
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhts
 
Gate level design -For beginners
Gate level design -For beginnersGate level design -For beginners
Gate level design -For beginners
 
0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1
 
Verilog 語法教學
Verilog 語法教學 Verilog 語法教學
Verilog 語法教學
 
Verilog Final Probe'22.pptx
Verilog Final Probe'22.pptxVerilog Final Probe'22.pptx
Verilog Final Probe'22.pptx
 
Fpga 04-verilog-programming
Fpga 04-verilog-programmingFpga 04-verilog-programming
Fpga 04-verilog-programming
 
Hardware Description Language
Hardware Description Language Hardware Description Language
Hardware Description Language
 
Advanced Digital Design With The Verilog HDL
Advanced Digital Design With The Verilog HDLAdvanced Digital Design With The Verilog HDL
Advanced Digital Design With The Verilog HDL
 
verilog_tutorial1.pptx
verilog_tutorial1.pptxverilog_tutorial1.pptx
verilog_tutorial1.pptx
 
mod-4.pptx
mod-4.pptxmod-4.pptx
mod-4.pptx
 
1.ppt
1.ppt1.ppt
1.ppt
 
VIT_Workshop.ppt
VIT_Workshop.pptVIT_Workshop.ppt
VIT_Workshop.ppt
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modelling
 

Mais de Muhammad Uzair Rasheed (20)

Pak Energy conservation
Pak Energy conservation Pak Energy conservation
Pak Energy conservation
 
Pakistan Energy Conservation
Pakistan Energy ConservationPakistan Energy Conservation
Pakistan Energy Conservation
 
Molten Salt Reactor
Molten Salt ReactorMolten Salt Reactor
Molten Salt Reactor
 
Sampling
SamplingSampling
Sampling
 
Zindagi gulzar-hai
Zindagi gulzar-haiZindagi gulzar-hai
Zindagi gulzar-hai
 
C++loop statements
C++loop statementsC++loop statements
C++loop statements
 
Algorithms 1
Algorithms 1Algorithms 1
Algorithms 1
 
Presentation on 2 nd generation telecommunication system
Presentation on 2 nd generation telecommunication systemPresentation on 2 nd generation telecommunication system
Presentation on 2 nd generation telecommunication system
 
Tdm & fdm
Tdm & fdmTdm & fdm
Tdm & fdm
 
Wavelength division multiplexing
Wavelength division multiplexingWavelength division multiplexing
Wavelength division multiplexing
 
Transmission media
Transmission mediaTransmission media
Transmission media
 
Guided media
Guided mediaGuided media
Guided media
 
Phase shift
Phase shiftPhase shift
Phase shift
 
Gsm – global system for mobile communication
Gsm – global system for mobile communicationGsm – global system for mobile communication
Gsm – global system for mobile communication
 
First generation network
First generation networkFirst generation network
First generation network
 
First and second generation communication
First and second generation communicationFirst and second generation communication
First and second generation communication
 
Fdm
FdmFdm
Fdm
 
Channel impairments
Channel impairmentsChannel impairments
Channel impairments
 
Angle modulation
Angle modulationAngle modulation
Angle modulation
 
Analog to-digital conversion
Analog to-digital conversionAnalog to-digital conversion
Analog to-digital conversion
 

Último

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 

Último (20)

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

Verilog hdl

  • 1.
  • 2.
  • 3. What is HDL? hardware description language describes the hardware of digital systems in textual form. One can design any hardware at any level Simulation of designs before fabrication With the advent of VLSI, it is not possible to verify a complex design with millions of gates on a breadboard, HDLs came into existence to verify the functionality of these circuits.
  • 4. Most Commonly used HDLs Verilog Verilog HDL is commonly used in the US industry. Major digital design companies in Pakistan use Verilog HDL as their primary choice. most commonly used in the design, verification, and implementation of digital logic chips VHDL (VHSIC (Very High Speed Integrated Circuits) hardware description language) VHDL is more popular in Europe. commonly used as a design-entry language for field- programmable gate arrays. Field-Programmable Gate Array is a type of logic chip that can be programmed.
  • 5. Verilog Simulator There are many logic simulators used for Verilog HDL. Most common are: Xilinx Veriwell Model Sim For Beginners Veriwell is good choice and is very user friendly. Xilinx and ModelSim are widely used.
  • 6. Levels of Abstraction There are four different levels of abstraction in verilog: Behavioral /Algorithmic Data flow Gate level Switch level. We will cover Gate level, Data flow and Behavioral Level modeling
  • 7. Getting started… A verilog program for a particular application consists of two blocks Design Block (Module) Testing Block (Stimulus)
  • 8. Design Block Design Methodologies: Two types of design methodologies  Top Down Design  Bottom Up Design inputs Design outputs Block
  • 9. In Top Down design methodology, we define the top level block and identify the sub-blocks necessary to build the top level block. We further divide the sub-block until we come to the leaf cells, which are the cells which cannot be divided.
  • 10. In a Bottom Up design methodology, we first identify the building blocks , we build bigger blocks using these building blocks. These cells are then used for high level block until we build the top level block in the design
  • 11. EXAMPLE FOUR BIT ADDER (Ripple carry adder)
  • 12. Module Representation Verilog provides the concept of module A module is a  Basic Building block in Verilog  Basic Building block in Verilog  It can be a single element or collection of lower design blocks A verilog code starts with module Syntax: module <module-name>(inputs, outputs); //Define inputs and outputs Every verilog program starts with the ………… keyword module and ends with the keyword ………… endmodule ………… endmodule
  • 13. Input Output Definition Once the module is defined at the start the inputs and outputs are to be defined explicitly. e.g. input a , b //means there are 2 inputs of one bit each If input or output is more than 1 bit i.e. two or more bits, then the definition will be: input [3:0] A, B; //4 bit inputs A3-A0 and B3-B0 output [3:0] C;
  • 15. Gate Level Modeling In gate level modeling a circuit can be defined by use of logic gates. These gates predefined in verilog library. The basic gates and their syntax is as follows: and gate_name(output, inputs); or gate_name(output, inputs); not gate_name (output, inputs); xor gate_name(output, inputs); nor gate_name(output, inputs); nand gate_name(output, inputs); xnor gate_name(output, inputs);
  • 16. Data Flow Modeling Continuous assignment statement is used. Keyword assign is used followed by = Most common operator types are Operator Types Operator Symbol Operation Number of performed Operands Arithmetic * Multiply Two / Divide Two + Add Two - Subract two Bitwise Logical ~ Bitwise negation One & Bitwise and Two | Bitwise or Two ^ Bitwise xor Two ^~ or ~^ Bitwise xnor two Shift >> Shift right Two << Shift left Two Concatenation {} Concatenation Any number Conditional ?: Conditional three
  • 17. Examples 1. assign x = a + b; 2. assign y = ~ x ; // y=x’ 3. assign y = a & b; // y= ab 4. assign w = a ^ b; //y= a b 5. assign y = x >> 1; //shift right x by 1 6. assign y = {b, c}; //concatenate b with c e.g. b = 3’b101, c =3’b 111 y = 101111 assign {cout , sum} = a + b + cin; //concatenate sum and cout 7. assign y = s ? b : a // 2×1 multiplexer when s = 1 , y = b when s = 0 , y = a assign y = s1 ? ( s0 ? d : c ) : ( s0 ? b : a ); // 4×1 MUX
  • 18. Module Instantiation Module instantiation is a process of connecting one module to another. For example in a test bench or stimulus the top level design has to be instantiated
  • 19. Testing Block (Stimulus) In order to test your circuit a test bench code is to be written which is commonly called Stimulus. The design block has to be instantiated/called It displays the output of the design based on the inputs.
  • 20. Example 2- Input AND Gate The Design and Stimulus blocks will be as follows:
  • 21. Design Block 1)Gate Level Modeling module practice (y, a, b); //module definition input a, b; // inputs(by default it takes 1 bit input output y; // one bit output and gate_1(y, a, b) ; endmodule
  • 22. 2) Data Flow Modeling module practice (y, a, b); //module definition input a, b; // by default it takes 1 bit input output y; // one bit output assign y = a & b; endmodule
  • 23. Stimulus Block module stimulus; #5 $stop; // stop the simulation reg a, b; #5 $finish; // terminate the simulation wire y; end //Instantiate the practice module initial practice p0(y, a, b); begin initial $display("|%b| and |%b| = ", a, b); begin $monitor ($time, "|%b |" , y); a=0; b=0; end #5 a=1; b=1; //initial #5 a=0; b=1; //$vw_dumpvars; // display the simulation in the form of timing diagram #5 a=1; b=0; endmodule #5 a=1; b=1;
  • 24. Example #2: 4 bit ripple carry adder
  • 26. Bottom Level module //Define a full adder //full adder logic configuration module fulladder (sum, c_out, a, b, xor ( s1,a,b); c_in); and (c1,a,b); //I/O Port declaration xor (sum,s1,c_in); and (c2,s1,c_in); output sum, c_out; input a, b, c_in; or (c_out,c2,c1); //Internal nets endmodule wire s1, c1, c2;
  • 27. TOP LEVEL MODULE //Define a 4 bit 4 adder module toplevel_fa(sum,c_out,a,b,c_in); //I/O port declaration output [3:0] sum; output c_out; input [3:0] a, b; input c_in; //internal nets wire c1,c2,c3; //Instantiate four 1-bit full adder fulladder fa0(sum[0],c1,a[0],b[0],c_in); fulladder fa1(sum[1],c2,a[1],b[1],c1); fulladder fa2(sum[2],c3,a[2],b[2],c2); fulladder fa3(sum[3],c_out,a[3],b[3],c3); endmodule
  • 28. Test Bench (stimulus) //define stimulus toplevel module module stimulus; reg [3:0]a,b; //set up variables reg c_in; wire [3:0] sum; wire c_out; //Instantiate the toplevelmodule(ripple carry adder) call it tl toplevel_fa tl(sum,c_out,a,b,c_in);
  • 29. //stimulate inputs initial begin a = 4'b0000; b = 4'b0010; c_in = 1'b0; #1 $display (“ a = %b, b = %b, c_in = %b, sum = %b", a, b, c_in, sum); a = 4'd1; b = 4'd2; c_in = 1'b1; #2$display (“ a = %b, b = %b, c_in = %b, sum = %b", a, b, c_in, sum); a = 4'hf; b = 4'ha; c_in = 1'b0; #2$display (“ a = %b, b = %b, c_in = %b, sum = %b", a, b, c_in, sum); end endmodule
  • 30. Verilog Keywords Verilog uses about 100 predefined keywords. All the keywords are represented in colored font (either green, blue or red). if it is not shown in a colored font it means there must be some typing error. All the verilog statements are terminated with a semicolon(;) except for the statements (keywords) like initial, begin, always, if, for, while etc… Verilog is case sensitive i.e. the keywords are written in lower case.
  • 31. Continued…… Most common keywords are module, endmodule input, output wire, reg $display, $print, $monitor always, for, while, if initial, begin and, or, not, xor, xnor, nard, nor posedge , negedge, clock, reset, case $vw_dumpvars, $stop, $finish Single line comment is given by // ( two consecutive slash) and multi-line comment is given by /*……… */ for e.g // This is the first session of verilog /* this is the first session of verilog*/