SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Introduction to VHDL
            Fall 2008


          Jason Lor
   jlor@engmail.uwaterloo.ca
Outline
•   Brief Overview of VHDL
•   Structural Elements of VHDL
     •   Entity
     •   Architecture
     •   Signals

•   Data Types & Operators in VHDL
•   Assignment Execution
     •   Concurrent
     •   Sequential (Process)
Brief Overview of VHDL
• VHDL
 ... stands for Very High Speed Integrated Circuit
                 Hardware
                 Description
                 Language
 ... can be translated into an actual hardware implementation
 ... allows complex digital circuits to be easily created

 In VHDL, strong understanding of your code is more important
 than syntax & style.
Structural Elements
•   Entity

    •   Interface
        •   Example: Ports, I/O


•   Architecture

    •   Implementation
    •   Behaviour
    •   Function
Entity
• Describes the interactions of a module
entity GarageDoorOpener is             entity BlockName is
  port(                                  port(
        i_button : in std_logic;                clock_gen : in std_logic;
        i_sensor : in std_logic;                input1    : inout boolean;
        i_stop    : in std_logic;               input2    : in std_integer;

        o_active    : out std_logic;           output     : out string;
        o_direction : out std_logic            output1    : buffer character
     );                                     );
end entity;                            end entity;

 •    Port is a keyword that describes the data flow
 •    PortName : Mode DataType
 •    ‘;’ is used to separate elements, not for terminating the
      statement
Entity
          • Clock Generator

1
                                             Periodic Function
0


    Rising Edge               Falling Edge
Architecture

• Specifies the implementation of the module
• One entity can have several architectures
   architecture ArchitectureName of EntityName is
      begin
            a AND b => c;
   end ArchitectureName;



• Entity ports are available as signals within
  the architecture
Signals
• are intermediary ‘ports’ within the
  architecture
• represents wires and storage elements
• statements are concurrent

  architecture rtl of GarageDoorOpener is

    signal stop_door    : std_logic;
    signal SignalName   : datatype

  begin
    <architecture code here>
  end rtl;
Data Types
•   similar to programming, all signals and ports should
    have a data type
•   all signals and port must have a data type


      Data Types

       Boolean            Integer      std_logic_vector

          Bit              Real            std_logic

      Character                              type
Data Types
std_logic_vector is an array of std_logic variables
                      std_logic
                 U : uninitialized
                  X : unknown
                     0 : logic 0
                     1 : logic 1
               Z : high impedance
          W : weak signal (either 1 or 0)
           L : weak signal (leaning 0)
           H : weak signal (leaning 1)
                   - : don’t care
Data Types
• ‘type’                                        enumerable type
  • ... is an array of data types and values similar to std_logic_vector &
        std_logic
  • ... can be defined by you

  type TrafficLightState is
    (INIT, RED, REDYELLOW,YELLOW, GREEN);

  type LightSwitchState is
    (‘0’, ‘1’);

  type TypeName is
    (datatype, variablename);
Typical Operators
Logical Operators            Relational Operators
AND   NOR        NOT            =               Equal

                                /=            Not Equal
OR    NAND
                                <             Less than
XOR   XNOR
                                >            Greater than

             Mathematical Operators
             +                Addition
             -               Subtraction
             *              Multiplication
             /                Division
Assignment Execution
•   Concurrent/Continously or Combinational Logic
    • To give a signal a concurrent assignment
      SignalName <= expression;
    • Once your VHDL files compile, the compiler will
      assign your specifications to hardware components
      which operate in parallel with one another
•   Sequential Logic
    • Sequential logic is like programming in that your code
      executes in sequence
    • You can use conditional assignments like ‘if’, ‘case’ etc.
Assignment Execution
• In order to utilize sequential logic you
  have to use process statements
• There are two types of process
  statements, inside processes and outside
  processes
• ‘Process’ Statements
   • ... specifies a block of sequentially executed statements
   • ... run concurrently with each other
   • ... allows the use of if, else if, case, when, with, select statements
Assignment Execution
  library ieee;
  use ieee.std_logic_1164.all;
  use ieee.numeric_std.all;
Entity                                                        Architecture continued, Processes, Cases and If/elses
  entity TrafficLight is
     port(                                                      process(i_clock)
          i_clock : in std_logic;                                  begin
          i_pedestrian : out std_logic;                               if rising_edge(traffic_clock) then
                                                                       if i_pedestrian = ‘1’ then
         o_red : out std_logic;                                             current_state = YELLOW;
         o_yellow : out std_logic;                                     else
         o_green : out std_logic;                                           case current_state is
     );                                                                          when RED =>
  end entity;                                                                          current_state <= GREEN;
Architecture, Signal, Type                                                       when GREEN =>
 architecture RTL of TrafficLight is                                                    current_state <= RED;
    type state_t is (RED, YELLOW, GREEN);                                        when YELLOW =>
                                                                                   current_state <= RED;
    signal current_state : state_t;                                         end case;
                                                                         end if;
 begin                                                                 end if;
    o_red <= ‘1’ when (current_state = RED) else ‘0’;              end process;
    o_yellow <= ‘1’ when (current_state = YELLOW) else ‘0’;     end rtl;
    o_green <= ‘1’ when (current_state = GREEN) else ‘0’;

Mais conteúdo relacionado

Destaque

Limeryki o zdrowiu z cyklu między kleksami
Limeryki o zdrowiu  z cyklu między kleksamiLimeryki o zdrowiu  z cyklu między kleksami
Limeryki o zdrowiu z cyklu między kleksami
Ewelina Os
 
Early intervention 1.23.2012
Early intervention 1.23.2012Early intervention 1.23.2012
Early intervention 1.23.2012
Healthy City
 
Cwex and apprenticeship credits 2012
Cwex and apprenticeship credits 2012Cwex and apprenticeship credits 2012
Cwex and apprenticeship credits 2012
V
 
Healthy City WEBINAR Introductory Training
Healthy City WEBINAR Introductory TrainingHealthy City WEBINAR Introductory Training
Healthy City WEBINAR Introductory Training
Healthy City
 

Destaque (18)

Komunikasi data pendahuluan_rev1
Komunikasi data pendahuluan_rev1Komunikasi data pendahuluan_rev1
Komunikasi data pendahuluan_rev1
 
Limeryki o zdrowiu z cyklu między kleksami
Limeryki o zdrowiu  z cyklu między kleksamiLimeryki o zdrowiu  z cyklu między kleksami
Limeryki o zdrowiu z cyklu między kleksami
 
Historiaurrea
HistoriaurreaHistoriaurrea
Historiaurrea
 
Early intervention 1.23.2012
Early intervention 1.23.2012Early intervention 1.23.2012
Early intervention 1.23.2012
 
BHC webinar_General Users
BHC webinar_General UsersBHC webinar_General Users
BHC webinar_General Users
 
Motivation, Organisation and Campaigning
Motivation, Organisation and CampaigningMotivation, Organisation and Campaigning
Motivation, Organisation and Campaigning
 
Sutro & AdX
Sutro  & AdXSutro  & AdX
Sutro & AdX
 
How to Use HealthyCity.org for Uploading Your Own Data
How to Use HealthyCity.org for Uploading Your Own Data How to Use HealthyCity.org for Uploading Your Own Data
How to Use HealthyCity.org for Uploading Your Own Data
 
211 Healthy City Webinar 3 25 10
211 Healthy City Webinar 3 25 10211 Healthy City Webinar 3 25 10
211 Healthy City Webinar 3 25 10
 
Healthy City Presentation 3 23 10
Healthy City Presentation 3 23 10Healthy City Presentation 3 23 10
Healthy City Presentation 3 23 10
 
Badakizue blog
Badakizue blogBadakizue blog
Badakizue blog
 
Unibertsoa
UnibertsoaUnibertsoa
Unibertsoa
 
Healthy City Community Planning and Development webinar
Healthy City Community Planning and Development webinarHealthy City Community Planning and Development webinar
Healthy City Community Planning and Development webinar
 
ندوة الدراما التليفزيونية الأردنية
ندوة الدراما التليفزيونية الأردنيةندوة الدراما التليفزيونية الأردنية
ندوة الدراما التليفزيونية الأردنية
 
Cwex and apprenticeship credits 2012
Cwex and apprenticeship credits 2012Cwex and apprenticeship credits 2012
Cwex and apprenticeship credits 2012
 
Healthy City WEBINAR Introductory Training
Healthy City WEBINAR Introductory TrainingHealthy City WEBINAR Introductory Training
Healthy City WEBINAR Introductory Training
 
Historiaurrea
HistoriaurreaHistoriaurrea
Historiaurrea
 
How to make_godly_decisions
How to make_godly_decisionsHow to make_godly_decisions
How to make_godly_decisions
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Introduction to VHDL

  • 1. Introduction to VHDL Fall 2008 Jason Lor jlor@engmail.uwaterloo.ca
  • 2. Outline • Brief Overview of VHDL • Structural Elements of VHDL • Entity • Architecture • Signals • Data Types & Operators in VHDL • Assignment Execution • Concurrent • Sequential (Process)
  • 3. Brief Overview of VHDL • VHDL ... stands for Very High Speed Integrated Circuit Hardware Description Language ... can be translated into an actual hardware implementation ... allows complex digital circuits to be easily created In VHDL, strong understanding of your code is more important than syntax & style.
  • 4. Structural Elements • Entity • Interface • Example: Ports, I/O • Architecture • Implementation • Behaviour • Function
  • 5. Entity • Describes the interactions of a module entity GarageDoorOpener is entity BlockName is port( port( i_button : in std_logic; clock_gen : in std_logic; i_sensor : in std_logic; input1 : inout boolean; i_stop : in std_logic; input2 : in std_integer; o_active : out std_logic; output : out string; o_direction : out std_logic output1 : buffer character ); ); end entity; end entity; • Port is a keyword that describes the data flow • PortName : Mode DataType • ‘;’ is used to separate elements, not for terminating the statement
  • 6. Entity • Clock Generator 1 Periodic Function 0 Rising Edge Falling Edge
  • 7. Architecture • Specifies the implementation of the module • One entity can have several architectures architecture ArchitectureName of EntityName is begin a AND b => c; end ArchitectureName; • Entity ports are available as signals within the architecture
  • 8. Signals • are intermediary ‘ports’ within the architecture • represents wires and storage elements • statements are concurrent architecture rtl of GarageDoorOpener is signal stop_door : std_logic; signal SignalName : datatype begin <architecture code here> end rtl;
  • 9. Data Types • similar to programming, all signals and ports should have a data type • all signals and port must have a data type Data Types Boolean Integer std_logic_vector Bit Real std_logic Character type
  • 10. Data Types std_logic_vector is an array of std_logic variables std_logic U : uninitialized X : unknown 0 : logic 0 1 : logic 1 Z : high impedance W : weak signal (either 1 or 0) L : weak signal (leaning 0) H : weak signal (leaning 1) - : don’t care
  • 11. Data Types • ‘type’ enumerable type • ... is an array of data types and values similar to std_logic_vector & std_logic • ... can be defined by you type TrafficLightState is (INIT, RED, REDYELLOW,YELLOW, GREEN); type LightSwitchState is (‘0’, ‘1’); type TypeName is (datatype, variablename);
  • 12. Typical Operators Logical Operators Relational Operators AND NOR NOT = Equal /= Not Equal OR NAND < Less than XOR XNOR > Greater than Mathematical Operators + Addition - Subtraction * Multiplication / Division
  • 13. Assignment Execution • Concurrent/Continously or Combinational Logic • To give a signal a concurrent assignment SignalName <= expression; • Once your VHDL files compile, the compiler will assign your specifications to hardware components which operate in parallel with one another • Sequential Logic • Sequential logic is like programming in that your code executes in sequence • You can use conditional assignments like ‘if’, ‘case’ etc.
  • 14. Assignment Execution • In order to utilize sequential logic you have to use process statements • There are two types of process statements, inside processes and outside processes • ‘Process’ Statements • ... specifies a block of sequentially executed statements • ... run concurrently with each other • ... allows the use of if, else if, case, when, with, select statements
  • 15. Assignment Execution library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; Entity Architecture continued, Processes, Cases and If/elses entity TrafficLight is port( process(i_clock) i_clock : in std_logic; begin i_pedestrian : out std_logic; if rising_edge(traffic_clock) then if i_pedestrian = ‘1’ then o_red : out std_logic; current_state = YELLOW; o_yellow : out std_logic; else o_green : out std_logic; case current_state is ); when RED => end entity; current_state <= GREEN; Architecture, Signal, Type when GREEN => architecture RTL of TrafficLight is current_state <= RED; type state_t is (RED, YELLOW, GREEN); when YELLOW => current_state <= RED; signal current_state : state_t; end case; end if; begin end if; o_red <= ‘1’ when (current_state = RED) else ‘0’; end process; o_yellow <= ‘1’ when (current_state = YELLOW) else ‘0’; end rtl; o_green <= ‘1’ when (current_state = GREEN) else ‘0’;