Introduction to VHDL Tutorial R E Haskell and

  • Slides: 18
Download presentation
Introduction to VHDL Tutorial R. E. Haskell and D. M. Hanna T 1: Combinational

Introduction to VHDL Tutorial R. E. Haskell and D. M. Hanna T 1: Combinational Logic Circuits

Introduction to VHDL is an acronym for VHSIC (Very High Speed Integrated Circuit) Hardware

Introduction to VHDL is an acronym for VHSIC (Very High Speed Integrated Circuit) Hardware Description Language IEEE standard specification language (IEEE 1076 -1993) for describing digital hardware used by industry worldwide VHDL enables hardware modeling from the gate level to the system level

Combinational Circuit Example 8 -line 2 -to-1 Multiplexer a(7: 0) b(7: 0) 8 -line

Combinational Circuit Example 8 -line 2 -to-1 Multiplexer a(7: 0) b(7: 0) 8 -line 2 x 1 MUX sel y(7: 0) sel 0 1 y a b

An 8 -line 2 x 1 MUX a(7: 0) 8 -line 2 x 1

An 8 -line 2 x 1 MUX a(7: 0) 8 -line 2 x 1 MUX library IEEE; use IEEE. std_logic_1164. all; b(7: 0) entity mux 2 is sel port ( a: in STD_LOGIC_VECTOR(7 downto 0); b: in STD_LOGIC_VECTOR(7 downto 0); sel: in STD_LOGIC; y: out STD_LOGIC_VECTOR(7 downto 0) ); end mux 2; y(7: 0)

Entity Each entity must begin with these library and use statements library IEEE; use

Entity Each entity must begin with these library and use statements library IEEE; use IEEE. std_logic_1164. all; entity mux 2 is port ( a: in STD_LOGIC_VECTOR(7 downto 0); b: in STD_LOGIC_VECTOR(7 downto 0); sel: in STD_LOGIC; y: out STD_LOGIC_VECTOR(7 downto 0) ); end mux 2; port statement defines inputs and outputs

Entity Mode: in or out library IEEE; use IEEE. std_logic_1164. all; entity mux 2

Entity Mode: in or out library IEEE; use IEEE. std_logic_1164. all; entity mux 2 is port ( a: in STD_LOGIC_VECTOR(7 downto 0); b: in STD_LOGIC_VECTOR(7 downto 0); sel: in STD_LOGIC; y: out STD_LOGIC_VECTOR(7 downto 0) ); end mux 2; Data type: STD_LOGIC, STD_LOGIC_VECTOR(7 downto 0);

Standard Logic library IEEE; use IEEE. std_logic_1164. all; type std_ulogic is ( ‘U’, ‘X’

Standard Logic library IEEE; use IEEE. std_logic_1164. all; type std_ulogic is ( ‘U’, ‘X’ ‘ 0’ ‘ 1’ ‘Z’ ‘W’ ‘L’ ‘H’ ‘-’); -- Uninitialized -- Forcing unknown -- Forcing zero -- Forcing one -- High impedance -- Weak unknown -- Weak zero -- Weak one -- Don’t care

Standard Logic Type std_ulogic is unresolved. Resolved signals provide a mechanism for handling the

Standard Logic Type std_ulogic is unresolved. Resolved signals provide a mechanism for handling the problem of multiple output signals connected to one signal. subtype std_logic is resolved std_ulogic;

Architecture architecture mux 2_arch of mux 2 is begin mux 2_1: process(a, b, sel)

Architecture architecture mux 2_arch of mux 2 is begin mux 2_1: process(a, b, sel) begin a(7: 0) if sel = '0' then y <= a; b(7: 0) else y <= b; end if; end process mux 2_1; end mux 2_arch; 8 -line 2 x 1 MUX y(7: 0) sel Note: <= is signal assignment

Architecture entity name process sensitivity architecture mux 2_arch of mux 2 is list begin

Architecture entity name process sensitivity architecture mux 2_arch of mux 2 is list begin mux 2_1: process(a, b, sel) begin Sequential statements if sel = '0' then (if…then…else) must y <= a; be in a process else y <= b; end if; end process mux 2_1; end mux 2_arch; Note begin…end in architecture Note begin…end in process

An 8 -line 4 x 1 multiplexer a(7: 0) b(7: 0) c(7: 0) d(7:

An 8 -line 4 x 1 multiplexer a(7: 0) b(7: 0) c(7: 0) d(7: 0) 8 -line 4 x 1 MUX sel(1: 0) y(7: 0) Sel “ 00” “ 01” “ 10” “ 11” y a b c d

An 8 -line 4 x 1 multiplexer library IEEE; use IEEE. std_logic_1164. all; entity

An 8 -line 4 x 1 multiplexer library IEEE; use IEEE. std_logic_1164. all; entity mux 4 is port ( a: in STD_LOGIC_VECTOR (7 downto 0); b: in STD_LOGIC_VECTOR (7 downto 0); c: in STD_LOGIC_VECTOR (7 downto 0); d: in STD_LOGIC_VECTOR (7 downto 0); sel: in STD_LOGIC_VECTOR (1 downto 0); y: out STD_LOGIC_VECTOR (7 downto 0) ); end mux 4;

Example of case statement architecture mux 4_arch of mux 4 is begin Note implies

Example of case statement architecture mux 4_arch of mux 4 is begin Note implies operator => process (sel, a, b, c, d) begin case sel is Sel y when "00" => y <= a; “ 00” a when "01" => y <= b; “ 01” b when "10" => y <= c; when others => y <= d; “ 10” c end case; “ 11” d end process; end mux 4_arch; Must include ALL posibilities in case statement

VHDL Architecture Structure architecture name_arch of name is Signal assignments begin Processes contain sequential

VHDL Architecture Structure architecture name_arch of name is Signal assignments begin Processes contain sequential Concurrent statements, but execute concurrently within the Process 1 architecture body Concurrent statements Process 2 Concurrent statements end name_arch;

VHDL Process P 1: process (<sensitivity list) <variable declarations> begin <sequential statements> end process

VHDL Process P 1: process (<sensitivity list) <variable declarations> begin <sequential statements> end process P 1; Within a process: Variables are assigned using : = Optional process label and are updated immediately. Signals are assigned using <= and are updated at the end of the process.

Lab Exercise T 1 Multiplexer Simulation using Aldec Active-HDL

Lab Exercise T 1 Multiplexer Simulation using Aldec Active-HDL