SlideShare a Scribd company logo
1 of 13
VHDL:
Functions and Procedures
talarico@gonzaga.edu 1
Subprograms
• FUNCTION
• PROCEDURE
• FUNCTIONs and PROCEDUREs have the same
basic purpose
– store commonly used pieces of code, so they can be
reused and shared
• VHDL allow FUNCTIONs and PROCEDUREs to be
overloaded
pieces of sequential VHDL code
talarico@gonzaga.edu 2
PROCESS and FUNCTION vs. PROCESS
talarico@gonzaga.edu 3
• FUNCTIONs and PROCEDUREs are mainly intended for
LIBRARY allocation
(although it is possible to locate them in the main code)
• PROCESSes are intended for immediate use in the main
code
FUNCTION vs. PROCEDURE
talarico@gonzaga.edu 4
• FUNCTION
– zero or more input parameters and a single return value
– The input parameters can only be constants (default) or
signals (variables are not allowed)
• PROCEDURE
– Any number of IN, OUT, and INOUT parameters which can
be constants, signals, variables
– The default for OUT and INOUT parameters is variable
• A FUNCTION is called as part of an expression, while a
PROCEDURE is a statement on its own
FUNCTION/PROCEDURE location
talarico@gonzaga.edu 5
FUNCTION
talarico@gonzaga.edu 6
FUNCTION: Example
Example of Function body:
The word CONSTANT
can be omitted
do not enter RANGE or
TO/DOWNTO
talarico@gonzaga.edu 7
Examples:
FUNCTION
talarico@gonzaga.edu 8
Function located
in the main
Function located
in a package
PROCEDURE
talarico@gonzaga.edu 9
PROCEDURE: example
Example of PROCEDURE body:
std_logic; SIGNAL b,c: IN std_logic;
std_logic_vector(7 downto 0);
NOT an issue with
PROCEDUREs
talarico@gonzaga.edu 10
STD_LOGIC;
Examples:
PROCEDURE
PROCEDURE located
in the main
talarico@gonzaga.edu 11
talarico@gonzaga.edu 12
STD_LOGIC;
Examples:
PROCEDURE
PROCEDURE located
in a PACKAGE
ASSERT
talarico@gonzaga.edu 13
Example:

More Related Content

Similar to lec16-bari.pptx

Software Development (Mobile Technology)
Software Development (Mobile Technology)Software Development (Mobile Technology)
Software Development (Mobile Technology)Shaun Wilson
 
Scala Bay Meetup - The state of Scala code style and quality
Scala Bay Meetup - The state of Scala code style and qualityScala Bay Meetup - The state of Scala code style and quality
Scala Bay Meetup - The state of Scala code style and qualityJaime Jorge
 
Lecture2 vhdl refresher
Lecture2 vhdl refresherLecture2 vhdl refresher
Lecture2 vhdl refresherNima Shafiee
 
Chapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.pptChapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.pptAmanuelZewdie4
 
Python first day
Python first dayPython first day
Python first dayfarkhand
 
What is in a Lucene index?
What is in a Lucene index?What is in a Lucene index?
What is in a Lucene index?lucenerevolution
 
Programming language paradigms
Programming language paradigmsProgramming language paradigms
Programming language paradigmsAshok Raj
 
Lucene Bootcamp - 2
Lucene Bootcamp - 2Lucene Bootcamp - 2
Lucene Bootcamp - 2GokulD
 
Prilimanary Concepts of VHDL by Dr.R.Prakash Rao
Prilimanary Concepts of VHDL by    Dr.R.Prakash RaoPrilimanary Concepts of VHDL by    Dr.R.Prakash Rao
Prilimanary Concepts of VHDL by Dr.R.Prakash Raorachurivlsi
 
Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Iffat Anjum
 
Reduced instruction set computers
Reduced instruction set computersReduced instruction set computers
Reduced instruction set computersSyed Zaid Irshad
 
General Programming Concept
General Programming ConceptGeneral Programming Concept
General Programming ConceptHaris Bin Zahid
 
Impala Architecture presentation
Impala Architecture presentationImpala Architecture presentation
Impala Architecture presentationhadooparchbook
 

Similar to lec16-bari.pptx (20)

Software Development (Mobile Technology)
Software Development (Mobile Technology)Software Development (Mobile Technology)
Software Development (Mobile Technology)
 
2018 12-kube con-ballerinacon
2018 12-kube con-ballerinacon2018 12-kube con-ballerinacon
2018 12-kube con-ballerinacon
 
Scala Bay Meetup - The state of Scala code style and quality
Scala Bay Meetup - The state of Scala code style and qualityScala Bay Meetup - The state of Scala code style and quality
Scala Bay Meetup - The state of Scala code style and quality
 
Lecture2 vhdl refresher
Lecture2 vhdl refresherLecture2 vhdl refresher
Lecture2 vhdl refresher
 
Chapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.pptChapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.ppt
 
Introduction to multicore .ppt
Introduction to multicore .pptIntroduction to multicore .ppt
Introduction to multicore .ppt
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 
Python first day
Python first dayPython first day
Python first day
 
Python first day
Python first dayPython first day
Python first day
 
What is in a Lucene index?
What is in a Lucene index?What is in a Lucene index?
What is in a Lucene index?
 
Programming language paradigms
Programming language paradigmsProgramming language paradigms
Programming language paradigms
 
Lucene Bootcamp - 2
Lucene Bootcamp - 2Lucene Bootcamp - 2
Lucene Bootcamp - 2
 
13 risc
13 risc13 risc
13 risc
 
Prilimanary Concepts of VHDL by Dr.R.Prakash Rao
Prilimanary Concepts of VHDL by    Dr.R.Prakash RaoPrilimanary Concepts of VHDL by    Dr.R.Prakash Rao
Prilimanary Concepts of VHDL by Dr.R.Prakash Rao
 
Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2
 
Reduced instruction set computers
Reduced instruction set computersReduced instruction set computers
Reduced instruction set computers
 
General Programming Concept
General Programming ConceptGeneral Programming Concept
General Programming Concept
 
Impala Architecture presentation
Impala Architecture presentationImpala Architecture presentation
Impala Architecture presentation
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 

More from jpradha86

MOSFET IV characteristics and its operations
MOSFET IV characteristics and its operationsMOSFET IV characteristics and its operations
MOSFET IV characteristics and its operationsjpradha86
 
VLSI-mosfet-construction engineering ECE
VLSI-mosfet-construction engineering ECEVLSI-mosfet-construction engineering ECE
VLSI-mosfet-construction engineering ECEjpradha86
 
Vlsibasic.ppt fundamental for engineering
Vlsibasic.ppt fundamental for engineeringVlsibasic.ppt fundamental for engineering
Vlsibasic.ppt fundamental for engineeringjpradha86
 
MATH 5.6.20 (1).ppt
MATH 5.6.20 (1).pptMATH 5.6.20 (1).ppt
MATH 5.6.20 (1).pptjpradha86
 
the-vhsic-.pptx
the-vhsic-.pptxthe-vhsic-.pptx
the-vhsic-.pptxjpradha86
 
lecture_1_introduction__review_of_classical_control.pptx
lecture_1_introduction__review_of_classical_control.pptxlecture_1_introduction__review_of_classical_control.pptx
lecture_1_introduction__review_of_classical_control.pptxjpradha86
 
EE392n_Lecture3apps.ppt
EE392n_Lecture3apps.pptEE392n_Lecture3apps.ppt
EE392n_Lecture3apps.pptjpradha86
 
SS7G1 - Africa Geography.ppt
SS7G1 - Africa Geography.pptSS7G1 - Africa Geography.ppt
SS7G1 - Africa Geography.pptjpradha86
 
CS4700-LS_v6.pptx
CS4700-LS_v6.pptxCS4700-LS_v6.pptx
CS4700-LS_v6.pptxjpradha86
 
BeyondClassicalSearch.ppt
BeyondClassicalSearch.pptBeyondClassicalSearch.ppt
BeyondClassicalSearch.pptjpradha86
 
Ethnic and Religious Groups Student.pptx
Ethnic and Religious Groups Student.pptxEthnic and Religious Groups Student.pptx
Ethnic and Religious Groups Student.pptxjpradha86
 
chapter2.pptx
chapter2.pptxchapter2.pptx
chapter2.pptxjpradha86
 

More from jpradha86 (14)

MOSFET IV characteristics and its operations
MOSFET IV characteristics and its operationsMOSFET IV characteristics and its operations
MOSFET IV characteristics and its operations
 
VLSI-mosfet-construction engineering ECE
VLSI-mosfet-construction engineering ECEVLSI-mosfet-construction engineering ECE
VLSI-mosfet-construction engineering ECE
 
Vlsibasic.ppt fundamental for engineering
Vlsibasic.ppt fundamental for engineeringVlsibasic.ppt fundamental for engineering
Vlsibasic.ppt fundamental for engineering
 
MATH 5.6.20 (1).ppt
MATH 5.6.20 (1).pptMATH 5.6.20 (1).ppt
MATH 5.6.20 (1).ppt
 
the-vhsic-.pptx
the-vhsic-.pptxthe-vhsic-.pptx
the-vhsic-.pptx
 
lecture_1_introduction__review_of_classical_control.pptx
lecture_1_introduction__review_of_classical_control.pptxlecture_1_introduction__review_of_classical_control.pptx
lecture_1_introduction__review_of_classical_control.pptx
 
EE392n_Lecture3apps.ppt
EE392n_Lecture3apps.pptEE392n_Lecture3apps.ppt
EE392n_Lecture3apps.ppt
 
SS7G1 - Africa Geography.ppt
SS7G1 - Africa Geography.pptSS7G1 - Africa Geography.ppt
SS7G1 - Africa Geography.ppt
 
NEW-II.pptx
NEW-II.pptxNEW-II.pptx
NEW-II.pptx
 
NEW-II.pptx
NEW-II.pptxNEW-II.pptx
NEW-II.pptx
 
CS4700-LS_v6.pptx
CS4700-LS_v6.pptxCS4700-LS_v6.pptx
CS4700-LS_v6.pptx
 
BeyondClassicalSearch.ppt
BeyondClassicalSearch.pptBeyondClassicalSearch.ppt
BeyondClassicalSearch.ppt
 
Ethnic and Religious Groups Student.pptx
Ethnic and Religious Groups Student.pptxEthnic and Religious Groups Student.pptx
Ethnic and Religious Groups Student.pptx
 
chapter2.pptx
chapter2.pptxchapter2.pptx
chapter2.pptx
 

Recently uploaded

Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 

Recently uploaded (20)

Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 

lec16-bari.pptx