11
Hardware design language ر ت و ی پ م ماری کا ع م ن ی ر م ت ل ح لاس ک1

An intro to VHDL

Embed Size (px)

Citation preview

Page 1: An intro to VHDL

1

Hardware design languageکالس حل تمرین معماری کامپیوتر

Page 2: An intro to VHDL

2

VHDL vs Verilog Verilog

Simpler Hard to switch Almost the same

VHDL VHSIC HDL Based on ADA Preferred by Americans

Just grammarian different!

Page 3: An intro to VHDL

3

Levels of abstractionBehavioral level

Register transfer levelGate level

layout

Page 4: An intro to VHDL

4

VHDL Structural Elements

Entity Architecture Process

library

Page 5: An intro to VHDL

5

Entity Interface description No behavior /

implementation definition

entity HALFADDER is   port(      A, B:                 in   bit;      SUM, CARRY: out bit);end entity HALFADDER;

entity ADDER is    port(      A, B:                 in     integer range 15 to 0;      SUM:               out integer range 15 to 0;      CARRY:           out bit );end ADDER;

Page 6: An intro to VHDL

6

architecture

entity HALFADDER is   port(      A, B:                in   bit;      SUM, CARRY: out bit);end HALFADDER;

architecture RTL of HALFADDER isbegin   SUM      <= A xor B;   CARRY <= A and B;end architecture RTL;

Implementation of the design Always connected with a specific

entity • one entity can have several

architectures • entity ports are available as

signals within the architecture Contains concurrent statements

Page 7: An intro to VHDL

7

Architecture Structure Declarative part Statement part (after 'begin')

architecture RTL  of  STRUCTURE  is   subtype DIGIT is integer range 0 to 9;   constant BASE: integer := 10;   signal DIGIT_A, DIGIT_B: DIGIT;   signal CARRY:                DIGIT;begin   DIGIT_A <= 3;   SUM <= DIGIT_A + DIGIT_B;   DIGIT_B <= 7;   CARRY <= 0 when SUM < BASE else                   1;end EXAMPLE ;

Page 8: An intro to VHDL

8

Entity Port Modes

in buffer inout out

Page 9: An intro to VHDL

9

Component Declaration entity FULLADDER is

   port (A,B, CARRY_IN: in   bit;           SUM, CARRY:     out bit);end FULLADDER;

architecture STRUCT of FULLADDER is

    component  HALFADDER      port (A, B :                in   bit;              SUM, CARRY : out bit);    end component;

    component  ORGATE      port (A, B : in   bit;              RES : out bit);    end component;begin   signal W_SUM, W_CARRY1, W_CARRY2 : bit;. . .

entity HALFADDER is   port(      A, B:                 in   bit;      SUM, CARRY: out bit);end entity HALFADDER;

entity ORGATE is   port(      A, B:                 in   bit;      RES: out bit);end entity ORGATE;

Page 10: An intro to VHDL

10

Component Instantiationarchitecture STRUCT of FULLADDER is

  component HALFADDER    port (A, B :                in   bit;            SUM, CARRY : out bit);  end component;  component ORGATE    port (A, B : in   bit;            RES : out bit);  end component;  signal W_SUM, W_CARRY1, W_CARRY2: bit;begin     MODULE1: HALFADDER     port map( A, B, W_SUM, W_CARRY1 );     MODULE2: HALFADDER     port map ( W_SUM, CARRY_IN, SUM, W_CARRY2 );     MODULE3: ORGATE     port map ( W_CARRY2, W_CARRY1, CARRY );

end STRUCT;

Page 11: An intro to VHDL

Thank you…