SlideShare a Scribd company logo
Generics
Generics
● Used to pass information into a design description
from an environment
– E.g. rise and fall delays ,size of ports
● Used to construct parameterized models
entity AND_GATE is
generic (N:NATURAL);
port (A:in BIT_VECTOR (1 to N);
Z:out BIT);
end AND_GATE;
Architecture EXAMPLE of AND_GATE is
begin
process(A)
variable AND_OUT :BIT;
begin
AND_OUT :=„1‟;
for K in 1 to N loop
AND_OUT :=AND_OUT and A(K);
Exit when AND_OUT =„0‟;
end loop;
Z<=AND_OUT;
end process;
end EXAMPLE;
● Here the size of the input port has
been modeled as a generic.
● An entire class of AND gates with a
variable number of inputs has the
same behavioral model
● The value of the generic may be specified in
1.Entity declaration
2.Component declaration
3.Component instantiation
● The value of a generic may be specified in the
entity declaration .
– This is the default value
– It can be overridden by others
X
Example: 32-bit Shift Register, sync rst
entity SER_PAR_SH_REG is port (
CLK, RST, Serial_Din : in std_logic;
Data : out std_logic_vector(31 downto 0) );
end entity SER_PAR_SH_REG;
architecture behavioral of SER_PAR_SH_REG is
Signal Internal_Data : std_logic_vector(31 downto 0);
begin
process (CLK)
begin
if CLK’event and CLK = ‘1’ then
if RST = ‘1’ then
Internal_Data <= x”00000000”;
else
Internal_Data <= Serial_Din & Internal_Data(31 downto 1);
end if;
end if;
end process;
Data <= Internal_Data;
end behavioral;
MUST use internal
signal, because it is
used on BOTH sides
of the equation.
THIS statement is the
actual Shift Register
Then must set
external signal
equal to internal
signal
MUST use library statements!!
● Convert the 32-bit Shift Register into a
N-bit Shift Register using generics.
Example : 16-bit Loadable Counter, async reset
entity CNTR_16_async is port (
CLK, RST, Load : in std_logic;
Input_Data : in std_logic_vector(15 downto 0);
Count : out std_logic_vector(15 downto 0) );
end entity CNTR_16_async ;
architecture behavioral of CNTR_16_async is
Signal Internal_Count : std_logic_vector(15 downto 0) := X”0000”;
begin
process (CLK, RST)
begin
if RST = ‘1’ then
Internal_Count <= X”0000”;
elsif CLK’event and CLK = ‘1’ then
if Load = ‘1’ then
Internal_Count <= Input_Data;
else
Internal_Count <= Internal_Count + 1;
end if;
end if;
end process;
Count <= Internal_Count;
end behavioral;
MUST use library statements!!
MUST use internal
signal, because it is
used on BOTH sides
of the equation.
THIS statement is the
actual Counter
THIS statement is the
parallel load
The async Reset
Then must set
external signal
equal to internal
signal
Example : 16-bit Loadable Counter, async reset
entity CNTR_16_async is port (
CLK, RST, Load : in std_logic;
Input_Data : in std_logic_vector(15 downto 0);
Count : out std_logic_vector(15 downto 0) );
end entity CNTR_16_async ;
architecture behavioral of CNTR_16_async is
Signal Internal_Count : std_logic_vector(15 downto 0) := X”0000”;
begin
process (CLK, RST)
begin
if RST = ‘1’ then
Internal_Count <= X”0000”;
elsif CLK’event and CLK = ‘1’ then
if Load = ‘1’ then
Internal_Count <= Input_Data;
else
Internal_Count <= Internal_Count + 1;
end if;
end if;
end process;
Count <= Internal_Count;
end behavioral;
MUST use library statements!!
MUST use internal
signal, because it is
used on BOTH sides
of the equation.
THIS statement is the
actual Counter
THIS statement is the
parallel load
The async Reset
Then must set
external signal
equal to internal
signal
LIBRARY ieee;
USE ieee.Std_logic_1164.ALL;
USE ieee.Std_logic_unsigned.ALL;
ENTITY unicntr IS
GENERIC(n : Positive := 8); --size of counter/shifter
PORT(clock, serinl, serinr : IN Std_logic; --serial inputs
mode : IN Std_logic_vector(2 DOWNTO 0); --mode control
datain : IN Std_logic_vector((n-1) DOWNTO 0); --parallel inputs
dataout : OUT Std_logic_vector((n-1) DOWNTO 0); --parallel outputs
termcnt : OUT Std_logic); --terminal count output
END unicntr;
Design a universal register which can be used as a straightforward storage
register, a bi-directional shift register, an up counter and a down counter.
The register can be loaded from a set of parallel data inputs and the
mode is controlled by a 3-bit input. The 'termcnt' (terminal count) output
goes high when the register contains zero.
Example : Universal Register
ARCHITECTURE v1 OF unicntr IS
SIGNAL int_reg : Std_logic_vector((n-1) DOWNTO 0);
BEGIN
main_proc : PROCESS
BEGIN
WAIT UNTIL (clock=‘1’ and clock’event);
CASE mode IS
--reset
WHEN "000" => int_reg <= (OTHERS => '0');
--parallel load
WHEN "001" => int_reg <= datain;
--count up
WHEN "010" => int_reg <= int_reg + 1;
--count down
WHEN "011" => int_reg <= int_reg - 1;
--shift left
WHEN "100" => int_reg <= int_reg((n-2) DOWNTO 0) & serinl;
--shift right
WHEN "101" => int_reg <= serinr & int_reg((n-1) DOWNTO 1);
--do nothing
WHEN OTHERS => NULL;
END CASE;
END PROCESS;
det_zero : PROCESS(int_reg) --detects when count is 0
BEGIN
termcnt <= '1';
FOR i IN int_reg'Range LOOP
IF int_reg(i) = '1' THEN
termcnt <= '0';
EXIT;
END IF;
END LOOP;
END PROCESS;
--connect internal register to dataout port
dataout <= int_reg;
END v1;
Packages
Packages
● A package provides a convenient mechanism to
store and share declarations that are common
across many design units.
● A package is represented by
1. a package declaration, and optionally,
2. a package body.
Package declaration
● A package declaration contains a set of
declarations that may possibly be shared by many
design units.
● It defines the interface to the package, that is, it
defines items that can be made visible to other
design units, for example, a function declaration.
Package declaration
Package declaration - Example
Package declaration
● Items declared in a package declaration can be
accessed by other design units by using the library
and use context clauses.
Package body
● A package body primarily contains the behavior of
the subprograms and the values of the deferred
constants declared in a package declaration.
Package body
● The package name must be the same as the name of
its corresponding package declaration.
● A package body is not necessary if its associated
package declaration does not have any subprogram
or deferred constant declarations.
Package body
Package example
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
package mymux is
function MUX(signal in1,in2,sel:in std_logic)
return std_logic;
end myMUX;
package body mymux is
function MUX(signal in1,in2,sel:in std_logic)
return std_logic is
begin
return ((in1 and (not sel)) or (in2 and sel));
end MUX;
end myMUX;
--Use of package
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use work.mymux.all;
entity FullAdd is
Port ( A,b,Ci : in std_logic;
sum, carry : out std_logic);
end FullAdd;
architecture Behavioral of FullAdd is
signal x,y,cbar:std_logic;
begin
cbar<= not ci;
m1: x<=MUX (ci,cbar,b);
m2: y<=MUX (cbar,ci,b);
m3: sum<=MUX (x,y,a);
end Behavioral;
References
● [1]. “Digital Systems Design Using VHDL” by
Charles H Roth, Jr., Thomson Learining,
Brooks/Cole.
● [2]. “VHDL Primer” by J Bhasker, PHI, Third
edition.

More Related Content

What's hot

Storage classes
Storage classesStorage classes
Storage classes
Leela Koneru
 
Invoker rights
Invoker rightsInvoker rights
Invoker rights
Sadiq Noorulla
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
Pantech ProLabs India Pvt Ltd
 
Storage classes in C
Storage classes in CStorage classes in C
Storage classes in C
Nitesh Bichwani
 
Storage classes in C
Storage classes in C Storage classes in C
Storage classes in C
Self employed
 
Verilog Lecture4 2014
Verilog Lecture4 2014Verilog Lecture4 2014
Verilog Lecture4 2014
Béo Tú
 
Storage Classes and Functions
Storage Classes and FunctionsStorage Classes and Functions
Storage Classes and Functions
Jake Bond
 
Storage class in c
Storage class in cStorage class in c
Storage class in c
kash95
 
VERILOG CODE
VERILOG CODEVERILOG CODE
VERILOG CODE
Dhaval Kaneria
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modelling
VandanaPagar1
 
Programs of VHDL
Programs of VHDLPrograms of VHDL
Programs of VHDL
Rkrishna Mishra
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhts
Béo Tú
 
Storage Class in C Progrmming
Storage Class in C Progrmming Storage Class in C Progrmming
Storage Class in C Progrmming
Kamal Acharya
 
Fpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesFpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directives
Malik Tauqir Hasan
 
Verilog overview
Verilog overviewVerilog overview
Verilog overview
posdege
 
11 2. variable-scope rule,-storage_class
11 2. variable-scope rule,-storage_class11 2. variable-scope rule,-storage_class
11 2. variable-scope rule,-storage_class
웅식 전
 
An intro to VHDL
An intro to VHDLAn intro to VHDL
An intro to VHDL
Farzan Dehbashi
 
Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilog
venravi10
 
VHDL
VHDLVHDL
Verilog 語法教學
Verilog 語法教學 Verilog 語法教學
Verilog 語法教學
艾鍗科技
 

What's hot (20)

Storage classes
Storage classesStorage classes
Storage classes
 
Invoker rights
Invoker rightsInvoker rights
Invoker rights
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
 
Storage classes in C
Storage classes in CStorage classes in C
Storage classes in C
 
Storage classes in C
Storage classes in C Storage classes in C
Storage classes in C
 
Verilog Lecture4 2014
Verilog Lecture4 2014Verilog Lecture4 2014
Verilog Lecture4 2014
 
Storage Classes and Functions
Storage Classes and FunctionsStorage Classes and Functions
Storage Classes and Functions
 
Storage class in c
Storage class in cStorage class in c
Storage class in c
 
VERILOG CODE
VERILOG CODEVERILOG CODE
VERILOG CODE
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modelling
 
Programs of VHDL
Programs of VHDLPrograms of VHDL
Programs of VHDL
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhts
 
Storage Class in C Progrmming
Storage Class in C Progrmming Storage Class in C Progrmming
Storage Class in C Progrmming
 
Fpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesFpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directives
 
Verilog overview
Verilog overviewVerilog overview
Verilog overview
 
11 2. variable-scope rule,-storage_class
11 2. variable-scope rule,-storage_class11 2. variable-scope rule,-storage_class
11 2. variable-scope rule,-storage_class
 
An intro to VHDL
An intro to VHDLAn intro to VHDL
An intro to VHDL
 
Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilog
 
VHDL
VHDLVHDL
VHDL
 
Verilog 語法教學
Verilog 語法教學 Verilog 語法教學
Verilog 語法教學
 

Viewers also liked

College of Education 2015-2016 Faculty Retreat
College of Education 2015-2016 Faculty RetreatCollege of Education 2015-2016 Faculty Retreat
College of Education 2015-2016 Faculty Retreat
University of Wyoming College of Education
 
Louise hunt.com-the internet has no barriers where age is concerned
Louise hunt.com-the internet has no barriers where age is concernedLouise hunt.com-the internet has no barriers where age is concerned
Louise hunt.com-the internet has no barriers where age is concerned
Louise Hunt
 
Power Point for Daniel, Prophet to the Nations
Power Point for Daniel, Prophet to the NationsPower Point for Daniel, Prophet to the Nations
Power Point for Daniel, Prophet to the Nations
evidenceforchristianity
 
Updated resume anuradha - sep
Updated resume    anuradha - sepUpdated resume    anuradha - sep
Updated resume anuradha - sep
Anuradha Bandlamudi
 
Historia de la UE
Historia de la UEHistoria de la UE
Historia de la UE
euromachado antonio
 
SBM 2015
SBM 2015SBM 2015
Intra mailing-system-documentation-a-asp-net-project
Intra mailing-system-documentation-a-asp-net-projectIntra mailing-system-documentation-a-asp-net-project
Intra mailing-system-documentation-a-asp-net-project
Rasa Govindasamy
 
CreacióN De Material DidáCtico
CreacióN De Material DidáCticoCreacióN De Material DidáCtico
CreacióN De Material DidáCtico
martinrio
 
Iglesia perseguida
Iglesia perseguidaIglesia perseguida
Iglesia perseguida
Luis Cuervo
 

Viewers also liked (9)

College of Education 2015-2016 Faculty Retreat
College of Education 2015-2016 Faculty RetreatCollege of Education 2015-2016 Faculty Retreat
College of Education 2015-2016 Faculty Retreat
 
Louise hunt.com-the internet has no barriers where age is concerned
Louise hunt.com-the internet has no barriers where age is concernedLouise hunt.com-the internet has no barriers where age is concerned
Louise hunt.com-the internet has no barriers where age is concerned
 
Power Point for Daniel, Prophet to the Nations
Power Point for Daniel, Prophet to the NationsPower Point for Daniel, Prophet to the Nations
Power Point for Daniel, Prophet to the Nations
 
Updated resume anuradha - sep
Updated resume    anuradha - sepUpdated resume    anuradha - sep
Updated resume anuradha - sep
 
Historia de la UE
Historia de la UEHistoria de la UE
Historia de la UE
 
SBM 2015
SBM 2015SBM 2015
SBM 2015
 
Intra mailing-system-documentation-a-asp-net-project
Intra mailing-system-documentation-a-asp-net-projectIntra mailing-system-documentation-a-asp-net-project
Intra mailing-system-documentation-a-asp-net-project
 
CreacióN De Material DidáCtico
CreacióN De Material DidáCticoCreacióN De Material DidáCtico
CreacióN De Material DidáCtico
 
Iglesia perseguida
Iglesia perseguidaIglesia perseguida
Iglesia perseguida
 

Similar to Ddhdl 17

VHDL Subprograms and Packages
VHDL Subprograms and PackagesVHDL Subprograms and Packages
VHDL Subprograms and Packages
Ramasubbu .P
 
Practical file
Practical filePractical file
Practical file
rajeevkr35
 
Hd6
Hd6Hd6
Verilog Final Probe'22.pptx
Verilog Final Probe'22.pptxVerilog Final Probe'22.pptx
Verilog Final Probe'22.pptx
SyedAzim6
 
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDLSeminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
Naseer LoneRider
 
Digital system design practical file
Digital system design practical fileDigital system design practical file
Digital system design practical file
Archita Misra
 
Vhdl introduction
Vhdl introductionVhdl introduction
Vhdl introduction
Dhaval Shukla
 
Hd2
Hd2Hd2
Uart
UartUart
Uart
cs1090211
 
Pipeline stalling in vhdl
Pipeline stalling in vhdlPipeline stalling in vhdl
Pipeline stalling in vhdl
Sai Malleswar
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt
notagain0712
 
Spdas2 vlsibput
Spdas2 vlsibputSpdas2 vlsibput
Spdas2 vlsibput
GIET,Bhubaneswar
 
Dsp Datapath
Dsp DatapathDsp Datapath
Dsp Datapath
Abhishek Tiwari
 
An Overview of SystemVerilog for Design and Verification
An Overview of SystemVerilog  for Design and VerificationAn Overview of SystemVerilog  for Design and Verification
An Overview of SystemVerilog for Design and Verification
KapilRaghunandanTrip
 
vlsi introduction to hdl and its typesunit-1.pptx
vlsi introduction to hdl and its typesunit-1.pptxvlsi introduction to hdl and its typesunit-1.pptx
vlsi introduction to hdl and its typesunit-1.pptx
iconicyt2
 
Create your first model for a simple logic circuit
Create your first model for a simple logic circuitCreate your first model for a simple logic circuit
Create your first model for a simple logic circuit
Mohamed Samy
 
Building Hierarchy
Building HierarchyBuilding Hierarchy
Building Hierarchy
Mohamed Samy
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
Ramesh Naik Bhukya
 
DSD
DSDDSD
Combinational logic circuit by umakant bhaskar gohatre
Combinational logic circuit by umakant bhaskar gohatreCombinational logic circuit by umakant bhaskar gohatre
Combinational logic circuit by umakant bhaskar gohatre
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 

Similar to Ddhdl 17 (20)

VHDL Subprograms and Packages
VHDL Subprograms and PackagesVHDL Subprograms and Packages
VHDL Subprograms and Packages
 
Practical file
Practical filePractical file
Practical file
 
Hd6
Hd6Hd6
Hd6
 
Verilog Final Probe'22.pptx
Verilog Final Probe'22.pptxVerilog Final Probe'22.pptx
Verilog Final Probe'22.pptx
 
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDLSeminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
 
Digital system design practical file
Digital system design practical fileDigital system design practical file
Digital system design practical file
 
Vhdl introduction
Vhdl introductionVhdl introduction
Vhdl introduction
 
Hd2
Hd2Hd2
Hd2
 
Uart
UartUart
Uart
 
Pipeline stalling in vhdl
Pipeline stalling in vhdlPipeline stalling in vhdl
Pipeline stalling in vhdl
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt
 
Spdas2 vlsibput
Spdas2 vlsibputSpdas2 vlsibput
Spdas2 vlsibput
 
Dsp Datapath
Dsp DatapathDsp Datapath
Dsp Datapath
 
An Overview of SystemVerilog for Design and Verification
An Overview of SystemVerilog  for Design and VerificationAn Overview of SystemVerilog  for Design and Verification
An Overview of SystemVerilog for Design and Verification
 
vlsi introduction to hdl and its typesunit-1.pptx
vlsi introduction to hdl and its typesunit-1.pptxvlsi introduction to hdl and its typesunit-1.pptx
vlsi introduction to hdl and its typesunit-1.pptx
 
Create your first model for a simple logic circuit
Create your first model for a simple logic circuitCreate your first model for a simple logic circuit
Create your first model for a simple logic circuit
 
Building Hierarchy
Building HierarchyBuilding Hierarchy
Building Hierarchy
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
 
DSD
DSDDSD
DSD
 
Combinational logic circuit by umakant bhaskar gohatre
Combinational logic circuit by umakant bhaskar gohatreCombinational logic circuit by umakant bhaskar gohatre
Combinational logic circuit by umakant bhaskar gohatre
 

Recently uploaded

An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
Bituminous road construction project based learning report
Bituminous road construction project based learning reportBituminous road construction project based learning report
Bituminous road construction project based learning report
CE19KaushlendraKumar
 
Blood finder application project report (1).pdf
Blood finder application project report (1).pdfBlood finder application project report (1).pdf
Blood finder application project report (1).pdf
Kamal Acharya
 
Generative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdfGenerative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdf
mahaffeycheryld
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
uqyfuc
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Open Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surfaceOpen Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surface
Indrajeet sahu
 
Zener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and ApplicationsZener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and Applications
Shiny Christobel
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
Paris Salesforce Developer Group
 
Impartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 StandardImpartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 Standard
MuhammadJazib15
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
OKORIE1
 
Power Electronics- AC -AC Converters.pptx
Power Electronics- AC -AC Converters.pptxPower Electronics- AC -AC Converters.pptx
Power Electronics- AC -AC Converters.pptx
Poornima D
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Roger Rozario
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
PriyankaKilaniya
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
openshift technical overview - Flow of openshift containerisatoin
openshift technical overview - Flow of openshift containerisatoinopenshift technical overview - Flow of openshift containerisatoin
openshift technical overview - Flow of openshift containerisatoin
snaprevwdev
 
Levelised Cost of Hydrogen (LCOH) Calculator Manual
Levelised Cost of Hydrogen  (LCOH) Calculator ManualLevelised Cost of Hydrogen  (LCOH) Calculator Manual
Levelised Cost of Hydrogen (LCOH) Calculator Manual
Massimo Talia
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 

Recently uploaded (20)

An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
Bituminous road construction project based learning report
Bituminous road construction project based learning reportBituminous road construction project based learning report
Bituminous road construction project based learning report
 
Blood finder application project report (1).pdf
Blood finder application project report (1).pdfBlood finder application project report (1).pdf
Blood finder application project report (1).pdf
 
Generative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdfGenerative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdf
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Open Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surfaceOpen Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surface
 
Zener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and ApplicationsZener Diode and its V-I Characteristics and Applications
Zener Diode and its V-I Characteristics and Applications
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
 
Impartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 StandardImpartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 Standard
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
DESIGN AND MANUFACTURE OF CEILING BOARD USING SAWDUST AND WASTE CARTON MATERI...
 
Power Electronics- AC -AC Converters.pptx
Power Electronics- AC -AC Converters.pptxPower Electronics- AC -AC Converters.pptx
Power Electronics- AC -AC Converters.pptx
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
openshift technical overview - Flow of openshift containerisatoin
openshift technical overview - Flow of openshift containerisatoinopenshift technical overview - Flow of openshift containerisatoin
openshift technical overview - Flow of openshift containerisatoin
 
Levelised Cost of Hydrogen (LCOH) Calculator Manual
Levelised Cost of Hydrogen  (LCOH) Calculator ManualLevelised Cost of Hydrogen  (LCOH) Calculator Manual
Levelised Cost of Hydrogen (LCOH) Calculator Manual
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 

Ddhdl 17

  • 2. Generics ● Used to pass information into a design description from an environment – E.g. rise and fall delays ,size of ports ● Used to construct parameterized models
  • 3. entity AND_GATE is generic (N:NATURAL); port (A:in BIT_VECTOR (1 to N); Z:out BIT); end AND_GATE; Architecture EXAMPLE of AND_GATE is begin process(A) variable AND_OUT :BIT; begin AND_OUT :=„1‟; for K in 1 to N loop AND_OUT :=AND_OUT and A(K); Exit when AND_OUT =„0‟; end loop; Z<=AND_OUT; end process; end EXAMPLE;
  • 4. ● Here the size of the input port has been modeled as a generic. ● An entire class of AND gates with a variable number of inputs has the same behavioral model
  • 5. ● The value of the generic may be specified in 1.Entity declaration 2.Component declaration 3.Component instantiation
  • 6. ● The value of a generic may be specified in the entity declaration . – This is the default value – It can be overridden by others
  • 7. X
  • 8.
  • 9.
  • 10. Example: 32-bit Shift Register, sync rst entity SER_PAR_SH_REG is port ( CLK, RST, Serial_Din : in std_logic; Data : out std_logic_vector(31 downto 0) ); end entity SER_PAR_SH_REG; architecture behavioral of SER_PAR_SH_REG is Signal Internal_Data : std_logic_vector(31 downto 0); begin process (CLK) begin if CLK’event and CLK = ‘1’ then if RST = ‘1’ then Internal_Data <= x”00000000”; else Internal_Data <= Serial_Din & Internal_Data(31 downto 1); end if; end if; end process; Data <= Internal_Data; end behavioral; MUST use internal signal, because it is used on BOTH sides of the equation. THIS statement is the actual Shift Register Then must set external signal equal to internal signal MUST use library statements!!
  • 11. ● Convert the 32-bit Shift Register into a N-bit Shift Register using generics.
  • 12. Example : 16-bit Loadable Counter, async reset entity CNTR_16_async is port ( CLK, RST, Load : in std_logic; Input_Data : in std_logic_vector(15 downto 0); Count : out std_logic_vector(15 downto 0) ); end entity CNTR_16_async ; architecture behavioral of CNTR_16_async is Signal Internal_Count : std_logic_vector(15 downto 0) := X”0000”; begin process (CLK, RST) begin if RST = ‘1’ then Internal_Count <= X”0000”; elsif CLK’event and CLK = ‘1’ then if Load = ‘1’ then Internal_Count <= Input_Data; else Internal_Count <= Internal_Count + 1; end if; end if; end process; Count <= Internal_Count; end behavioral; MUST use library statements!! MUST use internal signal, because it is used on BOTH sides of the equation. THIS statement is the actual Counter THIS statement is the parallel load The async Reset Then must set external signal equal to internal signal
  • 13. Example : 16-bit Loadable Counter, async reset entity CNTR_16_async is port ( CLK, RST, Load : in std_logic; Input_Data : in std_logic_vector(15 downto 0); Count : out std_logic_vector(15 downto 0) ); end entity CNTR_16_async ; architecture behavioral of CNTR_16_async is Signal Internal_Count : std_logic_vector(15 downto 0) := X”0000”; begin process (CLK, RST) begin if RST = ‘1’ then Internal_Count <= X”0000”; elsif CLK’event and CLK = ‘1’ then if Load = ‘1’ then Internal_Count <= Input_Data; else Internal_Count <= Internal_Count + 1; end if; end if; end process; Count <= Internal_Count; end behavioral; MUST use library statements!! MUST use internal signal, because it is used on BOTH sides of the equation. THIS statement is the actual Counter THIS statement is the parallel load The async Reset Then must set external signal equal to internal signal
  • 14. LIBRARY ieee; USE ieee.Std_logic_1164.ALL; USE ieee.Std_logic_unsigned.ALL; ENTITY unicntr IS GENERIC(n : Positive := 8); --size of counter/shifter PORT(clock, serinl, serinr : IN Std_logic; --serial inputs mode : IN Std_logic_vector(2 DOWNTO 0); --mode control datain : IN Std_logic_vector((n-1) DOWNTO 0); --parallel inputs dataout : OUT Std_logic_vector((n-1) DOWNTO 0); --parallel outputs termcnt : OUT Std_logic); --terminal count output END unicntr; Design a universal register which can be used as a straightforward storage register, a bi-directional shift register, an up counter and a down counter. The register can be loaded from a set of parallel data inputs and the mode is controlled by a 3-bit input. The 'termcnt' (terminal count) output goes high when the register contains zero. Example : Universal Register
  • 15. ARCHITECTURE v1 OF unicntr IS SIGNAL int_reg : Std_logic_vector((n-1) DOWNTO 0); BEGIN main_proc : PROCESS BEGIN WAIT UNTIL (clock=‘1’ and clock’event); CASE mode IS --reset WHEN "000" => int_reg <= (OTHERS => '0'); --parallel load WHEN "001" => int_reg <= datain; --count up WHEN "010" => int_reg <= int_reg + 1; --count down WHEN "011" => int_reg <= int_reg - 1; --shift left WHEN "100" => int_reg <= int_reg((n-2) DOWNTO 0) & serinl; --shift right WHEN "101" => int_reg <= serinr & int_reg((n-1) DOWNTO 1); --do nothing WHEN OTHERS => NULL; END CASE; END PROCESS;
  • 16. det_zero : PROCESS(int_reg) --detects when count is 0 BEGIN termcnt <= '1'; FOR i IN int_reg'Range LOOP IF int_reg(i) = '1' THEN termcnt <= '0'; EXIT; END IF; END LOOP; END PROCESS; --connect internal register to dataout port dataout <= int_reg; END v1;
  • 18. Packages ● A package provides a convenient mechanism to store and share declarations that are common across many design units. ● A package is represented by 1. a package declaration, and optionally, 2. a package body.
  • 19. Package declaration ● A package declaration contains a set of declarations that may possibly be shared by many design units. ● It defines the interface to the package, that is, it defines items that can be made visible to other design units, for example, a function declaration.
  • 22. Package declaration ● Items declared in a package declaration can be accessed by other design units by using the library and use context clauses.
  • 23. Package body ● A package body primarily contains the behavior of the subprograms and the values of the deferred constants declared in a package declaration.
  • 24. Package body ● The package name must be the same as the name of its corresponding package declaration. ● A package body is not necessary if its associated package declaration does not have any subprogram or deferred constant declarations.
  • 26. Package example library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; package mymux is function MUX(signal in1,in2,sel:in std_logic) return std_logic; end myMUX; package body mymux is function MUX(signal in1,in2,sel:in std_logic) return std_logic is begin return ((in1 and (not sel)) or (in2 and sel)); end MUX; end myMUX;
  • 27. --Use of package library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; use work.mymux.all; entity FullAdd is Port ( A,b,Ci : in std_logic; sum, carry : out std_logic); end FullAdd; architecture Behavioral of FullAdd is signal x,y,cbar:std_logic; begin cbar<= not ci; m1: x<=MUX (ci,cbar,b); m2: y<=MUX (cbar,ci,b); m3: sum<=MUX (x,y,a); end Behavioral;
  • 28. References ● [1]. “Digital Systems Design Using VHDL” by Charles H Roth, Jr., Thomson Learining, Brooks/Cole. ● [2]. “VHDL Primer” by J Bhasker, PHI, Third edition.