VHDL E, A, P: Entity - Name Signal - Name(s) Signal - Name(s) Entity - Name
VHDL E, A, P: Entity - Name Signal - Name(s) Signal - Name(s) Entity - Name
VHDL models consist of two major parts: 1) Entity declaration defines the I/O of the model 2) Architectural body describes the operation of the model Format of Entity declaration: entity entity_name is port(signal_name(s): mode signal_type; : signal_name(s): mode signal_type); end entity entity_name; signals of the same mode and signal_type can be grouped on 1 line MODE describes the direction data is transferred through port in data flows into the port out data flows out of port only buffer data flows out of port as well as internal feedback note: can be used for any output regardless of feedback inout bi-directional data flow into and out of port SIGNAL_TYPE defines the data type for the signal(s) bit single signals that can have logic values 0 and 1 bit_vector bus signals that can have logic values 0 and 1 std_logic same as bit but intended for standard simulation and synthesis (IEEE standard 1164) std_logic_vector same as bit_vector but IEEE standard for simulation and synthesis note that all vectors must have a range specified example for a 4 bit bus: bit_vector (3 downto 0) or std_logic_vector (3 downto 0) also note that there are many other types we will discuss later In order to use std_logic and std_logic_vector we must include the library and package usage declarations in the VHDL model before the entity statement as follows: library IEEE; use IEEE.std_logic_1164.all; Values for std-logic: U un-initialized (undefined logic value) X forced unknown logic value 0 1 Z high impedance (tri-state) W weak unknown L weak 0 H weak 1 dont care value (for synthesis minimization) Comments in VHDL are of the following format, the comment begins with the double dashes (no space between them) and continues to the end of the current line -- this is a syntactically correct VHDL comment
8/06
A 4
Cin Sum 4
Adder 4 B
Cout
8/06
D Q REG EN RST 4
8/06
8/06
Notes on the generic statement: Here we are using a new type (the integer type) for our identifier N and the immediate assignment operator for an integer is := We have included the optional assignment of a default value (:= 4). For synthesis of an individual VHDL model specifying a default value is needed But multiple calls to the same parameterized model using generics can specify any size for each instantiation of the model at the next higher level of hierarchy and the default value will be over-ridden The moral to the BIGLALA story: Whenever you can parameterize a VHDL model, you should do so!!! It allows easier design verification of a smaller function (use small generic values but verify different generic values) It promotes reuse of designs that have been verified and proven to work!!! This reduces design errors!!! It also facilitates optimized synthesis for area and/or performance when you have taken the time to do such optimization!!! Bottom line: it makes you a better designer!!!
8/06