Download Fall2011 Workshop Handout
Transcript
8/29/2011 DFF dff1 LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; d ENTITY dff1 IS PORT ( d : IN STD_LOGIC; clk : IN STD_LOGIC; q : OUT STD_LOGIC ); END ENTITY dff1; ARCHITECTURE logic OF dff1 IS BEGIN PROCESS (clk) ( lk) BEGIN IF clk‘EVENT AND clk = '1' THEN q <= d; END IF; END PROCESS; END ARCHITECTURE behavior; D Q q clk ENA CLRN clk’EVENT AND clk=‘1’ – clk is the signal name (any name) – ’EVENT is a VHDL attribute, specifying that there needs To be a change in signal value – clk=‘1’ means positive-edge triggered 143 Types • VHDL has built‐in data types to model h d hardware (e.g. BIT, BOOLEAN, STD_LOGIC) ( BIT BOOLEAN STD LOGIC) • VHDL also allows creation of brand new types for declaring objects (i.e. constants, signals, variables) • Subtype • Enumerated Data Type • Array 144 72