prepared by P. Bakowski
Contents: std_logic_1164, logic system, resolution function (resolved), numeric packages
The development of complex models should be based on standard packages allowing the use of coherent data types and operators as well as the development of synthetisable descriptions.
The basic data types such as bit or bit_vector do not allow to cope with different meta-logic values required to represent different kinds of signals. A minimal logic to represent all operational aspects of hardware requires at least four states: '0', '1', 'X', and 'Z'. In addition the states such as 'L' for a weak '1' signal or 'H' for a weak '1' signal are required to represent the TTL like buses based on prioritairy logic.
The multiple-sources signals require resolution function. This function should operate on a set of standard signal values.
All this requirement are fulfilled by the standard IEEE package called std_logic_1164 . The std_logic_1164 package introduces 9-valued logic covering all characteristic states of hardware signals. It also provides a resolution function which operates on 9-valued logic signals.
type std_ulogic is (
'U', -- Uninitialized
'X', -- Forcing Unknown
'0', -- Forcing 0
'1', -- Forcing 1
'Z', -- High Impedance
'W', -- Weak Unknown
'L', -- Weak 0
'H', -- Weak 1
'-' -- Don't care
);
function resolved ( s : std_ulogic_vector ) return std_ulogic;
subtype std_logic is resolved std_ulogic;
library IEEE;
use IEEE.std_logic_1164.all;
signal rd: std_logic;
signal dbus: std_logic_vector(7 downto 0) := "ZZZZZZZZ";
Standard numeric packages
The arithmetical operations (-,-,*, ..) cannot be used with the vector types such as bit_vector or std_logic_vector. The modeler must provide the arithmetic functions for binary or standard logic vectors and overload the existing operators. In order to facilitate this prepartion and to unify the numerical functions provided for the arithmetical operators, two standard packages have been developed.
These packages offer standard numeric operators actually integrated into the synthesis tools.
When using the numeric_bit package and numeric_std package ,the logical vectors are seen as unsigned or signed numbers.
In addition the "numeric" packages provide necessary conversion functions such as:
and the functions required to detect rising and falling edges of the signals
use IEEE.numeric_std.all;
signal a,b,s; unsigned(7 downto 0);
...
s <= a + b; -- overloaded + operator
signal clk; std_logic:='0';
process(clk)
begin
if rising_edge(clk) then ...
Std_logic_1164 package
Title : std_logic_1164 multi-value logic system
Library : This package shall be compiled into a library symbolically named IEEE.
Developers: IEEE model standards group (par 1164)
Purpose : This packages defines a standard for designers to use in describing the interconnection data types used in vhdl modeling.
Limitation: The logic system defined in this package may be insufficient for modeling switched transistors, since such a requirement is out of the scope of this effort. Furthermore, mathematics, primitives, timing standards, etc. are considered orthogonal issues as it relates to this package and are therefore beyond the scope of this effort.
Note : No declarations or definitions shall be included in, or excluded from this package. The "package declaration" defines the types, subtypes and declarations of std_logic_1164. The std_logic_1164 package body shall be considered the formal definition of the semantics ofthis package. Tool developers may choose to implement the package body in the most efficient manner available to them
PACKAGE std_logic_1164 IS
-- logic state system (unresolved)
TYPE std_ulogic IS (