📄 std_logic_class.pkg
字号:
-- +------------------------------------
-- | Library: VFP
-- | Designer: Tim Pagden
-- | Opened: 25 Nov 1992
-- +------------------------------------
library IEEE;
package std_logic_class is
use IEEE.std_logic_1164.all;
-- extensions to IEEE.std_logic_1164
-- std_logic-related types defined in std_logic_1164
-- std_logic_class serves 2 purposes:
-- (i) to implement everything missing from std_logic_1164 (and numeric_std!)
-- (ii) to add additional vector-based types and functions
-- (i)
-- arithmetic operators
function "+" (a, b: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
function "+" (a, b: std_logic_vector) return std_logic_vector; -- 23.11.92
function "-" (a, b: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
function "*" (a, b: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
function "/" (a, b: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
function "mod" (a, b: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
function "rem" (a, b: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
function "**" (a, b: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
function "+" (a: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
function "-" (a: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
function "abs" (a: std_ulogic_vector) return std_ulogic_vector; -- 23.11.92
-- general purpose functions
function longest (a, b: std_ulogic_vector) return integer; -- 25.11.92
function longest (a, b: std_logic_vector) return integer; -- 25.11.92
-- hardware functions
function posedge (signal a: std_ulogic) return boolean; -- 04.12.92
function negedge (signal a: std_ulogic) return boolean; -- 04.12.92
-- mathematical functions
function log_2 (a: std_ulogic_vector) return integer; -- 15.11.95
-- (ii)
-- arithmetic array type definitions
-- std_ulogic is defined in std_logic_1164
-- arithmetic arrays of std_logic are defined in IEEE.numeric_std
type twos_complement is array (natural range <>) of std_ulogic; -- 27.02.93
type binary is array (natural range <>) of std_ulogic; -- 28.12.97
-- integer-range array type definitions
type vfp_ulogic is ('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-'); -- 28.12.97
type vfp_ulogic_vector is array (integer range <>) of vfp_ulogic; -- 28.12.97
type ulogic_2_vector is array (integer range <>) of std_ulogic_vector( 1 downto 0); -- 28.12.97
type ulogic_3_vector is array (integer range <>) of std_ulogic_vector( 2 downto 0); -- 28.12.97
type ulogic_4_vector is array (integer range <>) of std_ulogic_vector( 3 downto 0); -- 28.12.97
type ulogic_5_vector is array (integer range <>) of std_ulogic_vector( 4 downto 0); -- 28.12.97
type ulogic_6_vector is array (integer range <>) of std_ulogic_vector( 5 downto 0); -- 28.12.97
type ulogic_7_vector is array (integer range <>) of std_ulogic_vector( 6 downto 0); -- 28.12.97
type ulogic_8_vector is array (integer range <>) of std_ulogic_vector( 7 downto 0); -- 28.12.97
type ulogic_16_vector is array (integer range <>) of std_ulogic_vector(15 downto 0); -- 28.12.97
type ulogic_21_vector is array (integer range <>) of std_ulogic_vector(20 downto 0); -- 28.12.97
type ulogic_32_vector is array (integer range <>) of std_ulogic_vector(31 downto 0); -- 28.12.97
type nibble is array (3 downto 0) of std_ulogic; -- 30.09.93 type byte is array (7 downto 0) of std_ulogic; -- 30.09.93 type word is array (15 downto 0) of std_ulogic; -- 30.09.93 type dword is array (31 downto 0) of std_ulogic; -- 30.09.93
type qword is array (63 downto 0) of std_ulogic; -- 30.09.93 type byte_vector is array (integer range <>) of byte; -- 28.12.97
type word_vector is array (integer range <>) of word; -- 28.12.97
type dword_vector is array (integer range <>) of dword; -- 28.12.97
type qword_vector is array (integer range <>) of qword; -- 28.12.97
-- twos_complement functions
-- logical operators
function "not" (a: twos_complement) return twos_complement; -- 25.11.92
function "and" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "or" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "xor" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "nand" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "nor" (a, b: twos_complement) return twos_complement; -- 25.11.92
-- function "xnor" (a, b: twos_complement) return twos_complement; -- 25.11.92
-- arithmetic operators
function "+" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "-" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "*" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "/" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "mod" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "rem" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "**" (a, b: twos_complement) return twos_complement; -- 25.11.92
function "+" (a: twos_complement) return twos_complement; -- 25.11.92
function "-" (a: twos_complement) return twos_complement; -- 25.11.92
function "abs" (a: twos_complement) return twos_complement; -- 25.11.92
-- shift operators
-- general purpose functions
function longest (a, b: twos_complement) return integer; -- 20.03.92
function abs_wordlength (a: twos_complement) return integer; -- 20.03.92
-- hardware functions
-- none yet defined
-- mathematical functions
-- none yet defined
end std_logic_class;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -