SlideShare a Scribd company logo
• Click to edit Master text styles
  – Second level
     • Third level
         – Fourthg i t a l D e s i g n u s i n g V H D L
              D i level
                    Session Seven
              » Fifth level



                                               Introduced by




                                                                            Cairo-Egypt

                                                               Version 03 – June 2012 1
about Start Group


• Click to edit Master text styles
   Mahmoud Abdellatif
  – Second level
  Alaa Salah Shehata
   Mohamed level
     • Third Salah
   Mohamed Talaat
         – Fourth level
               » Fifth level
    start.courses@gmail.com              www.slideshare.net/StartGroup

    www.facebook.com/groups/start.group

    www.startgroup.weebly.com           Start.courses@gmail.com

   + 02 0122-4504158 M.A                 www.youtube.com/StartGroup2011
   + 02 0128-0090250 A.S

                                Session Six                               2
mini-Project Discussion


 • Click to edit Master text styles
       – Second level
                                     B(i)=[A(i)+C(i)]mod2
A(i)      • Third     B(i)
         Scrambler level
              – Fourth level
                  » Fifth level




                                  Session Four              3
Outline


• Click to edit Master text styles
   – Second level
       • Third level
                       Structural Description

                               Generic

                              Using Package
                                                   7
          – Fourth level
                              Generate Statement
              » Fifth level




                              Session Seven        4
Outline


• Click to edit Master text styles
                       Structural Description

   – Second level              Generic

       • Third level          Using Package
          – Fourth level
                              Generate Statement
              » Fifth level




                              Session Seven        5
Structural Description


• Click to edit Master textlevels
Structural description allows having multiple
                                              styles
     – Second level
of hierarchy in the design

        • Third
Top- Down Design    level
               – Fourth level
The Design starts with the top-level block. This                 8 bit
                    » Fifth level
design is then partitioned into lower-level blocks till          Adder
the root-level of your design is reached.


                                                            Full Adder




                                                         Half
                                                        Adder
                                        Session Seven                    6
Structural Description


• Click to edit Master text styles
    – Second level
Bottom-Up Design
         • Third level
Used when the design is very large.
             – Fourth level
                   » Fifth level
When using a bottom-up design methodology. the design begins with knowledge of the
root and is then partitioned based on which primitives are available as leaf-nodes.




                                      Session Seven                             7
Structural Description [Component]


• Click to edit Master text styles
1-Component Declaration

     – Second level
The basic element of hirarichal design is component

        • <component_name>
component Third level
port ( <port_names>: <mode> <type>;
            – Fourth level
        <port_names>: <mode> <type>;
                          ….
                » Fifth level
                );
end component;
Component : Creates an instance of another entity.
Note
  The definition of the component is like the definition of the entity.
  Component is Previously coded, simulated, synthesized and placed in design library
  Components are defined inside Architecture in Architecture Declaration before begin




                                         Session Seven                                  8
Structural Description [Instantiation]

2-Component instantiation and Interconnections              method 1
• Click to edit Master text styles
instance_name: component_name
     – Second level
port map
(signal1,signal2,…);
           • Third level
                 – Fourth level
Each signal is written in the position that describe which port it belongs to which means that the
                       » Fifth level
first signal written here represent the first port in the component.
That is named association-instantiation by position.

Note
if you needn't use special output port, Using the key word open (that mean this port will be
unconnected).
This method is easier but bad in readability.




                                            Session Seven                                       9
Structural Description [Instantiation]


2-Component instantiation and Interconnections             method 2
• Click to edit Master text styles
<instance_name>: <component_name >
     – Second level
port map(
<port_name> => <sig_name>,
        • Third level
<port_name> => <sig_name>,
        ….
<port_name> – Fourth level
             => <sig_name> );
                      » Fifth level
That is named instantiation by name.
Order is not important.

• The left part of the expression serve as name of port of the component
• The right part of the expression serves as name of connected signal (or port of other
component).




                                           Session Seven                                  10
Example 25

Logic Gate
 • Click to edit Master text styles
entity test is
Port (

      – Second level
         a : in STD_LOGIC;
         b : in STD_LOGIC;
         c : in STD_LOGIC;
             • Third level
         d : in STD_LOGIC;
         f : out STD_LOGIC);
end test;      – Fourth level
                    » Fifth level
architecture Behavioral of test is
         component or_gate is
         Port (   in1 : in STD_LOGIC;               AND
                  in2 : in STD_LOGIC;               gate
                                                            OR
                  out_or : out STD_LOGIC);
                                                           gate
         end component ;                            AND
                                                    gate
         component and_gate is
         Port (   in1 : in STD_LOGIC;
                  in2 : in STD_LOGIC;
                  out_and : out STD_LOGIC);
         end component;
                                    Session Seven                 11
Example 25

Logic Gate
 • Click to edit Master text styles
        – Second level
…
             • Third level
signal sig1,sig2 : std_logic;

begin           – Fourth level
          u1:and_gate
                    » Fifth level
          port map (a,b,sig1);

          u2:and_gate                               AND
          port map (c,d,sig2);                      gate
                                                            OR
          u3:or_gate                                       gate
                                                    AND
          port map (sig1,sig2,f);                   gate
end Behavioral;




                                    Session Seven                 12
Example 26

Logic Gate
 • Click to edit Master text styles
entity test is
Port (

      – Second level
         a : in STD_LOGIC;
         b : in STD_LOGIC;
         c : in STD_LOGIC;
             • Third level
         d : in STD_LOGIC;
         f : out STD_LOGIC);
end test;      – Fourth level
                    » Fifth level
architecture Behavioral of test is
         component or_gate is
         Port (   in1 : in STD_LOGIC;               AND
                  in2 : in STD_LOGIC;               gate
                                                            OR
                  out_or : out STD_LOGIC);
                                                           gate
         end component ;                            AND
                                                    gate
         component and_gate is
         Port (   in1 : in STD_LOGIC;
                  in2 : in STD_LOGIC;
                  out_and : out STD_LOGIC);
         end component;
                                    Session Seven                 13
Example 26

Logic Gate
 • Click to edit Master text styles
signal sig1,sig2 : std_logic;

begin
        – Second level
          u1:and_gate
             • Third level
          port map (
                   in1 => a,
                – Fourth level
                   in2 => b,
                   out_and => sig1);
                    » Fifth level
          u2:and_gate
          port map (                                   AND
                   in1 => c,                           gate
                   in2 => d,                                   OR
                   out_and => sig2);                          gate
                                                       AND
         u3:or_gate                                    gate
         port map (
                  in1 => sig1,
                  in2 => sig2,
                  out_or => f);
end Behavioral;
                                       Session Seven                 14
Lab 09


• Click to edit Master text styles
Title:

Goal:
      – Second level
         Using Structural Description

          •
             ThirdXilinx to Generate Instantiations
               Using level
              Using Structural Described codes
                – Fourth level
                    » Fifth level




                                         Session Seven   15
Lab 09


 • Click to edit Master text styles
     – Second level
Entity comp4 is
port (
         • Third level
    a , b : in std_logic_vector(3 downto 0);
    eq : out std_logic ); End comp4 ;
                – Fourth level
Architecture   struct of comp4 is
                    » Fifth level
Component xnor_2 is
         port ( g , f : in std_logic ;
                 y : out std_logic );
End component ;

Component and_4 is
         port ( in1,in2,in3,in4 :in std_logic;
         out1 : out std_logic );
End component ;
…


                                    Session Seven   16
Lab 09


    • Click to edit Master text styles
…
        – Second level
           • Third level
Signal x : std_logic_vector ( 3 downto 0 ) ;

Begin            – Fourth level
          U1 : xnor_2
          port map (»a(0) ,level , x(0) ) ; U2 :
                      Fifth b(0)
xnor_2
          port   map ( a(1) , b(1) , x(1) ) ;
          U3 :   xnor_2
          port   map ( a(2) , b(2) , x(2) ) ;
          U4 :   xnor_2
          port   map ( a(3) , b(3) , x(3) ) ;
          U5 :   and_4
          port map ( x(0) , x(1) , x(2) , x(3) , eq )
;
End struct ;



                                        Session Seven   17
Outline


• Click to edit Master text styles
                       Structural Description

   – Second level              Generic

       • Third level          Using Package
          – Fourth level
                              Generate Statement
              » Fifth level




                              Session Seven        18
Generic


• Click to edit Master text styles
VHDL provides an easy way to create generic design units that can be used several times with
different properties in the design hierarchy
     – Second level
Syntax
          • Third level
                – Fourth level
generic (
       <identifier>: level [:= default_value];
              » Fifth type
       <identifier>: type [:= default_value])
                 );


                                                                           4-bit
                                                                          counter
                                                   N-bit
                                                  counter                  8-bit
                                                                          counter


                                          Session Seven                                        19
Example 27

Logic Gate
 • Click to edit Master text styles
                                                      AND
      – Second level
library IEEE;
                                                      gate

             • Third level
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
              – Fourth level
use IEEE.STD_LOGIC_UNSIGNED.ALL;

Entity generic_and » Fifth level
                   is
  generic (N : integer := 4 );
  port(A, B : in std_logic_vector (N-1 downto 0);
       Z    : out std_logic_vector(N-1 downto 0) );
End entity;

Architecture behave of generic_and is
Begin
  Z <= A and B;
End architecture



                                   Session Seven             20
Example 28

N-bit Full Adder                                        C_in
 • Click to edit Master text styles
      – Second level                               A
                                                         N bit      Sum
           • Third level                               Full Adder
Entity F_adder – Fourth level
                is                                 B
Generic ( N : integer := 4 );
Port (             » Fifth level
       A, B : in std_logic_vector(N-1 downto 0);
       C_in : in std_logic ;                             C_out
       Sum : out std_logic_vector(N-1 downto 0);
       C_out : out std_logic ) ;
End F_adder ;
…




                                  Session Seven                     21
Example 28

N-bit Full Adder                                          C_in
 • Click to edit Master text styles
Architecture struct of f_adder is

        – Second level
Component n_adder
Generic ( N : integer := 4 );
                                                     A
                                                           N bit      Sum
Port (
           • Third level
     A,B : in std_logic_vector(N-1 downto 0);            Full Adder
     C_in : in – Fourth level
                std_logic ;                          B
     Sum : out std_logic_vector(N-1 downto 0);
                   » Fifth level
     C_out : out std_logic );
End component ;
                                                           C_out
Begin
         U1 : n_adder
         generic map (8)
         port map (
                  A => A,
                  B => B ,
                  c_in => C_in ,
                  sum => Sun ,
                  c_out => C_out);
End struct
                                     Session Seven                    22
Outline


• Click to edit Master text styles
                       Structural Description

   – Second level              Generic

       • Third level          Using Package
          – Fourth level
                              Generate Statement
              » Fifth level




                              Session Seven        23
Using Packages


• Click to edit Master text styles
Instead of declaring all components can declare all components in a PACKAGE, and INCLUDE the
package once
     – Second level
        1) This makes the top-level entity code cleaner
          • Third level
          2) It also allows that complete package to be used by another designer

               – Fourth level
A package can contain
                    » Fifth level
          1) Components
          2) Functions, Procedures
          3) Types, Constants




                                         Session Seven                                    24
Example 29

Logic circuit using package
 • Click to edit Master text styles
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
      – Second level
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
           • Third level
package logic_circuit is
              – Fourth
   component or_gate is level
   Port ( in1 : in STD_LOGIC;
          in2 : in » Fifth level
                   STD_LOGIC;
          out_or : out STD_LOGIC);
   end component ;                                          AND
                                                            gate
   component and_gate is                                            OR
   Port ( in1 : in STD_LOGIC;                                      gate
          in2 : in STD_LOGIC;                               AND
          out_and : out STD_LOGIC);                         gate
   end component;

constant const1: STD_LOGIC_vector (3 downto 0) := "0011";
constant const1: STD_LOGIC_vector (3 downto 0)
:= "0011"; ---const definition
end logic_circuit;
                                     Session Seven                        25
Example 29

Logic circuit using package
 • Click to edit Master text styles
library IEEE;                                      .
      – Second level
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
                                                   u1:and_gate port map (
                                                   in1 => a,
           • Third level
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use work.logic_circuit.all;
                                                   in2 => b,
                                                   out_and => sig1);
                – Fourth level
entity test is                                     u2:and_gate port map (
Port (            » Fifth level                    in1 => c,
    a : in STD_LOGIC;                              in2 => d,
    b : in STD_LOGIC;                              out_and => sig2);
    c : in STD_LOGIC;
    d : in STD_LOGIC;                              u3:or_gate port map (
    Out1 : out STD_LOGIC_vector (3 downto 0);      in1 => sig1,
    f    : out STD_LOGIC);                         in2 => sig2,
end test;                                          out_or => f);

architecture Behavioral of test is                 out1<= const1;
         signal sig1,sig2 : std_logic;
begin .                                            end Behavioral;

                                   Session Seven                            26
Outline


• Click to edit Master text styles
                       Structural Description

   – Second level              Generic

       • Third level          Using Package
          – Fourth level
                              Generate Statement
              » Fifth level




                              Session Seven        27
Generate Statement


• Click to edit Master text styles
 The generate statement simplifies description of regular design structures. Usually it is used to
     – Second level
specify a group of identical components using just one component specification and repeating it
using the generate mechanism.
           • Third level
Declaration
                – Fourth level
Label : for    identifier IN range
                    » Fifth level
GENERATE (concurrent assignments)
         .
         .
END GENERATE;




                                           Session Seven                                       28
Example 30

SEREIS OF XOR GATES
 • Click to edit Master text styles
     – Second level
         • Third level
              – Fourth level
                  » Fifth level




ENTITY parity IS
PORT(
         parity_in : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
         parity_out : OUT STD_LOGIC );
END parity;


                                  Session Seven         29
Example 30

SEREIS OF XOR GATES
 • Click xor_out(1) xor_out(2)
         to edit Master text styles
                                 xor_out(3)
     – Second level                           xor_out(4)
                                                           xor_out(5) xor_out(6)

         • Third level
              – Fourth level
                  » Fifth level



         xor_out(1)   <=   parity_in(0)   XOR   parity_in(1);
         xor_out(2)   <=   xor_out(1)     XOR   parity_in(2);
         xor_out(3)   <=   xor_out(2)     XOR   parity_in(3);
         xor_out(4)   <=   xor_out(3)     XOR   parity_in(4);
         xor_out(5)   <=   xor_out(4)     XOR   parity_in(5);
         xor_out(6)   <=   xor_out(5)     XOR   parity_in(6);
         parity_out   <=   xor_out(6)     XOR   parity_in(7);
                                        Session Seven                              30
Example 30

 SEREIS OF XOR GATES
   • Click xor_out(1) xor_out(2)
           to edit Master text styles
                                     xor_out(3)
        – Second level
xor_out(0)                                        xor_out(4)
                                                               xor_out(5) xor_out(6)

             • Third level
                                                                                       xor_out(7)
                 – Fourth level
                     » Fifth level


             xor_out(0)   <=   parity_in(0);
             xor_out(1)   <=   xor_out(0) XOR     parity_in(1);
             xor_out(2)   <=   xor_out(1) XOR     parity_in(2);
             xor_out(3)   <=   xor_out(2) XOR     parity_in(3);
             xor_out(4)   <=   xor_out(3) XOR     parity_in(4);
             xor_out(5)   <=   xor_out(4) XOR     parity_in(5);
             xor_out(6)   <=   xor_out(5) XOR     parity_in(6);
             xor_out(7)   <=   xor_out(6) XOR     parity_in(7);
             parity_out   <=   xor_out(7);
                                            Session Seven                                     31
Example 30

SEREIS OF XOR GATES
 • Click to edit Master text styles
     – Second level
ARCHITECTURE parity_dataflow OF parity IS
         SIGNAL xor_out: STD_LOGIC_VECTOR (7 DOWNTO 0);
BEGIN
         • Third level
         xor_out(0) <= parity_in(0);
              – Fourth level
         G2: FOR i IN 1 TO 7 GENERATE
                   » Fifth level
                  xor_out(i) <= xor_out(i-1) XOR parity_in(i);
         END GENERATE G2;

         parity_out <= xor_out(7);

END parity_dataflow;




                                     Session Seven               32
Start Notes       [Synthesis Notes]


• Click to edit Master text styles
                               architecture rtl of full adder Is
      – Second level
Structural Description
                                  signal col .co2: std_logic;
                                  signal a_xor_b : std_logic;
            • Third level      begin
                                  ul: entity work.half_adder(behave)
In VHDL-93 standard, an
                  – pair
entity-architecture Fourth level        port map (a,b.axorb.col);
                                  u2: entity work.half_adder(behave)
may        be       directly
                       » Fifth level    port map( axorb,ci,s,co2);
instantiated, i.e.
component        need     not     co< col or cO2;
declared. This is easier. but
not readably.                   end architecture rtl;




                                          Session Six                  33
Assignment 07


• Click to edit Master text styles
Study Well for Next session’s Evaluation Test
     – Second level
          • Third level
              – Fourth level
                  » Fifth level




                                      Session Seven   34
Summary


• Click to edit Master text styles
-   Structural description allows having multiple levels of hierarchy in the design
-     – Second level
    VHDL provides an easy way to create generic design units that can be used several times with
    different properties in the design hierarchy.
-           • Third level
     The generate statement used to specify a group of identical components using just one
    component specification and repeating it using the generate mechanism.
                – Fourth level
                    » Fifth level




                                                              Examples     Exercises   Labs
                                                              25-30        -           9


                                          Session Seven                                       35
Time for Your Questions


• Click to edit Master text styles
  – Second level
     • Third level
        – Fourth level
            » Fifth level




                            Session Seven   36
Take Your Notes
                                       Print the slides and take your notes here
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
   • Click to edit Master text styles
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
          – Second level
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
                 • Third level
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
                        – Fourth level
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
                            » Fifth level
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
See You Next Session .. Don’t miss


• Click to edit Master text styles


                     Thank
  – Second level
     • Third level
        – Fourth level



                      You
            » Fifth level

More Related Content

PPTX
Session 05 v.3
PPTX
Tutorial 2
PPTX
Session 08 v.3
PPTX
Session 02 v.3
PPTX
Session 03 v.3
PPTX
Session 06 v.3
PPTX
Session 01 v.3
PPTX
Intrduction to the course v.3
Session 05 v.3
Tutorial 2
Session 08 v.3
Session 02 v.3
Session 03 v.3
Session 06 v.3
Session 01 v.3
Intrduction to the course v.3

What's hot (20)

PDF
Different phases of a compiler
PDF
Cs6660 compiler design
PPTX
9 subprograms
PDF
Principles of compiler design
KEY
Unit 1 cd
PPT
Compiler1
PPTX
System Programming Unit III
PDF
Compiler design
PDF
08 subprograms
PPT
Chapter 1 - An Overview of Computers and Programming Languages
DOCX
Compiler design important questions
PDF
Lecture2 general structure of a compiler
PPTX
Structure of the compiler
PPT
Csci360 08-subprograms
PPSX
Compiler designs presentation final
PDF
Subprogram
PPTX
Refresh your memory 1
PDF
Compiler Design Introduction
PDF
4Sem VTU-HDL Programming Notes-Unit1-Introduction
PPTX
Type checking in compiler design
Different phases of a compiler
Cs6660 compiler design
9 subprograms
Principles of compiler design
Unit 1 cd
Compiler1
System Programming Unit III
Compiler design
08 subprograms
Chapter 1 - An Overview of Computers and Programming Languages
Compiler design important questions
Lecture2 general structure of a compiler
Structure of the compiler
Csci360 08-subprograms
Compiler designs presentation final
Subprogram
Refresh your memory 1
Compiler Design Introduction
4Sem VTU-HDL Programming Notes-Unit1-Introduction
Type checking in compiler design
Ad

Similar to Session 07 v.3 (20)

PDF
Session seven
PPT
VHDL - Enumerated Types (Part 3)
PPTX
Basics of Vhdl
PDF
Session two
PDF
Chapter 01
PDF
Lecture 2 verilog
PDF
Verilog HDL coding in VLSi Design circuits.pdf
PDF
Ddhdl 15
PDF
AADL Overview: Brief and Pointless
PDF
Session 04 v.3
PPT
Lesson 15 ery High-Speed Integrated Circuit Hardware Description LanguageVHDL...
PDF
Platforms and the Semantic Web
PPT
VHDL Part 4
PDF
Session one
PPTX
Verilog
PDF
The Next Great Functional Programming Language
PDF
Lecture1
PPT
Summer training vhdl
PDF
Module 201 2 20 just 20 basic
Session seven
VHDL - Enumerated Types (Part 3)
Basics of Vhdl
Session two
Chapter 01
Lecture 2 verilog
Verilog HDL coding in VLSi Design circuits.pdf
Ddhdl 15
AADL Overview: Brief and Pointless
Session 04 v.3
Lesson 15 ery High-Speed Integrated Circuit Hardware Description LanguageVHDL...
Platforms and the Semantic Web
VHDL Part 4
Session one
Verilog
The Next Great Functional Programming Language
Lecture1
Summer training vhdl
Module 201 2 20 just 20 basic
Ad

Recently uploaded (20)

PDF
Modernizing your data center with Dell and AMD
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Cloud computing and distributed systems.
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Approach and Philosophy of On baking technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
MYSQL Presentation for SQL database connectivity
Modernizing your data center with Dell and AMD
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
“AI and Expert System Decision Support & Business Intelligence Systems”
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
Cloud computing and distributed systems.
Dropbox Q2 2025 Financial Results & Investor Presentation
Per capita expenditure prediction using model stacking based on satellite ima...
Mobile App Security Testing_ A Comprehensive Guide.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
NewMind AI Weekly Chronicles - August'25 Week I
Approach and Philosophy of On baking technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Chapter 3 Spatial Domain Image Processing.pdf
MYSQL Presentation for SQL database connectivity

Session 07 v.3

  • 1. • Click to edit Master text styles – Second level • Third level – Fourthg i t a l D e s i g n u s i n g V H D L D i level Session Seven » Fifth level Introduced by Cairo-Egypt Version 03 – June 2012 1
  • 2. about Start Group • Click to edit Master text styles Mahmoud Abdellatif – Second level Alaa Salah Shehata Mohamed level • Third Salah Mohamed Talaat – Fourth level » Fifth level start.courses@gmail.com www.slideshare.net/StartGroup www.facebook.com/groups/start.group www.startgroup.weebly.com Start.courses@gmail.com + 02 0122-4504158 M.A www.youtube.com/StartGroup2011 + 02 0128-0090250 A.S Session Six 2
  • 3. mini-Project Discussion • Click to edit Master text styles – Second level B(i)=[A(i)+C(i)]mod2 A(i) • Third B(i) Scrambler level – Fourth level » Fifth level Session Four 3
  • 4. Outline • Click to edit Master text styles – Second level • Third level Structural Description Generic Using Package 7 – Fourth level Generate Statement » Fifth level Session Seven 4
  • 5. Outline • Click to edit Master text styles Structural Description – Second level Generic • Third level Using Package – Fourth level Generate Statement » Fifth level Session Seven 5
  • 6. Structural Description • Click to edit Master textlevels Structural description allows having multiple styles – Second level of hierarchy in the design • Third Top- Down Design level – Fourth level The Design starts with the top-level block. This 8 bit » Fifth level design is then partitioned into lower-level blocks till Adder the root-level of your design is reached. Full Adder Half Adder Session Seven 6
  • 7. Structural Description • Click to edit Master text styles – Second level Bottom-Up Design • Third level Used when the design is very large. – Fourth level » Fifth level When using a bottom-up design methodology. the design begins with knowledge of the root and is then partitioned based on which primitives are available as leaf-nodes. Session Seven 7
  • 8. Structural Description [Component] • Click to edit Master text styles 1-Component Declaration – Second level The basic element of hirarichal design is component • <component_name> component Third level port ( <port_names>: <mode> <type>; – Fourth level <port_names>: <mode> <type>; …. » Fifth level ); end component; Component : Creates an instance of another entity. Note The definition of the component is like the definition of the entity. Component is Previously coded, simulated, synthesized and placed in design library Components are defined inside Architecture in Architecture Declaration before begin Session Seven 8
  • 9. Structural Description [Instantiation] 2-Component instantiation and Interconnections method 1 • Click to edit Master text styles instance_name: component_name – Second level port map (signal1,signal2,…); • Third level – Fourth level Each signal is written in the position that describe which port it belongs to which means that the » Fifth level first signal written here represent the first port in the component. That is named association-instantiation by position. Note if you needn't use special output port, Using the key word open (that mean this port will be unconnected). This method is easier but bad in readability. Session Seven 9
  • 10. Structural Description [Instantiation] 2-Component instantiation and Interconnections method 2 • Click to edit Master text styles <instance_name>: <component_name > – Second level port map( <port_name> => <sig_name>, • Third level <port_name> => <sig_name>, …. <port_name> – Fourth level => <sig_name> ); » Fifth level That is named instantiation by name. Order is not important. • The left part of the expression serve as name of port of the component • The right part of the expression serves as name of connected signal (or port of other component). Session Seven 10
  • 11. Example 25 Logic Gate • Click to edit Master text styles entity test is Port ( – Second level a : in STD_LOGIC; b : in STD_LOGIC; c : in STD_LOGIC; • Third level d : in STD_LOGIC; f : out STD_LOGIC); end test; – Fourth level » Fifth level architecture Behavioral of test is component or_gate is Port ( in1 : in STD_LOGIC; AND in2 : in STD_LOGIC; gate OR out_or : out STD_LOGIC); gate end component ; AND gate component and_gate is Port ( in1 : in STD_LOGIC; in2 : in STD_LOGIC; out_and : out STD_LOGIC); end component; Session Seven 11
  • 12. Example 25 Logic Gate • Click to edit Master text styles – Second level … • Third level signal sig1,sig2 : std_logic; begin – Fourth level u1:and_gate » Fifth level port map (a,b,sig1); u2:and_gate AND port map (c,d,sig2); gate OR u3:or_gate gate AND port map (sig1,sig2,f); gate end Behavioral; Session Seven 12
  • 13. Example 26 Logic Gate • Click to edit Master text styles entity test is Port ( – Second level a : in STD_LOGIC; b : in STD_LOGIC; c : in STD_LOGIC; • Third level d : in STD_LOGIC; f : out STD_LOGIC); end test; – Fourth level » Fifth level architecture Behavioral of test is component or_gate is Port ( in1 : in STD_LOGIC; AND in2 : in STD_LOGIC; gate OR out_or : out STD_LOGIC); gate end component ; AND gate component and_gate is Port ( in1 : in STD_LOGIC; in2 : in STD_LOGIC; out_and : out STD_LOGIC); end component; Session Seven 13
  • 14. Example 26 Logic Gate • Click to edit Master text styles signal sig1,sig2 : std_logic; begin – Second level u1:and_gate • Third level port map ( in1 => a, – Fourth level in2 => b, out_and => sig1); » Fifth level u2:and_gate port map ( AND in1 => c, gate in2 => d, OR out_and => sig2); gate AND u3:or_gate gate port map ( in1 => sig1, in2 => sig2, out_or => f); end Behavioral; Session Seven 14
  • 15. Lab 09 • Click to edit Master text styles Title: Goal: – Second level Using Structural Description •  ThirdXilinx to Generate Instantiations Using level  Using Structural Described codes – Fourth level » Fifth level Session Seven 15
  • 16. Lab 09 • Click to edit Master text styles – Second level Entity comp4 is port ( • Third level a , b : in std_logic_vector(3 downto 0); eq : out std_logic ); End comp4 ; – Fourth level Architecture struct of comp4 is » Fifth level Component xnor_2 is port ( g , f : in std_logic ; y : out std_logic ); End component ; Component and_4 is port ( in1,in2,in3,in4 :in std_logic; out1 : out std_logic ); End component ; … Session Seven 16
  • 17. Lab 09 • Click to edit Master text styles … – Second level • Third level Signal x : std_logic_vector ( 3 downto 0 ) ; Begin – Fourth level U1 : xnor_2 port map (»a(0) ,level , x(0) ) ; U2 : Fifth b(0) xnor_2 port map ( a(1) , b(1) , x(1) ) ; U3 : xnor_2 port map ( a(2) , b(2) , x(2) ) ; U4 : xnor_2 port map ( a(3) , b(3) , x(3) ) ; U5 : and_4 port map ( x(0) , x(1) , x(2) , x(3) , eq ) ; End struct ; Session Seven 17
  • 18. Outline • Click to edit Master text styles Structural Description – Second level Generic • Third level Using Package – Fourth level Generate Statement » Fifth level Session Seven 18
  • 19. Generic • Click to edit Master text styles VHDL provides an easy way to create generic design units that can be used several times with different properties in the design hierarchy – Second level Syntax • Third level – Fourth level generic ( <identifier>: level [:= default_value]; » Fifth type <identifier>: type [:= default_value]) ); 4-bit counter N-bit counter 8-bit counter Session Seven 19
  • 20. Example 27 Logic Gate • Click to edit Master text styles AND – Second level library IEEE; gate • Third level use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; – Fourth level use IEEE.STD_LOGIC_UNSIGNED.ALL; Entity generic_and » Fifth level is generic (N : integer := 4 ); port(A, B : in std_logic_vector (N-1 downto 0); Z : out std_logic_vector(N-1 downto 0) ); End entity; Architecture behave of generic_and is Begin Z <= A and B; End architecture Session Seven 20
  • 21. Example 28 N-bit Full Adder C_in • Click to edit Master text styles – Second level A N bit Sum • Third level Full Adder Entity F_adder – Fourth level is B Generic ( N : integer := 4 ); Port ( » Fifth level A, B : in std_logic_vector(N-1 downto 0); C_in : in std_logic ; C_out Sum : out std_logic_vector(N-1 downto 0); C_out : out std_logic ) ; End F_adder ; … Session Seven 21
  • 22. Example 28 N-bit Full Adder C_in • Click to edit Master text styles Architecture struct of f_adder is – Second level Component n_adder Generic ( N : integer := 4 ); A N bit Sum Port ( • Third level A,B : in std_logic_vector(N-1 downto 0); Full Adder C_in : in – Fourth level std_logic ; B Sum : out std_logic_vector(N-1 downto 0); » Fifth level C_out : out std_logic ); End component ; C_out Begin U1 : n_adder generic map (8) port map ( A => A, B => B , c_in => C_in , sum => Sun , c_out => C_out); End struct Session Seven 22
  • 23. Outline • Click to edit Master text styles Structural Description – Second level Generic • Third level Using Package – Fourth level Generate Statement » Fifth level Session Seven 23
  • 24. Using Packages • Click to edit Master text styles Instead of declaring all components can declare all components in a PACKAGE, and INCLUDE the package once – Second level 1) This makes the top-level entity code cleaner • Third level 2) It also allows that complete package to be used by another designer – Fourth level A package can contain » Fifth level 1) Components 2) Functions, Procedures 3) Types, Constants Session Seven 24
  • 25. Example 29 Logic circuit using package • Click to edit Master text styles library IEEE; use IEEE.STD_LOGIC_1164.ALL; – Second level use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; • Third level package logic_circuit is – Fourth component or_gate is level Port ( in1 : in STD_LOGIC; in2 : in » Fifth level STD_LOGIC; out_or : out STD_LOGIC); end component ; AND gate component and_gate is OR Port ( in1 : in STD_LOGIC; gate in2 : in STD_LOGIC; AND out_and : out STD_LOGIC); gate end component; constant const1: STD_LOGIC_vector (3 downto 0) := "0011"; constant const1: STD_LOGIC_vector (3 downto 0) := "0011"; ---const definition end logic_circuit; Session Seven 25
  • 26. Example 29 Logic circuit using package • Click to edit Master text styles library IEEE; . – Second level use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; u1:and_gate port map ( in1 => a, • Third level use IEEE.STD_LOGIC_UNSIGNED.ALL; use work.logic_circuit.all; in2 => b, out_and => sig1); – Fourth level entity test is u2:and_gate port map ( Port ( » Fifth level in1 => c, a : in STD_LOGIC; in2 => d, b : in STD_LOGIC; out_and => sig2); c : in STD_LOGIC; d : in STD_LOGIC; u3:or_gate port map ( Out1 : out STD_LOGIC_vector (3 downto 0); in1 => sig1, f : out STD_LOGIC); in2 => sig2, end test; out_or => f); architecture Behavioral of test is out1<= const1; signal sig1,sig2 : std_logic; begin . end Behavioral; Session Seven 26
  • 27. Outline • Click to edit Master text styles Structural Description – Second level Generic • Third level Using Package – Fourth level Generate Statement » Fifth level Session Seven 27
  • 28. Generate Statement • Click to edit Master text styles The generate statement simplifies description of regular design structures. Usually it is used to – Second level specify a group of identical components using just one component specification and repeating it using the generate mechanism. • Third level Declaration – Fourth level Label : for identifier IN range » Fifth level GENERATE (concurrent assignments) . . END GENERATE; Session Seven 28
  • 29. Example 30 SEREIS OF XOR GATES • Click to edit Master text styles – Second level • Third level – Fourth level » Fifth level ENTITY parity IS PORT( parity_in : IN STD_LOGIC_VECTOR(7 DOWNTO 0); parity_out : OUT STD_LOGIC ); END parity; Session Seven 29
  • 30. Example 30 SEREIS OF XOR GATES • Click xor_out(1) xor_out(2) to edit Master text styles xor_out(3) – Second level xor_out(4) xor_out(5) xor_out(6) • Third level – Fourth level » Fifth level xor_out(1) <= parity_in(0) XOR parity_in(1); xor_out(2) <= xor_out(1) XOR parity_in(2); xor_out(3) <= xor_out(2) XOR parity_in(3); xor_out(4) <= xor_out(3) XOR parity_in(4); xor_out(5) <= xor_out(4) XOR parity_in(5); xor_out(6) <= xor_out(5) XOR parity_in(6); parity_out <= xor_out(6) XOR parity_in(7); Session Seven 30
  • 31. Example 30 SEREIS OF XOR GATES • Click xor_out(1) xor_out(2) to edit Master text styles xor_out(3) – Second level xor_out(0) xor_out(4) xor_out(5) xor_out(6) • Third level xor_out(7) – Fourth level » Fifth level xor_out(0) <= parity_in(0); xor_out(1) <= xor_out(0) XOR parity_in(1); xor_out(2) <= xor_out(1) XOR parity_in(2); xor_out(3) <= xor_out(2) XOR parity_in(3); xor_out(4) <= xor_out(3) XOR parity_in(4); xor_out(5) <= xor_out(4) XOR parity_in(5); xor_out(6) <= xor_out(5) XOR parity_in(6); xor_out(7) <= xor_out(6) XOR parity_in(7); parity_out <= xor_out(7); Session Seven 31
  • 32. Example 30 SEREIS OF XOR GATES • Click to edit Master text styles – Second level ARCHITECTURE parity_dataflow OF parity IS SIGNAL xor_out: STD_LOGIC_VECTOR (7 DOWNTO 0); BEGIN • Third level xor_out(0) <= parity_in(0); – Fourth level G2: FOR i IN 1 TO 7 GENERATE » Fifth level xor_out(i) <= xor_out(i-1) XOR parity_in(i); END GENERATE G2; parity_out <= xor_out(7); END parity_dataflow; Session Seven 32
  • 33. Start Notes [Synthesis Notes] • Click to edit Master text styles architecture rtl of full adder Is – Second level Structural Description signal col .co2: std_logic; signal a_xor_b : std_logic; • Third level begin ul: entity work.half_adder(behave) In VHDL-93 standard, an – pair entity-architecture Fourth level port map (a,b.axorb.col); u2: entity work.half_adder(behave) may be directly » Fifth level port map( axorb,ci,s,co2); instantiated, i.e. component need not co< col or cO2; declared. This is easier. but not readably. end architecture rtl; Session Six 33
  • 34. Assignment 07 • Click to edit Master text styles Study Well for Next session’s Evaluation Test – Second level • Third level – Fourth level » Fifth level Session Seven 34
  • 35. Summary • Click to edit Master text styles - Structural description allows having multiple levels of hierarchy in the design - – Second level VHDL provides an easy way to create generic design units that can be used several times with different properties in the design hierarchy. - • Third level The generate statement used to specify a group of identical components using just one component specification and repeating it using the generate mechanism. – Fourth level » Fifth level Examples Exercises Labs 25-30 - 9 Session Seven 35
  • 36. Time for Your Questions • Click to edit Master text styles – Second level • Third level – Fourth level » Fifth level Session Seven 36
  • 37. Take Your Notes Print the slides and take your notes here -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- • Click to edit Master text styles -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- – Second level -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- • Third level -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- – Fourth level -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- » Fifth level -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------
  • 38. See You Next Session .. Don’t miss • Click to edit Master text styles Thank – Second level • Third level – Fourth level You » Fifth level