???? ?-VHDL - PowerPoint PPT Presentation

1 / 46
About This Presentation
Title:

???? ?-VHDL

Description:

Signal (???) Variable (?????) VHDL ???? ????? ??-????? ????? ... 1983: Intermetrics, IBM ?- Texas Instruments ??? ????? ?? ???? ????? ???????? (DoD) ?????? VHDL ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 47
Provided by: avshalo4
Category:

less

Transcript and Presenter's Notes

Title: ???? ?-VHDL


1
???? ?-VHDL
2
???? ?-VHDL
  • ??? ??? ????? ????? ???? ?? ?????
  • ?????, ????????, ??????
  • ?????? ??? VHDL
  • ?????
  • ??????
  • Process (?????)
  • Signal (???) Variable (?????)
  • ...
  • VHDL ???? ????? ??-????? ?????
  • ?????, ?????????, ????? ??????, ????? ????...

3
??? ??? ????? ????? ???? ?? ?????
4
????? ?????? ???????
  • ?? ?? ????? ??? ????? ???? ?????? ???????
  • ??????? ?????????
  • A B'C BC'
  • ????? ??????
  • ????? ??? ??????? ???? ????? ???? ?????? ???????
  • ???? ????? ????? ????VHDL ??????? ???????? ??
    ?????? ??????
  • ????? ?????? ???? ??????
  • ????? ????? ???? ????? ????? ????????? ??????
    ?????

5
????? ???? ????? ?????
  • ?????
  • ????? ??????
  • ????? ????
  • ????? ??????
  • ???? ????????? ?????? ???????
  • ?????? (synthesis)
  • ???? ???? ?????? ???? ????? ?????? (gate-level,
    netlist)
  • ?? ?? ??? VHDL ??? ????????? (???? ????? ????????)

6
VHDL
  • Hardware Description Language

VHSIC
Very High Speed Integrated Circuit
  • ??? ?????? ?????? ???????
  • 1983 Intermetrics, IBM ?- Texas Instruments ???
    ????? ?? ???? ????? ???????? (DoD) ?????? VHDL
  • 1985 ???? ?????
  • 1987, 1993 ??? ?? IEEE(Institute of Electrical
    and Electronics Engineers)
  • ???? HDL ?????
  • Verilog ????????? ????? ???? ??????
  • ABEL

7
?????? ??? VHDL
8
STD_LOGIC
  • Data type ????? ?????? ??? ????, ???? ???? ???
    ?-9 ????? ??????. ??????? ????
  • '0' ??? ????
  • '1' ??? ????
  • 'X' ??????? (?? ????)
  • 'Z' highZ
  • ????? ????? (???) ???? STD_LOGIC ??? my_bit
  • SIGNAL my_bit STD_LOGIC
  • STD_LOGIC_VECTOR ????? ?? ????? ???? STD_LOGIC
    ??????
  • SIGNAL vec1 STD_LOGIC_VECTOR(7 downto 0)

9
??? X ?-Z
  • ?????? ?? '0' ?-'1' ???? ?????? ????????? ??
    ?????? ???????
  • ???? ????? ???? ?"? ???? ????? ??? (????)

10
??? X ?-Z
  • ?????? ?? '0' ?-'1' ???? ?????? ????????? ??
    ?????? ???????
  • ???? ????? ???? ?"? ???? ????? ??? (????)

11
??? X ?-Z
  • ????? ?- tri-state buffers
  • ?? "??" (??? 0) ????? ????????? ?"? Z

12
Libraries and Packages
  • Libraries ?????? ???? ?? ????? ????? ?????????,
    ??? ????? ?? ????? ??????
  • Packages ?????? ???? ?? ???? ?????? ????????
  • ????? ?? ??? ?????? ??"? ???? ?? ???? VHDL
  • LIBRARY IEEE
  • USE IEEE.std_logic_1164.ALL
  • ?????? ????? ?????? IEEE ??????? ??? ??????
    std_logic_1164
  • ????? ?? ?????? ??? ???? ?? ???????? STD_LOGIC

13
Entities, Architectures and Configurations
  • ????? ?- VHDL (????? ?????? ????? ?????) ??????
    ?? ????? ??????? ??? ?????? ?????? ?? ??????
  • ?????? ?- VHDL ????? ?-
  • Entities
  • Architectures
  • Configurations

14
Entity
  • Entity ????? ???? ?????? ?? ????

-- nandgate entity describes interface of a --
nand gate ENTITY nandgate IS PORT ( a, b
IN STD_LOGIC -- inputs c OUT STD_LOGIC
) -- output END nandgate
Port List ????? ??????? ????????
15
Ports
  • ???? ?????? ??? entity ???????
  • ?? ???? Port
  • ????? ???????, ????? ?/?? ?? ?????, ????? ????
  • ???? ???? ??????? ??????/?????
  • ?????
  • IN ?????
  • OUT ?????
  • INOUT ??-??????
  • Port ???? ????? (?? ???????????? ?????)
  • ????? ?? port ?????? ?? ????? ????? ??
  • ?? ?? ????? ??? port

16
Architectures
  • Architecture ????? ?? ?????? ??????
  • ????? ??????
  • ARCHITECTURE beh OF nandgate IS
  • BEGIN
  • c lt NOT (a AND b)
  • END beh
  • ??? ????? ???????? (behavioral), ?????? ?? ?????
    ????, ??? ???????? ???

17
Architectures - ????
  • ???? ????? ???? ??????????? (??????? ???????
    ???????) ???? Entity ???
  • ???? ????? ????? ???? (structural) ??Entity
    nandgate
  • ????? ???? ????? ????? ???-?????? ????? ?????

18
  • ARCHITECTURE struct OF nandgate IS
  • SIGNAL my_sig STD_LOGIC
  • COMPONENT and2
  • PORT (x,y IN STD_LOGIC
  • z OUT STD_LOGIC)
  • END COMPONENT
  • COMPONENT inv
  • PORT (in1 IN STD_LOGIC
  • out1 OUT STD_LOGIC)
  • END COMPONENT
  • BEGIN
  • U1 and2
  • PORT MAP (xgta, ygtb, zgtmy_sig)
  • U2 inv
  • PORT MAP (in1gtmy_sig, out1gtc)
  • END struct

????? ????
instance list ????? ???-??????? ???????? ?? ?????
port map ????? ????? ?? ?-ports ?? ???-???????
???? ?????? ?? ????????? ?? ?????
????? x gt a Port x of sub-component and2 is
mapped to signal a, an input port of nandgate
19
????? ???????? ????? ????
  • ????? ????????
  • ??? ???????? ?????? ?? ?????
  • c lt NOT (a AND b)
  • ????? ????
  • ????? ??-?????? ????? ????? ???? ?? ???????

20
Configurations
  • ?????? ???? ??????????? ???? Entity ???
  • ??? ??? ????? ?????????? ???????
  • Configuration - ????? ??? Entity ???? ??????????
  • ?????? ???? ?-Architecture ?????? ????? ?-
    Entity
  • ??? ???? ????? ??? ????? ??? ????? ?-
    Configurations

21
Data Types
  • ???? ?????? ???? ?????? ?????. ??????
  • PACKAGE days_package IS
  • TYPE day_t IS (Sunday, Monday, Tuesday,
    Wednesday, Thursday, Friday, Saturday)
  • END days_package
  • ???? ??????package ??? ????? ????.
  • ??? ?-entity ???? ???? ?? ?????? ???? ?????
    ?-entity
  • USE WORK.days_package.ALL
  • ENTITY calendar IS
  • SIGNAL today day_t

22
?????????
  • ?-VHDL ??????? ???? ???? ?? ?????????. ????
    ??????? ???????
  • ????????? ?????? and or nand nor xor not
  • ????????? ?? ??? / lt lt gt gt
  • ????????? ????????? - /
  • ???? ??????? ???? std_logic

23
  • ????? ???????
  • ??????? ???? ????? ????? ????? 2

ENTITY add2 IS PORT (a, b IN
STD_LOGIC_VECTOR(1 downto 0) c
OUT STD_LOGIC_VECTOR(2 downto 0) ) END
add2 ARCHITECTURE behave OF add2 IS BEGIN c lt
a b END behave
  • ??? ?????? ?????? std_logic
  • ??-??? ???? std_logic ?? ????? ????? ??????
  • ???? ??? ?????

24
Awh, Behave!
25
????? ????
  • ????? ?????, ?????? ??????? ????? ?????
  • ?-VHDL, ?????? ?????? ???? ??????????????????
    ??????, ??-?????
  • ENTITY x_and_a IS
  • PORT ( y, z IN STD_LOGIC
  • b, c IN STD_LOGIC_VECTOR(7
    downto 0)
  • x OUT STD_LOGIC
  • a OUT STD_LOGIC_VECTOR(7 downto 0) )
  • END x_and_a
  • -- Both x and a are produced concurrently
  • ARCHITECTURE arc1 OF x_and_a IS
  • BEGIN
  • x lt y AND z
  • a lt b OR c
  • END arc1
  • ????? ??? ??????? ???????

26
???? ?? ??????
  • -- signals may be assigned constants
  • SIGNAL x, y, z STD_LOGIC
  • SIGNAL a, b, c STD_LOGIC_VECTOR( 7 DOWNTO 0)
  • x lt 0
  • y lt 1
  • z lt Z
  • a lt "00111010" -- Assigns 0x3A to a
  • b lt X"3A" -- Assigns 0x3A to b
  • c lt X"3" X"A" -- Assigns 0x3A to c
  • a(3) lt 1

27
????? ???? ??????
  • SIGNAL x, y, z STD_LOGIC
  • SIGNAL a, b, c STD_LOGIC_VECTOR( 7 DOWNTO 0)
  • SIGNAL sel STD_LOGIC_VECTOR( 2 DOWNTO 0)
  • -- Conditional Assignment Statement
  • -- NOTE This implements a tree structure of
    logic gates
  • x lt 0 WHEN sel 000 ELSE
  • y WHEN sel 011 ELSE
  • z WHEN x 1 ELSE
  • 1
  • -- Selected Signal Assignment Statement
  • -- NOTE The selection values must be constants
  • WITH sel SELECT
  • x lt 0 WHEN 000,
  • y WHEN 011,
  • z WHEN 100,
  • 1 WHEN OTHERS

28
?????Seven-Segment Display Controller
  • ???? dataIn ??? ????? ???? ????? ?????
  • ???? segments ??? ????? ?????? ???? ??????? ??
    ??????
  • ???? ????? '0' ??????? ?????? ????

29
(No Transcript)
30
????? Process Statement
  • ????? ????? ?????? ?-VHDL
  • ?????? ?????? ????? (???????) ?? ???
  • ?? ??? ??? ?????? ???? ?????? ?????? ?????????
    (sensitivity list)
  • ?????? ????? ????? ??? ??????? ????? ???? ?????
    ????? ?????
  • ?? ????? ???? ???????? ???? ??????
  • ??? ??? ?????? ????? ???? ????? ??? ???? (??
    ????? ??????? ??????)

Name process (sensitivity list)
declarations begin sequential
statements end process Name
31
????? ????? ?????
  • ???? ????? ?? ????? ????
  • ??????? ??? ???? ?? ???? ????
  • ?? ????? (????? ??????)
  • ???? ???? ??????
  • ?? ??? ??? ??????
  • ???? ????? ????? ????? ???????
  • ?????? ???? ??? ?? ???? ??? ?????? ?????? ???????
    ?????

do_stuff process (x, y, z) begin p lt y xor
z if (x 1) then q lt y and z else q
lt y or z end if end process do_stuff
32
???? ?????
  • ???? ??? ??? ???? VHDL
  • ?????? ?????? ????????? ?? ???????? ???? ??????
    ?????? a0, b1, c0 .
  • ???? ????? ??????a , b ?-c ????? ???? ???????
    ??"??

process (a,b,c) begin a lt 1 b lt 0
c lt a xor b a lt 0 end process
33
??????
  • ??? ?????? ????? ??????? ?-a
  • ????? a ?-b ????? ???? ??????, ??? c ????? ?"?
    ?????? ???????? ?? a ?-b
  • ??????? ???? ?? ???? ????? ?- a,b,c

process (a,b,c) begin a lt 1 b lt 0
c lt a xor b a lt 0 end process
c b a
????? '0' '1' '0'
??????? 1 '1' '0' '0'
??????? 2 '0' '0' '0'
??????? 3 '0' '0' '0'
34
Sequential Statements IF, CASE
  • -- Assume that the following ports exist for this
    entity
  • SIGNAL a, b, sel IN STD_LOGIC
  • SIGNAL x, y OUT STD_LOGIC
  • PROCESS (a, b, sel)
  • -- a, b, and sel are in the sensitivity list to
    indicate
  • -- that they are inputs to the process
  • BEGIN
  • IF (a 0) THEN -- Only valid in a process
  • x lt a OR b
  • ELSIF (b 0) THEN
  • x lt a XNOR b
  • ELSE
  • x lt 0
  • END IF
  • CASE sel IS -- Only valid in a process
  • WHEN 0 gt
  • y lt a AND b

35
??????? ??? ????
ARCHITECTURE my_arc OF my_ent IS BEGIN --
(simple) assignment statements x lt a xor (b or
c) -- assign x y lt -- assign y --
(complex) process statements proc1 PROCESS(s1,s2
..) -- assign p1, p2 p1 lt p2 lt
END PROCESS proc2 PROCESS(r1,r2 ..)
-- assign q1, q2, q3 q1 lt
q2 lt q3 lt END
PROCESS END my_arc
  • ????? ??? ???? ???? ???? ?????
  • ???? ???? ??????????
  • ????? ?????? ???? ????? ?????

36
??? ????? ????? ???? ???????
  • ????? ????? ????? ?????? ?????? ??????? ?????
  • ???? ????? ?? ???? ?????? ????
  • x lt a xor (b or c)
  • ????? ?????? ?? ???? ??????? ?????? ?????? ???
    (?????? ?????)

????
37
Sequential Statements Cont.
  • ?? ???? ????? ???? ?????? ??? ????? ELSE, ??????
    ????? ????? ?? ???? ?????
  • ???? ???? ?????? ?????? ?????? ??? ?? mux2
  • ?? ?? ???? ????
  • ??? ??????? ?????? ?? q
  • ???? ???? ????? ????? ???????, ?? ????? ?????
    ????? ?? ???? ????
  • ?? ?????? ???? ???? ??? ???? ????? ???????

ARCHITECTURE wrong OF mux2 IS BEGIN PROCESS (i0,
i1, sel) BEGIN IF (sel 0) THEN q lt
i0 END IF END PROCESS PROCESS(i0, i1,
sel) BEGIN IF (sel 1) THEN q lt i1
END IF END PROCESS END wrong
38
mux2 ?????
ARCHITECTURE right OF mux2 IS BEGIN PROCESS (i0,
i1, sel) BEGIN IF (sel 0) THEN q lt
i0 ELSE q lt Z END IF END
PROCESS PROCESS(i0, i1, sel) BEGIN IF
(sel 1) THEN q lt i1 ELSE q lt
Z END IF END PROCESS END right
  • ????? ELSE q lt Z
  • ???? ???? ????? ???? ?????? ?????? ????? Z ???
    ????? ?? ????? ????

39
????-????
  • ???? ????? ?????? ?????????? ???? FLIP-FLOP
    ????? ???? ?????
  • IF (clockEVENT) AND (clock1) THEN
  • ?????? ????? ??? ?? ????? ????? ???? ??? ????
    ?- '1' (????? ????? ???? ????).
  • ENTITY dff_async IS
  • PORT( clock, reset, din IN std_logic
  • dout OUT std_logic )
  • END dff_asynch
  • ARCHITECTURE arc_dff_async OF dff_async IS
  • BEGIN
  • PROCESS (reset, clock)
  • BEGIN
  • IF (reset 1) THEN
  • dout lt 0
  • ELSIF ) clockEVENT ( AND ) clock 1(
    THEN
  • dout lt din
  • END IF
  • END PROCESS

40
Variable - ?????
  • "??????" ????, ???? ?? ???? ?????
  • ?????
  • ARCHITECTURE arc_add OF add IS
  • BEGIN
  • PROCESS (a,b)
  • VARIABLE i INTEGER -- integer is a 32-bit
    data-type
  • BEGIN
  • FOR i IN 0 TO 3 LOOP
  • s(i) lt a(i) xor b(i)
  • END LOOP
  • END PROCESS
  • END arc_add

41
Signal (???) vs. Variable (?????)
  • ???? ????? ?? ??? ????
  • ????? ???? ??????
  • ???? ???? ?? ???? ??????
  • ???? sig lt sig 1 ??????? ???? ??????
  • PORT ??? ??-?? ?????
  • ???? ????? ?? ????? ??????? ??? ????
  • ????? ????? ?? ???? ?????
  • ??? ?? ?????? ???? ?????? (????? ?????? ?????
    ??????)
  • ???? var var 1 ??????? ????

42
Hierarchical design
  • --------------------------------------------------
    ----------------------
  • -- Single-bit adder
  • --------------------------------------------------
    ----------------------
  • library IEEE
  • use IEEE.std_logic_1164.all
  • entity adder is
  • port (a in std_logic
  • b in std_logic
  • cin in std_logic
  • sum out std_logic
  • cout out std_logic)
  • end adder
  • -- description of adder using concurrent signal
    assignments
  • architecture rtl of adder is
  • begin
  • sum lt (a xor b) xor cin
  • cout lt (a and b) or (cin and a) or (cin and
    b)

43
Hierarchical design (cont.)
  • --------------------------------------------------
    ----------------------
  • -- N-bit adder
  • -- The width of the adder is determined by
    generic N
  • --------------------------------------------------
    ----------------------
  • library IEEE
  • use IEEE.std_logic_1164.all
  • entity adderN is
  • generic(N integer 16)
  • port (a in std_logic_vector(N downto 1)
  • b in std_logic_vector(N downto 1)
  • cin in std_logic
  • sum out std_logic_vector(N downto
    1)
  • cout out std_logic)
  • end adderN

44
Hierarchical design (cont.)
  • -- structural implementation of the N-bit adder
  • architecture structural of adderN is
  • component adder
  • port (a in std_logic
  • b in std_logic
  • cin in std_logic
  • sum out std_logic
  • cout out std_logic)
  • end component
  • signal carry std_logic_vector(0 to N)
  • begin
  • carry(0) lt cin
  • cout lt carry(N)
  • -- instantiate a single-bit adder N times
  • gen for I in 1 to N generate
  • add adder port map(
  • a gt a(I),

45
VHDL ???? ????? ??-????? ?????
  • ??????? VHDL, ???? ?????? ??????? ?????? ??????
    ???????? ???? ????? ????-????? ?????? ?????
    ??????? ????
  • ????????? (abstraction)
  • ???? ????? ????? (?????????? ??? ??????)
  • ????? ???? (structural) ????????? (behavioral) ??
    ?????
  • ????? ??????? (hierarchical design)
  • ???? ?????
  • ??????????
  • ?????? ????????? (standard libraries and
    packages)
  • ????? ???? (design reuse)

46
?????? ??????
  • VHDL / Douglas Perry
  • Evita VHDL interactive Tutorial
  • Link on the course site
Write a Comment
User Comments (0)
About PowerShow.com