- initial version
git-svn-id: http://moon:8086/svn/vhdl/trunk@1073 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
+3570
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,628 @@
|
||||
------------------------------------------------------------------------
|
||||
--
|
||||
-- Copyright 1996 by IEEE. All rights reserved.
|
||||
--
|
||||
-- This source file is an essential part of IEEE Std 1076.2-1996, IEEE Standard
|
||||
-- VHDL Mathematical Packages. This source file may not be copied, sold, or
|
||||
-- included with software that is sold without written permission from the IEEE
|
||||
-- Standards Department. This source file may be used to implement this standard
|
||||
-- and may be distributed in compiled form in any manner so long as the
|
||||
-- compiled form does not allow direct decompilation of the original source file.
|
||||
-- This source file may be copied for individual use between licensed users.
|
||||
-- This source file is provided on an AS IS basis. The IEEE disclaims ANY
|
||||
-- WARRANTY EXPRESS OR IMPLIED INCLUDING ANY WARRANTY OF MERCHANTABILITY
|
||||
-- AND FITNESS FOR USE FOR A PARTICULAR PURPOSE. The user of the source
|
||||
-- file shall indemnify and hold IEEE harmless from any damages or liability
|
||||
-- arising out of the use thereof.
|
||||
--
|
||||
-- Title: Standard VHDL Mathematical Packages (IEEE Std 1076.2-1996,
|
||||
-- MATH_REAL)
|
||||
--
|
||||
-- Library: This package shall be compiled into a library
|
||||
-- symbolically named IEEE.
|
||||
--
|
||||
-- Developers: IEEE DASC VHDL Mathematical Packages Working Group
|
||||
--
|
||||
-- Purpose: This package defines a standard for designers to use in
|
||||
-- describing VHDL models that make use of common REAL constants
|
||||
-- and common REAL elementary mathematical functions.
|
||||
--
|
||||
-- Limitation: The values generated by the functions in this package may
|
||||
-- vary from platform to platform, and the precision of results
|
||||
-- is only guaranteed to be the minimum required by IEEE Std 1076-
|
||||
-- 1993.
|
||||
--
|
||||
-- Notes:
|
||||
-- No declarations or definitions shall be included in, or
|
||||
-- excluded from, this package.
|
||||
-- The "package declaration" defines the types, subtypes, and
|
||||
-- declarations of MATH_REAL.
|
||||
-- The standard mathematical definition and conventional meaning
|
||||
-- of the mathematical functions that are part of this standard
|
||||
-- represent the formal semantics of the implementation of the
|
||||
-- MATH_REAL package declaration. The purpose of the MATH_REAL
|
||||
-- package body is to provide a guideline for implementations to
|
||||
-- verify their implementation of MATH_REAL. Tool developers may
|
||||
-- choose to implement the package body in the most efficient
|
||||
-- manner available to them.
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- Version : 1.5
|
||||
-- Date : 24 July 1996
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
package MATH_REAL is
|
||||
constant CopyRightNotice: STRING
|
||||
:= "Copyright 1996 IEEE. All rights reserved.";
|
||||
|
||||
--
|
||||
-- Constant Definitions
|
||||
--
|
||||
constant MATH_E : REAL := 2.71828_18284_59045_23536;
|
||||
-- Value of e
|
||||
constant MATH_1_OVER_E : REAL := 0.36787_94411_71442_32160;
|
||||
-- Value of 1/e
|
||||
constant MATH_PI : REAL := 3.14159_26535_89793_23846;
|
||||
-- Value of pi
|
||||
constant MATH_2_PI : REAL := 6.28318_53071_79586_47693;
|
||||
-- Value of 2*pi
|
||||
constant MATH_1_OVER_PI : REAL := 0.31830_98861_83790_67154;
|
||||
-- Value of 1/pi
|
||||
constant MATH_PI_OVER_2 : REAL := 1.57079_63267_94896_61923;
|
||||
-- Value of pi/2
|
||||
constant MATH_PI_OVER_3 : REAL := 1.04719_75511_96597_74615;
|
||||
-- Value of pi/3
|
||||
constant MATH_PI_OVER_4 : REAL := 0.78539_81633_97448_30962;
|
||||
-- Value of pi/4
|
||||
constant MATH_3_PI_OVER_2 : REAL := 4.71238_89803_84689_85769;
|
||||
-- Value 3*pi/2
|
||||
constant MATH_LOG_OF_2 : REAL := 0.69314_71805_59945_30942;
|
||||
-- Natural log of 2
|
||||
constant MATH_LOG_OF_10 : REAL := 2.30258_50929_94045_68402;
|
||||
-- Natural log of 10
|
||||
constant MATH_LOG2_OF_E : REAL := 1.44269_50408_88963_4074;
|
||||
-- Log base 2 of e
|
||||
constant MATH_LOG10_OF_E: REAL := 0.43429_44819_03251_82765;
|
||||
-- Log base 10 of e
|
||||
constant MATH_SQRT_2: REAL := 1.41421_35623_73095_04880;
|
||||
-- square root of 2
|
||||
constant MATH_1_OVER_SQRT_2: REAL := 0.70710_67811_86547_52440;
|
||||
-- square root of 1/2
|
||||
constant MATH_SQRT_PI: REAL := 1.77245_38509_05516_02730;
|
||||
-- square root of pi
|
||||
constant MATH_DEG_TO_RAD: REAL := 0.01745_32925_19943_29577;
|
||||
-- Conversion factor from degree to radian
|
||||
constant MATH_RAD_TO_DEG: REAL := 57.29577_95130_82320_87680;
|
||||
-- Conversion factor from radian to degree
|
||||
|
||||
--
|
||||
-- Function Declarations
|
||||
--
|
||||
function SIGN (X: in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns 1.0 if X > 0.0; 0.0 if X = 0.0; -1.0 if X < 0.0
|
||||
-- Special values:
|
||||
-- None
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- ABS(SIGN(X)) <= 1.0
|
||||
-- Notes:
|
||||
-- None
|
||||
|
||||
function CEIL (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns smallest INTEGER value (as REAL) not less than X
|
||||
-- Special values:
|
||||
-- None
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- CEIL(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) Implementations have to support at least the domain
|
||||
-- ABS(X) < REAL(INTEGER'HIGH)
|
||||
|
||||
function FLOOR (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns largest INTEGER value (as REAL) not greater than X
|
||||
-- Special values:
|
||||
-- FLOOR(0.0) = 0.0
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- FLOOR(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) Implementations have to support at least the domain
|
||||
-- ABS(X) < REAL(INTEGER'HIGH)
|
||||
|
||||
function ROUND (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Rounds X to the nearest integer value (as real). If X is
|
||||
-- halfway between two integers, rounding is away from 0.0
|
||||
-- Special values:
|
||||
-- ROUND(0.0) = 0.0
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- ROUND(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) Implementations have to support at least the domain
|
||||
-- ABS(X) < REAL(INTEGER'HIGH)
|
||||
|
||||
function TRUNC (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Truncates X towards 0.0 and returns truncated value
|
||||
-- Special values:
|
||||
-- TRUNC(0.0) = 0.0
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- TRUNC(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) Implementations have to support at least the domain
|
||||
-- ABS(X) < REAL(INTEGER'HIGH)
|
||||
|
||||
function "MOD" (X, Y: in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns floating point modulus of X/Y, with the same sign as
|
||||
-- Y, and absolute value less than the absolute value of Y, and
|
||||
-- for some INTEGER value N the result satisfies the relation
|
||||
-- X = Y*N + MOD(X,Y)
|
||||
-- Special values:
|
||||
-- None
|
||||
-- Domain:
|
||||
-- X in REAL; Y in REAL and Y /= 0.0
|
||||
-- Error conditions:
|
||||
-- Error if Y = 0.0
|
||||
-- Range:
|
||||
-- ABS(MOD(X,Y)) < ABS(Y)
|
||||
-- Notes:
|
||||
-- None
|
||||
|
||||
function REALMAX (X, Y : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns the algebraically larger of X and Y
|
||||
-- Special values:
|
||||
-- REALMAX(X,Y) = X when X = Y
|
||||
-- Domain:
|
||||
-- X in REAL; Y in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- REALMAX(X,Y) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- None
|
||||
|
||||
function REALMIN (X, Y : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns the algebraically smaller of X and Y
|
||||
-- Special values:
|
||||
-- REALMIN(X,Y) = X when X = Y
|
||||
-- Domain:
|
||||
-- X in REAL; Y in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- REALMIN(X,Y) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- None
|
||||
|
||||
procedure UNIFORM(variable SEED1,SEED2:inout POSITIVE; variable X:out REAL);
|
||||
-- Purpose:
|
||||
-- Returns, in X, a pseudo-random number with uniform
|
||||
-- distribution in the open interval (0.0, 1.0).
|
||||
-- Special values:
|
||||
-- None
|
||||
-- Domain:
|
||||
-- 1 <= SEED1 <= 2147483562; 1 <= SEED2 <= 2147483398
|
||||
-- Error conditions:
|
||||
-- Error if SEED1 or SEED2 outside of valid domain
|
||||
-- Range:
|
||||
-- 0.0 < X < 1.0
|
||||
-- Notes:
|
||||
-- a) The semantics for this function are described by the
|
||||
-- algorithm published by Pierre L'Ecuyer in "Communications
|
||||
-- of the ACM," vol. 31, no. 6, June 1988, pp. 742-774.
|
||||
-- The algorithm is based on the combination of two
|
||||
-- multiplicative linear congruential generators for 32-bit
|
||||
-- platforms.
|
||||
--
|
||||
-- b) Before the first call to UNIFORM, the seed values
|
||||
-- (SEED1, SEED2) have to be initialized to values in the range
|
||||
-- [1, 2147483562] and [1, 2147483398] respectively. The
|
||||
-- seed values are modified after each call to UNIFORM.
|
||||
--
|
||||
-- c) This random number generator is portable for 32-bit
|
||||
-- computers, and it has a period of ~2.30584*(10**18) for each
|
||||
-- set of seed values.
|
||||
--
|
||||
-- d) For information on spectral tests for the algorithm, refer
|
||||
-- to the L'Ecuyer article.
|
||||
|
||||
function SQRT (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns square root of X
|
||||
-- Special values:
|
||||
-- SQRT(0.0) = 0.0
|
||||
-- SQRT(1.0) = 1.0
|
||||
-- Domain:
|
||||
-- X >= 0.0
|
||||
-- Error conditions:
|
||||
-- Error if X < 0.0
|
||||
-- Range:
|
||||
-- SQRT(X) >= 0.0
|
||||
-- Notes:
|
||||
-- a) The upper bound of the reachable range of SQRT is
|
||||
-- approximately given by:
|
||||
-- SQRT(X) <= SQRT(REAL'HIGH)
|
||||
|
||||
function CBRT (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns cube root of X
|
||||
-- Special values:
|
||||
-- CBRT(0.0) = 0.0
|
||||
-- CBRT(1.0) = 1.0
|
||||
-- CBRT(-1.0) = -1.0
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- CBRT(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) The reachable range of CBRT is approximately given by:
|
||||
-- ABS(CBRT(X)) <= CBRT(REAL'HIGH)
|
||||
|
||||
function "**" (X : in INTEGER; Y : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns Y power of X ==> X**Y
|
||||
-- Special values:
|
||||
-- X**0.0 = 1.0; X /= 0
|
||||
-- 0**Y = 0.0; Y > 0.0
|
||||
-- X**1.0 = REAL(X); X >= 0
|
||||
-- 1**Y = 1.0
|
||||
-- Domain:
|
||||
-- X > 0
|
||||
-- X = 0 for Y > 0.0
|
||||
-- X < 0 for Y = 0.0
|
||||
-- Error conditions:
|
||||
-- Error if X < 0 and Y /= 0.0
|
||||
-- Error if X = 0 and Y <= 0.0
|
||||
-- Range:
|
||||
-- X**Y >= 0.0
|
||||
-- Notes:
|
||||
-- a) The upper bound of the reachable range for "**" is
|
||||
-- approximately given by:
|
||||
-- X**Y <= REAL'HIGH
|
||||
|
||||
function "**" (X : in REAL; Y : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns Y power of X ==> X**Y
|
||||
-- Special values:
|
||||
-- X**0.0 = 1.0; X /= 0.0
|
||||
-- 0.0**Y = 0.0; Y > 0.0
|
||||
-- X**1.0 = X; X >= 0.0
|
||||
-- 1.0**Y = 1.0
|
||||
-- Domain:
|
||||
-- X > 0.0
|
||||
-- X = 0.0 for Y > 0.0
|
||||
-- X < 0.0 for Y = 0.0
|
||||
-- Error conditions:
|
||||
-- Error if X < 0.0 and Y /= 0.0
|
||||
-- Error if X = 0.0 and Y <= 0.0
|
||||
-- Range:
|
||||
-- X**Y >= 0.0
|
||||
-- Notes:
|
||||
-- a) The upper bound of the reachable range for "**" is
|
||||
-- approximately given by:
|
||||
-- X**Y <= REAL'HIGH
|
||||
|
||||
function EXP (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns e**X; where e = MATH_E
|
||||
-- Special values:
|
||||
-- EXP(0.0) = 1.0
|
||||
-- EXP(1.0) = MATH_E
|
||||
-- EXP(-1.0) = MATH_1_OVER_E
|
||||
-- EXP(X) = 0.0 for X <= -LOG(REAL'HIGH)
|
||||
-- Domain:
|
||||
-- X in REAL such that EXP(X) <= REAL'HIGH
|
||||
-- Error conditions:
|
||||
-- Error if X > LOG(REAL'HIGH)
|
||||
-- Range:
|
||||
-- EXP(X) >= 0.0
|
||||
-- Notes:
|
||||
-- a) The usable domain of EXP is approximately given by:
|
||||
-- X <= LOG(REAL'HIGH)
|
||||
|
||||
function LOG (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns natural logarithm of X
|
||||
-- Special values:
|
||||
-- LOG(1.0) = 0.0
|
||||
-- LOG(MATH_E) = 1.0
|
||||
-- Domain:
|
||||
-- X > 0.0
|
||||
-- Error conditions:
|
||||
-- Error if X <= 0.0
|
||||
-- Range:
|
||||
-- LOG(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) The reachable range of LOG is approximately given by:
|
||||
-- LOG(0+) <= LOG(X) <= LOG(REAL'HIGH)
|
||||
|
||||
function LOG2 (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns logarithm base 2 of X
|
||||
-- Special values:
|
||||
-- LOG2(1.0) = 0.0
|
||||
-- LOG2(2.0) = 1.0
|
||||
-- Domain:
|
||||
-- X > 0.0
|
||||
-- Error conditions:
|
||||
-- Error if X <= 0.0
|
||||
-- Range:
|
||||
-- LOG2(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) The reachable range of LOG2 is approximately given by:
|
||||
-- LOG2(0+) <= LOG2(X) <= LOG2(REAL'HIGH)
|
||||
|
||||
function LOG10 (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns logarithm base 10 of X
|
||||
-- Special values:
|
||||
-- LOG10(1.0) = 0.0
|
||||
-- LOG10(10.0) = 1.0
|
||||
-- Domain:
|
||||
-- X > 0.0
|
||||
-- Error conditions:
|
||||
-- Error if X <= 0.0
|
||||
-- Range:
|
||||
-- LOG10(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) The reachable range of LOG10 is approximately given by:
|
||||
-- LOG10(0+) <= LOG10(X) <= LOG10(REAL'HIGH)
|
||||
|
||||
function LOG (X: in REAL; BASE: in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns logarithm base BASE of X
|
||||
-- Special values:
|
||||
-- LOG(1.0, BASE) = 0.0
|
||||
-- LOG(BASE, BASE) = 1.0
|
||||
-- Domain:
|
||||
-- X > 0.0
|
||||
-- BASE > 0.0
|
||||
-- BASE /= 1.0
|
||||
-- Error conditions:
|
||||
-- Error if X <= 0.0
|
||||
-- Error if BASE <= 0.0
|
||||
-- Error if BASE = 1.0
|
||||
-- Range:
|
||||
-- LOG(X, BASE) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) When BASE > 1.0, the reachable range of LOG is
|
||||
-- approximately given by:
|
||||
-- LOG(0+, BASE) <= LOG(X, BASE) <= LOG(REAL'HIGH, BASE)
|
||||
-- b) When 0.0 < BASE < 1.0, the reachable range of LOG is
|
||||
-- approximately given by:
|
||||
-- LOG(REAL'HIGH, BASE) <= LOG(X, BASE) <= LOG(0+, BASE)
|
||||
|
||||
function SIN (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns sine of X; X in radians
|
||||
-- Special values:
|
||||
-- SIN(X) = 0.0 for X = k*MATH_PI, where k is an INTEGER
|
||||
-- SIN(X) = 1.0 for X = (4*k+1)*MATH_PI_OVER_2, where k is an
|
||||
-- INTEGER
|
||||
-- SIN(X) = -1.0 for X = (4*k+3)*MATH_PI_OVER_2, where k is an
|
||||
-- INTEGER
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- ABS(SIN(X)) <= 1.0
|
||||
-- Notes:
|
||||
-- a) For larger values of ABS(X), degraded accuracy is allowed.
|
||||
|
||||
function COS ( X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns cosine of X; X in radians
|
||||
-- Special values:
|
||||
-- COS(X) = 0.0 for X = (2*k+1)*MATH_PI_OVER_2, where k is an
|
||||
-- INTEGER
|
||||
-- COS(X) = 1.0 for X = (2*k)*MATH_PI, where k is an INTEGER
|
||||
-- COS(X) = -1.0 for X = (2*k+1)*MATH_PI, where k is an INTEGER
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- ABS(COS(X)) <= 1.0
|
||||
-- Notes:
|
||||
-- a) For larger values of ABS(X), degraded accuracy is allowed.
|
||||
|
||||
function TAN (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns tangent of X; X in radians
|
||||
-- Special values:
|
||||
-- TAN(X) = 0.0 for X = k*MATH_PI, where k is an INTEGER
|
||||
-- Domain:
|
||||
-- X in REAL and
|
||||
-- X /= (2*k+1)*MATH_PI_OVER_2, where k is an INTEGER
|
||||
-- Error conditions:
|
||||
-- Error if X = ((2*k+1) * MATH_PI_OVER_2), where k is an
|
||||
-- INTEGER
|
||||
-- Range:
|
||||
-- TAN(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) For larger values of ABS(X), degraded accuracy is allowed.
|
||||
|
||||
function ARCSIN (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns inverse sine of X
|
||||
-- Special values:
|
||||
-- ARCSIN(0.0) = 0.0
|
||||
-- ARCSIN(1.0) = MATH_PI_OVER_2
|
||||
-- ARCSIN(-1.0) = -MATH_PI_OVER_2
|
||||
-- Domain:
|
||||
-- ABS(X) <= 1.0
|
||||
-- Error conditions:
|
||||
-- Error if ABS(X) > 1.0
|
||||
-- Range:
|
||||
-- ABS(ARCSIN(X) <= MATH_PI_OVER_2
|
||||
-- Notes:
|
||||
-- None
|
||||
|
||||
function ARCCOS (X : in REAL ) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns inverse cosine of X
|
||||
-- Special values:
|
||||
-- ARCCOS(1.0) = 0.0
|
||||
-- ARCCOS(0.0) = MATH_PI_OVER_2
|
||||
-- ARCCOS(-1.0) = MATH_PI
|
||||
-- Domain:
|
||||
-- ABS(X) <= 1.0
|
||||
-- Error conditions:
|
||||
-- Error if ABS(X) > 1.0
|
||||
-- Range:
|
||||
-- 0.0 <= ARCCOS(X) <= MATH_PI
|
||||
-- Notes:
|
||||
-- None
|
||||
|
||||
function ARCTAN (Y : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns the value of the angle in radians of the point
|
||||
-- (1.0, Y), which is in rectangular coordinates
|
||||
-- Special values:
|
||||
-- ARCTAN(0.0) = 0.0
|
||||
-- Domain:
|
||||
-- Y in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- ABS(ARCTAN(Y)) <= MATH_PI_OVER_2
|
||||
-- Notes:
|
||||
-- None
|
||||
|
||||
function ARCTAN (Y : in REAL; X : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns the principal value of the angle in radians of
|
||||
-- the point (X, Y), which is in rectangular coordinates
|
||||
-- Special values:
|
||||
-- ARCTAN(0.0, X) = 0.0 if X > 0.0
|
||||
-- ARCTAN(0.0, X) = MATH_PI if X < 0.0
|
||||
-- ARCTAN(Y, 0.0) = MATH_PI_OVER_2 if Y > 0.0
|
||||
-- ARCTAN(Y, 0.0) = -MATH_PI_OVER_2 if Y < 0.0
|
||||
-- Domain:
|
||||
-- Y in REAL
|
||||
-- X in REAL, X /= 0.0 when Y = 0.0
|
||||
-- Error conditions:
|
||||
-- Error if X = 0.0 and Y = 0.0
|
||||
-- Range:
|
||||
-- -MATH_PI < ARCTAN(Y,X) <= MATH_PI
|
||||
-- Notes:
|
||||
-- None
|
||||
|
||||
function SINH (X : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns hyperbolic sine of X
|
||||
-- Special values:
|
||||
-- SINH(0.0) = 0.0
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- SINH(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) The usable domain of SINH is approximately given by:
|
||||
-- ABS(X) <= LOG(REAL'HIGH)
|
||||
|
||||
|
||||
function COSH (X : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns hyperbolic cosine of X
|
||||
-- Special values:
|
||||
-- COSH(0.0) = 1.0
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- COSH(X) >= 1.0
|
||||
-- Notes:
|
||||
-- a) The usable domain of COSH is approximately given by:
|
||||
-- ABS(X) <= LOG(REAL'HIGH)
|
||||
|
||||
function TANH (X : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns hyperbolic tangent of X
|
||||
-- Special values:
|
||||
-- TANH(0.0) = 0.0
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- ABS(TANH(X)) <= 1.0
|
||||
-- Notes:
|
||||
-- None
|
||||
|
||||
function ARCSINH (X : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns inverse hyperbolic sine of X
|
||||
-- Special values:
|
||||
-- ARCSINH(0.0) = 0.0
|
||||
-- Domain:
|
||||
-- X in REAL
|
||||
-- Error conditions:
|
||||
-- None
|
||||
-- Range:
|
||||
-- ARCSINH(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) The reachable range of ARCSINH is approximately given by:
|
||||
-- ABS(ARCSINH(X)) <= LOG(REAL'HIGH)
|
||||
|
||||
function ARCCOSH (X : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns inverse hyperbolic cosine of X
|
||||
-- Special values:
|
||||
-- ARCCOSH(1.0) = 0.0
|
||||
-- Domain:
|
||||
-- X >= 1.0
|
||||
-- Error conditions:
|
||||
-- Error if X < 1.0
|
||||
-- Range:
|
||||
-- ARCCOSH(X) >= 0.0
|
||||
-- Notes:
|
||||
-- a) The upper bound of the reachable range of ARCCOSH is
|
||||
-- approximately given by: ARCCOSH(X) <= LOG(REAL'HIGH)
|
||||
|
||||
function ARCTANH (X : in REAL) return REAL;
|
||||
-- Purpose:
|
||||
-- Returns inverse hyperbolic tangent of X
|
||||
-- Special values:
|
||||
-- ARCTANH(0.0) = 0.0
|
||||
-- Domain:
|
||||
-- ABS(X) < 1.0
|
||||
-- Error conditions:
|
||||
-- Error if ABS(X) >= 1.0
|
||||
-- Range:
|
||||
-- ARCTANH(X) is mathematically unbounded
|
||||
-- Notes:
|
||||
-- a) The reachable range of ARCTANH is approximately given by:
|
||||
-- ABS(ARCTANH(X)) < LOG(REAL'HIGH)
|
||||
|
||||
end MATH_REAL;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
---------------------------------------------------------------
|
||||
--
|
||||
-- This source file may be used and distributed without restriction.
|
||||
-- No declarations or definitions shall be included in this package.
|
||||
-- This package cannot be sold or distributed for profit.
|
||||
--
|
||||
-- ****************************************************************
|
||||
-- * *
|
||||
-- * W A R N I N G *
|
||||
-- * *
|
||||
-- * This DRAFT version IS NOT endorsed or approved by IEEE *
|
||||
-- * *
|
||||
-- ****************************************************************
|
||||
--
|
||||
-- Title: PACKAGE MATH_COMPLEX
|
||||
--
|
||||
-- Purpose: VHDL declarations for mathematical package MATH_COMPLEX
|
||||
-- which contains common complex constants and basic complex
|
||||
-- functions and operations.
|
||||
--
|
||||
-- Author: IEEE VHDL Math Package Study Group
|
||||
--
|
||||
-- Notes:
|
||||
-- The package body uses package IEEE.MATH_REAL
|
||||
--
|
||||
-- The package body shall be considered the formal definition of
|
||||
-- the semantics of this package. Tool developers may choose to implement
|
||||
-- the package body in the most efficient manner available to them.
|
||||
--
|
||||
-- History:
|
||||
-- Version 0.1 (Strawman) Jose A. Torres 6/22/92
|
||||
-- Version 0.2 Jose A. Torres 1/15/93
|
||||
-- Version 0.3 Jose A. Torres 4/13/93
|
||||
-- Version 0.4 Jose A. Torres 4/19/93
|
||||
-- Version 0.5 Jose A. Torres 4/20/93
|
||||
-- Version 0.6 Jose A. Torres 4/23/93 Added unary minus
|
||||
-- and CONJ for polar
|
||||
-- Version 0.7 Jose A. Torres 5/28/93 Rev up for compatibility
|
||||
-- with package body.
|
||||
-------------------------------------------------------------
|
||||
Library IEEE;
|
||||
|
||||
Package MATH_COMPLEX is
|
||||
|
||||
|
||||
type COMPLEX is record RE, IM: real; end record;
|
||||
type COMPLEX_VECTOR is array (integer range <>) of COMPLEX;
|
||||
type COMPLEX_POLAR is record MAG: real; ARG: real; end record;
|
||||
|
||||
constant CBASE_1: complex := COMPLEX'(1.0, 0.0);
|
||||
constant CBASE_j: complex := COMPLEX'(0.0, 1.0);
|
||||
constant CZERO: complex := COMPLEX'(0.0, 0.0);
|
||||
|
||||
function CABS(Z: in complex ) return real;
|
||||
-- returns absolute value (magnitude) of Z
|
||||
|
||||
function CARG(Z: in complex ) return real;
|
||||
-- returns argument (angle) in radians of a complex number
|
||||
|
||||
function CMPLX(X: in real; Y: in real:= 0.0 ) return complex;
|
||||
-- returns complex number X + iY
|
||||
|
||||
function "-" (Z: in complex ) return complex;
|
||||
-- unary minus
|
||||
|
||||
function "-" (Z: in complex_polar ) return complex_polar;
|
||||
-- unary minus
|
||||
|
||||
function CONJ (Z: in complex) return complex;
|
||||
-- returns complex conjugate
|
||||
|
||||
function CONJ (Z: in complex_polar) return complex_polar;
|
||||
-- returns complex conjugate
|
||||
|
||||
function CSQRT(Z: in complex ) return complex_vector;
|
||||
-- returns square root of Z; 2 values
|
||||
|
||||
function CEXP(Z: in complex ) return complex;
|
||||
-- returns e**Z
|
||||
|
||||
function COMPLEX_TO_POLAR(Z: in complex ) return complex_polar;
|
||||
-- converts complex to complex_polar
|
||||
|
||||
function POLAR_TO_COMPLEX(Z: in complex_polar ) return complex;
|
||||
-- converts complex_polar to complex
|
||||
|
||||
|
||||
-- arithmetic operators
|
||||
|
||||
function "+" ( L: in complex; R: in complex ) return complex;
|
||||
function "+" ( L: in complex_polar; R: in complex_polar) return complex;
|
||||
function "+" ( L: in complex_polar; R: in complex ) return complex;
|
||||
function "+" ( L: in complex; R: in complex_polar) return complex;
|
||||
function "+" ( L: in real; R: in complex ) return complex;
|
||||
function "+" ( L: in complex; R: in real ) return complex;
|
||||
function "+" ( L: in real; R: in complex_polar) return complex;
|
||||
function "+" ( L: in complex_polar; R: in real) return complex;
|
||||
|
||||
function "-" ( L: in complex; R: in complex ) return complex;
|
||||
function "-" ( L: in complex_polar; R: in complex_polar) return complex;
|
||||
function "-" ( L: in complex_polar; R: in complex ) return complex;
|
||||
function "-" ( L: in complex; R: in complex_polar) return complex;
|
||||
function "-" ( L: in real; R: in complex ) return complex;
|
||||
function "-" ( L: in complex; R: in real ) return complex;
|
||||
function "-" ( L: in real; R: in complex_polar) return complex;
|
||||
function "-" ( L: in complex_polar; R: in real) return complex;
|
||||
|
||||
function "*" ( L: in complex; R: in complex ) return complex;
|
||||
function "*" ( L: in complex_polar; R: in complex_polar) return complex;
|
||||
function "*" ( L: in complex_polar; R: in complex ) return complex;
|
||||
function "*" ( L: in complex; R: in complex_polar) return complex;
|
||||
function "*" ( L: in real; R: in complex ) return complex;
|
||||
function "*" ( L: in complex; R: in real ) return complex;
|
||||
function "*" ( L: in real; R: in complex_polar) return complex;
|
||||
function "*" ( L: in complex_polar; R: in real) return complex;
|
||||
|
||||
|
||||
function "/" ( L: in complex; R: in complex ) return complex;
|
||||
function "/" ( L: in complex_polar; R: in complex_polar) return complex;
|
||||
function "/" ( L: in complex_polar; R: in complex ) return complex;
|
||||
function "/" ( L: in complex; R: in complex_polar) return complex;
|
||||
function "/" ( L: in real; R: in complex ) return complex;
|
||||
function "/" ( L: in complex; R: in real ) return complex;
|
||||
function "/" ( L: in real; R: in complex_polar) return complex;
|
||||
function "/" ( L: in complex_polar; R: in real) return complex;
|
||||
end MATH_COMPLEX;
|
||||
@@ -0,0 +1,211 @@
|
||||
------------------------------------------------------------------------
|
||||
--
|
||||
-- This source file may be used and distributed without restriction.
|
||||
-- No declarations or definitions shall be added to this package.
|
||||
-- This package cannot be sold or distributed for profit.
|
||||
--
|
||||
-- ****************************************************************
|
||||
-- * *
|
||||
-- * W A R N I N G *
|
||||
-- * *
|
||||
-- * This DRAFT version IS NOT endorsed or approved by IEEE *
|
||||
-- * *
|
||||
-- ****************************************************************
|
||||
--
|
||||
-- Title: PACKAGE MATH_REAL
|
||||
--
|
||||
-- Library: This package shall be compiled into a library
|
||||
-- symbolically named IEEE.
|
||||
--
|
||||
-- Purpose: VHDL declarations for mathematical package MATH_REAL
|
||||
-- which contains common real constants, common real
|
||||
-- functions, and real trascendental functions.
|
||||
--
|
||||
-- Author: IEEE VHDL Math Package Study Group
|
||||
--
|
||||
-- Notes:
|
||||
-- The package body shall be considered the formal definition of
|
||||
-- the semantics of this package. Tool developers may choose to implement
|
||||
-- the package body in the most efficient manner available to them.
|
||||
--
|
||||
-- History:
|
||||
-- Version 0.1 (Strawman) Jose A. Torres 6/22/92
|
||||
-- Version 0.2 Jose A. Torres 1/15/93
|
||||
-- Version 0.3 Jose A. Torres 4/13/93
|
||||
-- Version 0.4 Jose A. Torres 4/19/93
|
||||
-- Version 0.5 Jose A. Torres 4/20/93 Added RANDOM()
|
||||
-- Version 0.6 Jose A. Torres 4/23/93 Renamed RANDOM as
|
||||
-- UNIFORM. Modified
|
||||
-- rights banner.
|
||||
-- Version 0.7 Jose A. Torres 5/28/93 Rev up for compatibility
|
||||
-- with package body.
|
||||
-------------------------------------------------------------
|
||||
Library IEEE;
|
||||
|
||||
Package MATH_REAL is
|
||||
|
||||
--
|
||||
-- commonly used constants
|
||||
--
|
||||
constant MATH_E : real := 2.71828_18284_59045_23536;
|
||||
-- value of e
|
||||
constant MATH_1_E: real := 0.36787_94411_71442_32160;
|
||||
-- value of 1/e
|
||||
constant MATH_PI : real := 3.14159_26535_89793_23846;
|
||||
-- value of pi
|
||||
constant MATH_1_PI : real := 0.31830_98861_83790_67154;
|
||||
-- value of 1/pi
|
||||
constant MATH_LOG_OF_2: real := 0.69314_71805_59945_30942;
|
||||
-- natural log of 2
|
||||
constant MATH_LOG_OF_10: real := 2.30258_50929_94045_68402;
|
||||
-- natural log of10
|
||||
constant MATH_LOG2_OF_E: real := 1.44269_50408_88963_4074;
|
||||
-- log base 2 of e
|
||||
constant MATH_LOG10_OF_E: real := 0.43429_44819_03251_82765;
|
||||
-- log base 10 of e
|
||||
constant MATH_SQRT2: real := 1.41421_35623_73095_04880;
|
||||
-- sqrt of 2
|
||||
constant MATH_SQRT1_2: real := 0.70710_67811_86547_52440;
|
||||
-- sqrt of 1/2
|
||||
constant MATH_SQRT_PI: real := 1.77245_38509_05516_02730;
|
||||
-- sqrt of pi
|
||||
constant MATH_DEG_TO_RAD: real := 0.01745_32925_19943_29577;
|
||||
-- conversion factor from degree to radian
|
||||
constant MATH_RAD_TO_DEG: real := 57.29577_95130_82320_87685;
|
||||
-- conversion factor from radian to degree
|
||||
|
||||
--
|
||||
-- attribute for functions whose implementation is foreign (C native)
|
||||
--
|
||||
attribute FOREIGN : string; -- predefined attribute in VHDL-1992
|
||||
|
||||
--
|
||||
-- function declarations
|
||||
--
|
||||
function SIGN (X: real ) return real;
|
||||
-- returns 1.0 if X > 0.0; 0.0 if X == 0.0; -1.0 if X < 0.0
|
||||
|
||||
function CEIL (X : real ) return real;
|
||||
-- returns smallest integer value (as real) not less than X
|
||||
|
||||
function FLOOR (X : real ) return real;
|
||||
-- returns largest integer value (as real) not greater than X
|
||||
|
||||
function ROUND (X : real ) return real;
|
||||
-- returns integer FLOOR(X + 0.5) if X > 0;
|
||||
-- return integer CEIL(X - 0.5) if X < 0
|
||||
|
||||
function FMAX (X, Y : real ) return real;
|
||||
-- returns the algebraically larger of X and Y
|
||||
|
||||
function FMIN (X, Y : real ) return real;
|
||||
-- returns the algebraically smaller of X and Y
|
||||
|
||||
procedure UNIFORM (variable Seed1,Seed2:inout integer; variable X:out real);
|
||||
-- returns a pseudo-random number with uniform distribution in the
|
||||
-- interval (0.0, 1.0).
|
||||
-- Before the first call to UNIFORM, the seed values (Seed1, Seed2) must
|
||||
-- be initialized to values in the range [1, 2147483562] and
|
||||
-- [1, 2147483398] respectively. The seed values are modified after
|
||||
-- each call to UNIFORM.
|
||||
-- This random number generator is portable for 32-bit computers, and
|
||||
-- it has period ~2.30584*(10**18) for each set of seed values.
|
||||
--
|
||||
-- For VHDL-1992, the seeds will be global variables, functions to
|
||||
-- initialize their values (INIT_SEED) will be provided, and the UNIFORM
|
||||
-- procedure call will be modified accordingly.
|
||||
|
||||
function SRAND (seed: in integer ) return integer;
|
||||
--
|
||||
-- sets value of seed for sequence of
|
||||
-- pseudo-random numbers.
|
||||
-- It uses the foreign native C function srand().
|
||||
attribute FOREIGN of SRAND : function is "C_NATIVE";
|
||||
|
||||
function RAND return integer;
|
||||
--
|
||||
-- returns an integer pseudo-random number with uniform distribution.
|
||||
-- It uses the foreign native C function rand().
|
||||
-- Seed for the sequence is initialized with the
|
||||
-- SRAND() function and value of the seed is changed every
|
||||
-- time SRAND() is called, but it is not visible.
|
||||
-- The range of generated values is platform dependent.
|
||||
attribute FOREIGN of RAND : function is "C_NATIVE";
|
||||
|
||||
function GET_RAND_MAX return integer;
|
||||
--
|
||||
-- returns the upper bound of the range of the
|
||||
-- pseudo-random numbers generated by RAND().
|
||||
-- The support for this function is platform dependent, and
|
||||
-- it uses foreign native C functions or constants.
|
||||
-- It may not be available in some platforms.
|
||||
-- Note: the value of (RAND() / GET_RAND_MAX()) is a
|
||||
-- pseudo-random number distributed between 0 & 1.
|
||||
attribute FOREIGN of GET_RAND_MAX : function is "C_NATIVE";
|
||||
|
||||
function SQRT (X : real ) return real;
|
||||
-- returns square root of X; X >= 0
|
||||
|
||||
function CBRT (X : real ) return real;
|
||||
-- returns cube root of X
|
||||
|
||||
function "**" (X : integer; Y : real) return real;
|
||||
-- returns Y power of X ==> X**Y;
|
||||
-- error if X = 0 and Y <= 0.0
|
||||
-- error if X < 0 and Y does not have an integer value
|
||||
|
||||
function "**" (X : real; Y : real) return real;
|
||||
-- returns Y power of X ==> X**Y;
|
||||
-- error if X = 0.0 and Y <= 0.0
|
||||
-- error if X < 0.0 and Y does not have an integer value
|
||||
|
||||
function EXP (X : real ) return real;
|
||||
-- returns e**X; where e = MATH_E
|
||||
|
||||
function LOG (X : real ) return real;
|
||||
-- returns natural logarithm of X; X > 0
|
||||
|
||||
function LOG (BASE: positive; X : real) return real;
|
||||
-- returns logarithm base BASE of X; X > 0
|
||||
|
||||
function SIN (X : real ) return real;
|
||||
-- returns sin X; X in radians
|
||||
|
||||
function COS ( X : real ) return real;
|
||||
-- returns cos X; X in radians
|
||||
|
||||
function TAN (X : real ) return real;
|
||||
-- returns tan X; X in radians
|
||||
-- X /= ((2k+1) * PI/2), where k is an integer
|
||||
|
||||
function ASIN (X : real ) return real;
|
||||
-- returns -PI/2 < asin X < PI/2; | X | <= 1
|
||||
|
||||
function ACOS (X : real ) return real;
|
||||
-- returns 0 < acos X < PI; | X | <= 1
|
||||
|
||||
function ATAN (X : real) return real;
|
||||
-- returns -PI/2 < atan X < PI/2
|
||||
|
||||
function ATAN2 (X : real; Y : real) return real;
|
||||
-- returns atan (X/Y); -PI < atan2(X,Y) < PI; Y /= 0.0
|
||||
|
||||
function SINH (X : real) return real;
|
||||
-- hyperbolic sine; returns (e**X - e**(-X))/2
|
||||
|
||||
function COSH (X : real) return real;
|
||||
-- hyperbolic cosine; returns (e**X + e**(-X))/2
|
||||
|
||||
function TANH (X : real) return real;
|
||||
-- hyperbolic tangent; -- returns (e**X - e**(-X))/(e**X + e**(-X))
|
||||
|
||||
function ASINH (X : real) return real;
|
||||
-- returns ln( X + sqrt( X**2 + 1))
|
||||
|
||||
function ACOSH (X : real) return real;
|
||||
-- returns ln( X + sqrt( X**2 - 1)); X >= 1
|
||||
|
||||
function ATANH (X : real) return real;
|
||||
-- returns (ln( (1 + X)/(1 - X)))/2 ; | X | < 1
|
||||
|
||||
end MATH_REAL;
|
||||
@@ -0,0 +1,813 @@
|
||||
-- ----------------------------------------------------------------------------
|
||||
--
|
||||
-- Copyright 1995 by IEEE. All rights reserved.
|
||||
--
|
||||
--This source file is considered by the IEEE to be an essential part of the use
|
||||
-- of the standard 1076.3 and as such may be distributed without change, except
|
||||
--as permitted by the standard. This source file may not be sold or distributed
|
||||
-- for profit. This package may be modified to include additional data required
|
||||
-- by tools, but must in no way change the external interfaces or simulation
|
||||
-- behaviour of the description. It is permissible to add comments and/or
|
||||
-- attributes to the package declarations, but not to change or delete any
|
||||
-- original lines of the approved package declaration. The package body may be
|
||||
-- changed only in accordance with the terms of clauses 7.1 and 7.2 of the
|
||||
-- standard.
|
||||
--
|
||||
-- Title : Standard VHDL Synthesis Package (1076.3, NUMERIC_BIT)
|
||||
--
|
||||
-- Library : This package shall be compiled into a library symbolically
|
||||
-- : named IEEE.
|
||||
--
|
||||
-- Developers : IEEE DASC Synthesis Working Group, PAR 1076.3
|
||||
--
|
||||
-- Purpose : This package defines numeric types and arithmetic functions
|
||||
-- : for use with synthesis tools. Two numeric types are defined:
|
||||
-- : -- > UNSIGNED: represents an UNSIGNED number in vector form
|
||||
-- : -- > SIGNED: represents a SIGNED number in vector form
|
||||
-- : The base element type is type BIT.
|
||||
-- : The leftmost bit is treated as the most significant bit.
|
||||
-- : Signed vectors are represented in two's complement form.
|
||||
-- : This package contains overloaded arithmetic operators on
|
||||
-- : the SIGNED and UNSIGNED types. The package also contains
|
||||
-- : useful type conversions functions, clock detection
|
||||
-- : functions, and other utility functions.
|
||||
-- :
|
||||
-- : If any argument to a function is a null array, a null array is
|
||||
-- : returned (exceptions, if any, are noted individually).
|
||||
--
|
||||
-- Limitation :
|
||||
--
|
||||
-- Note : No declarations or definitions shall be included in,
|
||||
-- : or excluded from this package. The "package declaration"
|
||||
-- : defines the types, subtypes and declarations of
|
||||
-- : NUMERIC_BIT. The NUMERIC_BIT package body shall be
|
||||
-- : considered the formal definition of the semantics of
|
||||
-- : this package. Tool developers may choose to implement
|
||||
-- : the package body in the most efficient manner available
|
||||
-- : to them.
|
||||
-- :
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- Version : 2.4
|
||||
-- Date : 12 April 1995
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
||||
package NUMERIC_BIT is
|
||||
constant CopyRightNotice: STRING
|
||||
:= "Copyright 1995 IEEE. All rights reserved.";
|
||||
|
||||
--===========================================================================
|
||||
-- Numeric array type definitions
|
||||
--===========================================================================
|
||||
|
||||
type UNSIGNED is array (NATURAL range <> ) of BIT;
|
||||
type SIGNED is array (NATURAL range <> ) of BIT;
|
||||
|
||||
--===========================================================================
|
||||
-- Arithmetic Operators:
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.1
|
||||
function "abs" (ARG: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
|
||||
-- Result: Returns the absolute value of a SIGNED vector ARG.
|
||||
|
||||
-- Id: A.2
|
||||
function "-" (ARG: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
|
||||
-- Result: Returns the value of the unary minus operation on a
|
||||
-- SIGNED vector ARG.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.3
|
||||
function "+" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Adds two UNSIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.4
|
||||
function "+" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Adds two SIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.5
|
||||
function "+" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Adds an UNSIGNED vector, L, with a non-negative INTEGER, R.
|
||||
|
||||
-- Id: A.6
|
||||
function "+" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Adds a non-negative INTEGER, L, with an UNSIGNED vector, R.
|
||||
|
||||
-- Id: A.7
|
||||
function "+" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Adds an INTEGER, L(may be positive or negative), to a SIGNED
|
||||
-- vector, R.
|
||||
|
||||
-- Id: A.8
|
||||
function "+" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Adds a SIGNED vector, L, to an INTEGER, R.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.9
|
||||
function "-" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Subtracts two UNSIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.10
|
||||
function "-" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Subtracts a SIGNED vector, R, from another SIGNED vector, L,
|
||||
-- that may possibly be of different lengths.
|
||||
|
||||
-- Id: A.11
|
||||
function "-" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts a non-negative INTEGER, R, from an UNSIGNED vector, L.
|
||||
|
||||
-- Id: A.12
|
||||
function "-" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts an UNSIGNED vector, R, from a non-negative INTEGER, L.
|
||||
|
||||
-- Id: A.13
|
||||
function "-" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts an INTEGER, R, from a SIGNED vector, L.
|
||||
|
||||
-- Id: A.14
|
||||
function "-" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts a SIGNED vector, R, from an INTEGER, L.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.15
|
||||
function "*" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((L'LENGTH+R'LENGTH-1) downto 0).
|
||||
-- Result: Performs the multiplication operation on two UNSIGNED vectors
|
||||
-- that may possibly be of different lengths.
|
||||
|
||||
-- Id: A.16
|
||||
function "*" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED((L'LENGTH+R'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies two SIGNED vectors that may possibly be of
|
||||
-- different lengths.
|
||||
|
||||
-- Id: A.17
|
||||
function "*" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((L'LENGTH+L'LENGTH-1) downto 0).
|
||||
-- Result: Multiplies an UNSIGNED vector, L, with a non-negative
|
||||
-- INTEGER, R. R is converted to an UNSIGNED vector of
|
||||
-- size L'LENGTH before multiplication.
|
||||
|
||||
-- Id: A.18
|
||||
function "*" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((R'LENGTH+R'LENGTH-1) downto 0).
|
||||
-- Result: Multiplies an UNSIGNED vector, R, with a non-negative
|
||||
-- INTEGER, L. L is converted to an UNSIGNED vector of
|
||||
-- size R'LENGTH before multiplication.
|
||||
|
||||
-- Id: A.19
|
||||
function "*" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED((L'LENGTH+L'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies a SIGNED vector, L, with an INTEGER, R. R is
|
||||
-- converted to a SIGNED vector of size L'LENGTH before
|
||||
-- multiplication.
|
||||
|
||||
-- Id: A.20
|
||||
function "*" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED((R'LENGTH+R'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies a SIGNED vector, R, with an INTEGER, L. L is
|
||||
-- converted to a SIGNED vector of size R'LENGTH before
|
||||
-- multiplication.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "/" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.21
|
||||
function "/" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an UNSIGNED vector, L, by another UNSIGNED vector, R.
|
||||
|
||||
-- Id: A.22
|
||||
function "/" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an SIGNED vector, L, by another SIGNED vector, R.
|
||||
|
||||
-- Id: A.23
|
||||
function "/" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an UNSIGNED vector, L, by a non-negative INTEGER, R.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.24
|
||||
function "/" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Divides a non-negative INTEGER, L, by an UNSIGNED vector, R.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.25
|
||||
function "/" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides a SIGNED vector, L, by an INTEGER, R.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.26
|
||||
function "/" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Divides an INTEGER, L, by a SIGNED vector, R.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "rem" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.27
|
||||
function "rem" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L and R are UNSIGNED vectors.
|
||||
|
||||
-- Id: A.28
|
||||
function "rem" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L and R are SIGNED vectors.
|
||||
|
||||
-- Id: A.29
|
||||
function "rem" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L is an UNSIGNED vector and R is a
|
||||
-- non-negative INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.30
|
||||
function "rem" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where R is an UNSIGNED vector and L is a
|
||||
-- non-negative INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.31
|
||||
function "rem" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L is SIGNED vector and R is an INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.32
|
||||
function "rem" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where R is SIGNED vector and L is an INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "mod" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.33
|
||||
function "mod" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L and R are UNSIGNED vectors.
|
||||
|
||||
-- Id: A.34
|
||||
function "mod" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L and R are SIGNED vectors.
|
||||
|
||||
-- Id: A.35
|
||||
function "mod" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is an UNSIGNED vector and R
|
||||
-- is a non-negative INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.36
|
||||
function "mod" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where R is an UNSIGNED vector and L
|
||||
-- is a non-negative INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.37
|
||||
function "mod" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.38
|
||||
function "mod" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
-- Comparison Operators
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.1
|
||||
function ">" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.2
|
||||
function ">" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.3
|
||||
function ">" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.4
|
||||
function ">" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.5
|
||||
function ">" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.6
|
||||
function ">" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a SIGNED vector and
|
||||
-- R is a INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.7
|
||||
function "<" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.8
|
||||
function "<" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.9
|
||||
function "<" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.10
|
||||
function "<" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.11
|
||||
function "<" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.12
|
||||
function "<" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.13
|
||||
function "<=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.14
|
||||
function "<=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.15
|
||||
function "<=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.16
|
||||
function "<=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.17
|
||||
function "<=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.18
|
||||
function "<=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.19
|
||||
function ">=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.20
|
||||
function ">=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.21
|
||||
function ">=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.22
|
||||
function ">=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.23
|
||||
function ">=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.24
|
||||
function ">=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.25
|
||||
function "=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.26
|
||||
function "=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.27
|
||||
function "=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.28
|
||||
function "=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.29
|
||||
function "=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.30
|
||||
function "=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.31
|
||||
function "/=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.32
|
||||
function "/=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.33
|
||||
function "/=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.34
|
||||
function "/=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.35
|
||||
function "/=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.36
|
||||
function "/=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
-- Shift and Rotate Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: S.1
|
||||
function SHIFT_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-left on an UNSIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with Bit '0'.
|
||||
-- The COUNT leftmost bits are lost.
|
||||
|
||||
-- Id: S.2
|
||||
function SHIFT_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-right on an UNSIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with Bit '0'.
|
||||
-- The COUNT rightmost bits are lost.
|
||||
|
||||
-- Id: S.3
|
||||
function SHIFT_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-left on a SIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with Bit '0'.
|
||||
-- The COUNT leftmost bits, except ARG'LEFT, are lost.
|
||||
|
||||
-- Id: S.4
|
||||
function SHIFT_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-right on a SIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with the leftmost bit, ARG'LEFT.
|
||||
-- The COUNT rightmost bits are lost.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: S.5
|
||||
function ROTATE_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a rotate-left of an UNSIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.6
|
||||
function ROTATE_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a rotate-right of an UNSIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.7
|
||||
function ROTATE_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a logical rotate-left of a SIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.8
|
||||
function ROTATE_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a logical rotate-right of a SIGNED vector COUNT times.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.9 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.9
|
||||
function "sll" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.10 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.10
|
||||
function "sll" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.11 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.11
|
||||
function "srl" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_RIGHT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.12 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.12
|
||||
function "srl" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SIGNED(SHIFT_RIGHT(UNSIGNED(ARG), COUNT))
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.13 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.13
|
||||
function "rol" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.14 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.14
|
||||
function "rol" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.15 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.15
|
||||
function "ror" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_RIGHT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.16 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.16
|
||||
function "ror" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_RIGHT(ARG, COUNT)
|
||||
|
||||
--===========================================================================
|
||||
-- RESIZE Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: R.1
|
||||
function RESIZE (ARG: SIGNED; NEW_SIZE: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(NEW_SIZE-1 downto 0)
|
||||
-- Result: Resizes the SIGNED vector ARG to the specified size.
|
||||
-- To create a larger vector, the new [leftmost] bit positions
|
||||
-- are filled with the sign bit (ARG'LEFT). When truncating,
|
||||
-- the sign bit is retained along with the rightmost part.
|
||||
|
||||
-- Id: R.2
|
||||
function RESIZE (ARG: UNSIGNED; NEW_SIZE: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(NEW_SIZE-1 downto 0)
|
||||
-- Result: Resizes the UNSIGNED vector ARG to the specified size.
|
||||
-- To create a larger vector, the new [leftmost] bit positions
|
||||
-- are filled with '0'. When truncating, the leftmost bits
|
||||
-- are dropped.
|
||||
|
||||
--===========================================================================
|
||||
-- Conversion Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: D.1
|
||||
function TO_INTEGER (ARG: UNSIGNED) return NATURAL;
|
||||
-- Result subtype: NATURAL. Value cannot be negative since parameter is an
|
||||
-- UNSIGNED vector.
|
||||
-- Result: Converts the UNSIGNED vector to an INTEGER.
|
||||
|
||||
-- Id: D.2
|
||||
function TO_INTEGER (ARG: SIGNED) return INTEGER;
|
||||
-- Result subtype: INTEGER
|
||||
-- Result: Converts a SIGNED vector to an INTEGER.
|
||||
|
||||
-- Id: D.3
|
||||
function TO_UNSIGNED (ARG, SIZE: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(SIZE-1 downto 0)
|
||||
-- Result: Converts a non-negative INTEGER to an UNSIGNED vector with
|
||||
-- the specified size.
|
||||
|
||||
-- Id: D.4
|
||||
function TO_SIGNED (ARG: INTEGER; SIZE: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(SIZE-1 downto 0)
|
||||
-- Result: Converts an INTEGER to a SIGNED vector of the specified size.
|
||||
|
||||
--===========================================================================
|
||||
-- Logical Operators
|
||||
--===========================================================================
|
||||
|
||||
-- Id: L.1
|
||||
function "not" (L: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Termwise inversion
|
||||
|
||||
-- Id: L.2
|
||||
function "and" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector AND operation
|
||||
|
||||
-- Id: L.3
|
||||
function "or" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector OR operation
|
||||
|
||||
-- Id: L.4
|
||||
function "nand" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NAND operation
|
||||
|
||||
-- Id: L.5
|
||||
function "nor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NOR operation
|
||||
|
||||
-- Id: L.6
|
||||
function "xor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XOR operation
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function L.7 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: L.7
|
||||
function "xnor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XNOR operation
|
||||
|
||||
-- Id: L.8
|
||||
function "not" (L: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Termwise inversion
|
||||
|
||||
-- Id: L.9
|
||||
function "and" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector AND operation
|
||||
|
||||
-- Id: L.10
|
||||
function "or" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector OR operation
|
||||
|
||||
-- Id: L.11
|
||||
function "nand" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NAND operation
|
||||
|
||||
-- Id: L.12
|
||||
function "nor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NOR operation
|
||||
|
||||
-- Id: L.13
|
||||
function "xor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XOR operation
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function L.14 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: L.14
|
||||
function "xnor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XNOR operation
|
||||
|
||||
--===========================================================================
|
||||
-- Edge Detection Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: E.1
|
||||
function RISING_EDGE (signal S: BIT) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Returns TRUE if an event is detected on signal S and the
|
||||
-- value changed from a '0' to a '1'.
|
||||
|
||||
-- Id: E.2
|
||||
function FALLING_EDGE (signal S: BIT) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Returns TRUE if an event is detected on signal S and the
|
||||
-- value changed from a '1' to a '0'.
|
||||
|
||||
end NUMERIC_BIT;
|
||||
@@ -0,0 +1,853 @@
|
||||
-- --------------------------------------------------------------------
|
||||
--
|
||||
-- Copyright 1995 by IEEE. All rights reserved.
|
||||
--
|
||||
--This source file is considered by the IEEE to be an essential part of the use
|
||||
-- of the standard 1076.3 and as such may be distributed without change, except
|
||||
--as permitted by the standard. This source file may not be sold or distributed
|
||||
-- for profit. This package may be modified to include additional data required
|
||||
-- by tools, but must in no way change the external interfaces or simulation
|
||||
-- behaviour of the description. It is permissible to add comments and/or
|
||||
-- attributes to the package declarations, but not to change or delete any
|
||||
-- original lines of the approved package declaration. The package body may be
|
||||
-- changed only in accordance with the terms of clauses 7.1 and 7.2 of the
|
||||
-- standard.
|
||||
--
|
||||
-- Title : Standard VHDL Synthesis Package (1076.3, NUMERIC_STD)
|
||||
--
|
||||
-- Library : This package shall be compiled into a library symbolically
|
||||
-- : named IEEE.
|
||||
--
|
||||
-- Developers : IEEE DASC Synthesis Working Group, PAR 1076.3
|
||||
--
|
||||
-- Purpose : This package defines numeric types and arithmetic functions
|
||||
-- : for use with synthesis tools. Two numeric types are defined:
|
||||
-- : -- > UNSIGNED: represents UNSIGNED number in vector form
|
||||
-- : -- > SIGNED: represents a SIGNED number in vector form
|
||||
-- : The base element type is type STD_LOGIC.
|
||||
-- : The leftmost bit is treated as the most significant bit.
|
||||
-- : Signed vectors are represented in two's complement form.
|
||||
-- : This package contains overloaded arithmetic operators on
|
||||
-- : the SIGNED and UNSIGNED types. The package also contains
|
||||
-- : useful type conversions functions.
|
||||
-- :
|
||||
-- : If any argument to a function is a null array, a null array is
|
||||
-- : returned (exceptions, if any, are noted individually).
|
||||
--
|
||||
-- Limitation :
|
||||
--
|
||||
-- Note : No declarations or definitions shall be included in,
|
||||
-- : or excluded from this package. The "package declaration"
|
||||
-- : defines the types, subtypes and declarations of
|
||||
-- : NUMERIC_STD. The NUMERIC_STD package body shall be
|
||||
-- : considered the formal definition of the semantics of
|
||||
-- : this package. Tool developers may choose to implement
|
||||
-- : the package body in the most efficient manner available
|
||||
-- : to them.
|
||||
--
|
||||
-- --------------------------------------------------------------------
|
||||
-- modification history :
|
||||
-- --------------------------------------------------------------------
|
||||
-- Version: 2.4
|
||||
-- Date : 12 April 1995
|
||||
-- ----------------------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.all;
|
||||
|
||||
package NUMERIC_STD is
|
||||
constant CopyRightNotice: STRING
|
||||
:= "Copyright 1995 IEEE. All rights reserved.";
|
||||
|
||||
--===========================================================================
|
||||
-- Numeric array type definitions
|
||||
--===========================================================================
|
||||
|
||||
type UNSIGNED is array (NATURAL range <>) of STD_LOGIC;
|
||||
type SIGNED is array (NATURAL range <>) of STD_LOGIC;
|
||||
|
||||
--===========================================================================
|
||||
-- Arithmetic Operators:
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.1
|
||||
function "abs" (ARG: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
|
||||
-- Result: Returns the absolute value of a SIGNED vector ARG.
|
||||
|
||||
-- Id: A.2
|
||||
function "-" (ARG: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
|
||||
-- Result: Returns the value of the unary minus operation on a
|
||||
-- SIGNED vector ARG.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.3
|
||||
function "+" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Adds two UNSIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.4
|
||||
function "+" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Adds two SIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.5
|
||||
function "+" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Adds an UNSIGNED vector, L, with a non-negative INTEGER, R.
|
||||
|
||||
-- Id: A.6
|
||||
function "+" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Adds a non-negative INTEGER, L, with an UNSIGNED vector, R.
|
||||
|
||||
-- Id: A.7
|
||||
function "+" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Adds an INTEGER, L(may be positive or negative), to a SIGNED
|
||||
-- vector, R.
|
||||
|
||||
-- Id: A.8
|
||||
function "+" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Adds a SIGNED vector, L, to an INTEGER, R.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.9
|
||||
function "-" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Subtracts two UNSIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.10
|
||||
function "-" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Subtracts a SIGNED vector, R, from another SIGNED vector, L,
|
||||
-- that may possibly be of different lengths.
|
||||
|
||||
-- Id: A.11
|
||||
function "-" (L: UNSIGNED;R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts a non-negative INTEGER, R, from an UNSIGNED vector, L.
|
||||
|
||||
-- Id: A.12
|
||||
function "-" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts an UNSIGNED vector, R, from a non-negative INTEGER, L.
|
||||
|
||||
-- Id: A.13
|
||||
function "-" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts an INTEGER, R, from a SIGNED vector, L.
|
||||
|
||||
-- Id: A.14
|
||||
function "-" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts a SIGNED vector, R, from an INTEGER, L.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.15
|
||||
function "*" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((L'LENGTH+R'LENGTH-1) downto 0).
|
||||
-- Result: Performs the multiplication operation on two UNSIGNED vectors
|
||||
-- that may possibly be of different lengths.
|
||||
|
||||
-- Id: A.16
|
||||
function "*" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED((L'LENGTH+R'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies two SIGNED vectors that may possibly be of
|
||||
-- different lengths.
|
||||
|
||||
-- Id: A.17
|
||||
function "*" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((L'LENGTH+L'LENGTH-1) downto 0).
|
||||
-- Result: Multiplies an UNSIGNED vector, L, with a non-negative
|
||||
-- INTEGER, R. R is converted to an UNSIGNED vector of
|
||||
-- SIZE L'LENGTH before multiplication.
|
||||
|
||||
-- Id: A.18
|
||||
function "*" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((R'LENGTH+R'LENGTH-1) downto 0).
|
||||
-- Result: Multiplies an UNSIGNED vector, R, with a non-negative
|
||||
-- INTEGER, L. L is converted to an UNSIGNED vector of
|
||||
-- SIZE R'LENGTH before multiplication.
|
||||
|
||||
-- Id: A.19
|
||||
function "*" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED((L'LENGTH+L'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies a SIGNED vector, L, with an INTEGER, R. R is
|
||||
-- converted to a SIGNED vector of SIZE L'LENGTH before
|
||||
-- multiplication.
|
||||
|
||||
-- Id: A.20
|
||||
function "*" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED((R'LENGTH+R'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies a SIGNED vector, R, with an INTEGER, L. L is
|
||||
-- converted to a SIGNED vector of SIZE R'LENGTH before
|
||||
-- multiplication.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "/" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.21
|
||||
function "/" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an UNSIGNED vector, L, by another UNSIGNED vector, R.
|
||||
|
||||
-- Id: A.22
|
||||
function "/" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an SIGNED vector, L, by another SIGNED vector, R.
|
||||
|
||||
-- Id: A.23
|
||||
function "/" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an UNSIGNED vector, L, by a non-negative INTEGER, R.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.24
|
||||
function "/" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Divides a non-negative INTEGER, L, by an UNSIGNED vector, R.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.25
|
||||
function "/" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides a SIGNED vector, L, by an INTEGER, R.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.26
|
||||
function "/" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Divides an INTEGER, L, by a SIGNED vector, R.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "rem" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.27
|
||||
function "rem" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L and R are UNSIGNED vectors.
|
||||
|
||||
-- Id: A.28
|
||||
function "rem" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L and R are SIGNED vectors.
|
||||
|
||||
-- Id: A.29
|
||||
function "rem" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L is an UNSIGNED vector and R is a
|
||||
-- non-negative INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.30
|
||||
function "rem" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where R is an UNSIGNED vector and L is a
|
||||
-- non-negative INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.31
|
||||
function "rem" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L is SIGNED vector and R is an INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.32
|
||||
function "rem" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where R is SIGNED vector and L is an INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "mod" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.33
|
||||
function "mod" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L and R are UNSIGNED vectors.
|
||||
|
||||
-- Id: A.34
|
||||
function "mod" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L and R are SIGNED vectors.
|
||||
|
||||
-- Id: A.35
|
||||
function "mod" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is an UNSIGNED vector and R
|
||||
-- is a non-negative INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.36
|
||||
function "mod" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where R is an UNSIGNED vector and L
|
||||
-- is a non-negative INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.37
|
||||
function "mod" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.38
|
||||
function "mod" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
-- Comparison Operators
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.1
|
||||
function ">" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.2
|
||||
function ">" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.3
|
||||
function ">" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.4
|
||||
function ">" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.5
|
||||
function ">" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.6
|
||||
function ">" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a SIGNED vector and
|
||||
-- R is a INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.7
|
||||
function "<" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.8
|
||||
function "<" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.9
|
||||
function "<" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.10
|
||||
function "<" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.11
|
||||
function "<" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.12
|
||||
function "<" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.13
|
||||
function "<=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.14
|
||||
function "<=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.15
|
||||
function "<=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.16
|
||||
function "<=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.17
|
||||
function "<=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.18
|
||||
function "<=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.19
|
||||
function ">=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.20
|
||||
function ">=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.21
|
||||
function ">=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.22
|
||||
function ">=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.23
|
||||
function ">=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.24
|
||||
function ">=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.25
|
||||
function "=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.26
|
||||
function "=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.27
|
||||
function "=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.28
|
||||
function "=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.29
|
||||
function "=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.30
|
||||
function "=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.31
|
||||
function "/=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.32
|
||||
function "/=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.33
|
||||
function "/=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.34
|
||||
function "/=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.35
|
||||
function "/=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.36
|
||||
function "/=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
-- Shift and Rotate Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: S.1
|
||||
function SHIFT_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-left on an UNSIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with '0'.
|
||||
-- The COUNT leftmost elements are lost.
|
||||
|
||||
-- Id: S.2
|
||||
function SHIFT_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-right on an UNSIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with '0'.
|
||||
-- The COUNT rightmost elements are lost.
|
||||
|
||||
-- Id: S.3
|
||||
function SHIFT_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-left on a SIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with '0'.
|
||||
-- The COUNT leftmost elements are lost.
|
||||
|
||||
-- Id: S.4
|
||||
function SHIFT_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-right on a SIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with the leftmost
|
||||
-- element, ARG'LEFT. The COUNT rightmost elements are lost.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: S.5
|
||||
function ROTATE_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a rotate-left of an UNSIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.6
|
||||
function ROTATE_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a rotate-right of an UNSIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.7
|
||||
function ROTATE_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a logical rotate-left of a SIGNED
|
||||
-- vector COUNT times.
|
||||
|
||||
-- Id: S.8
|
||||
function ROTATE_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a logical rotate-right of a SIGNED
|
||||
-- vector COUNT times.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.9 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.9
|
||||
function "sll" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.10 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.10
|
||||
function "sll" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.11 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.11
|
||||
function "srl" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_RIGHT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.12 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.12
|
||||
function "srl" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SIGNED(SHIFT_RIGHT(UNSIGNED(ARG), COUNT))
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.13 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.13
|
||||
function "rol" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.14 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.14
|
||||
function "rol" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.15 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.15
|
||||
function "ror" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_RIGHT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.16 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.16
|
||||
function "ror" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_RIGHT(ARG, COUNT)
|
||||
|
||||
--===========================================================================
|
||||
-- RESIZE Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: R.1
|
||||
function RESIZE (ARG: SIGNED; NEW_SIZE: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(NEW_SIZE-1 downto 0)
|
||||
-- Result: Resizes the SIGNED vector ARG to the specified size.
|
||||
-- To create a larger vector, the new [leftmost] bit positions
|
||||
-- are filled with the sign bit (ARG'LEFT). When truncating,
|
||||
-- the sign bit is retained along with the rightmost part.
|
||||
|
||||
-- Id: R.2
|
||||
function RESIZE (ARG: UNSIGNED; NEW_SIZE: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(NEW_SIZE-1 downto 0)
|
||||
-- Result: Resizes the SIGNED vector ARG to the specified size.
|
||||
-- To create a larger vector, the new [leftmost] bit positions
|
||||
-- are filled with '0'. When truncating, the leftmost bits
|
||||
-- are dropped.
|
||||
|
||||
--===========================================================================
|
||||
-- Conversion Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: D.1
|
||||
function TO_INTEGER (ARG: UNSIGNED) return NATURAL;
|
||||
-- Result subtype: NATURAL. Value cannot be negative since parameter is an
|
||||
-- UNSIGNED vector.
|
||||
-- Result: Converts the UNSIGNED vector to an INTEGER.
|
||||
|
||||
-- Id: D.2
|
||||
function TO_INTEGER (ARG: SIGNED) return INTEGER;
|
||||
-- Result subtype: INTEGER
|
||||
-- Result: Converts a SIGNED vector to an INTEGER.
|
||||
|
||||
-- Id: D.3
|
||||
function TO_UNSIGNED (ARG, SIZE: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(SIZE-1 downto 0)
|
||||
-- Result: Converts a non-negative INTEGER to an UNSIGNED vector with
|
||||
-- the specified SIZE.
|
||||
|
||||
-- Id: D.4
|
||||
function TO_SIGNED (ARG: INTEGER; SIZE: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(SIZE-1 downto 0)
|
||||
-- Result: Converts an INTEGER to a SIGNED vector of the specified SIZE.
|
||||
|
||||
--===========================================================================
|
||||
-- Logical Operators
|
||||
--===========================================================================
|
||||
|
||||
-- Id: L.1
|
||||
function "not" (L: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Termwise inversion
|
||||
|
||||
-- Id: L.2
|
||||
function "and" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector AND operation
|
||||
|
||||
-- Id: L.3
|
||||
function "or" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector OR operation
|
||||
|
||||
-- Id: L.4
|
||||
function "nand" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NAND operation
|
||||
|
||||
-- Id: L.5
|
||||
function "nor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NOR operation
|
||||
|
||||
-- Id: L.6
|
||||
function "xor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XOR operation
|
||||
|
||||
-- --------------------------------------------------------------------------
|
||||
-- Note : Function L.7 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-- --------------------------------------------------------------------------
|
||||
-- Id: L.7
|
||||
function "xnor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XNOR operation
|
||||
|
||||
-- Id: L.8
|
||||
function "not" (L: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Termwise inversion
|
||||
|
||||
-- Id: L.9
|
||||
function "and" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector AND operation
|
||||
|
||||
-- Id: L.10
|
||||
function "or" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector OR operation
|
||||
|
||||
-- Id: L.11
|
||||
function "nand" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NAND operation
|
||||
|
||||
-- Id: L.12
|
||||
function "nor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NOR operation
|
||||
|
||||
-- Id: L.13
|
||||
function "xor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XOR operation
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- Note : Function L.14 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- Id: L.14
|
||||
function "xnor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XNOR operation
|
||||
|
||||
--===========================================================================
|
||||
-- Match Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: M.1
|
||||
function STD_MATCH (L, R: STD_ULOGIC) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
-- Id: M.2
|
||||
function STD_MATCH (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
-- Id: M.3
|
||||
function STD_MATCH (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
-- Id: M.4
|
||||
function STD_MATCH (L, R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
-- Id: M.5
|
||||
function STD_MATCH (L, R: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
--===========================================================================
|
||||
-- Translation Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: T.1
|
||||
function TO_01 (S: UNSIGNED; XMAP: STD_LOGIC := '0') return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(S'RANGE)
|
||||
-- Result: Termwise, 'H' is translated to '1', and 'L' is translated
|
||||
-- to '0'. If a value other than '0'|'1'|'H'|'L' is found,
|
||||
-- the array is set to (others => XMAP), and a warning is
|
||||
-- issued.
|
||||
|
||||
-- Id: T.2
|
||||
function TO_01 (S: SIGNED; XMAP: STD_LOGIC := '0') return SIGNED;
|
||||
-- Result subtype: SIGNED(S'RANGE)
|
||||
-- Result: Termwise, 'H' is translated to '1', and 'L' is translated
|
||||
-- to '0'. If a value other than '0'|'1'|'H'|'L' is found,
|
||||
-- the array is set to (others => XMAP), and a warning is
|
||||
-- issued.
|
||||
|
||||
end NUMERIC_STD;
|
||||
@@ -0,0 +1,133 @@
|
||||
-- The sven STANDARD package.
|
||||
-- This design unit contains some special tokens, which are only
|
||||
-- recognized by the analyzer when it is in special "bootstrap" mode.
|
||||
|
||||
package STANDARD is
|
||||
|
||||
-- predefined enumeration types:
|
||||
|
||||
type BOOLEAN is (FALSE, TRUE);
|
||||
|
||||
type BIT is ('0', '1');
|
||||
|
||||
type CHARACTER is (
|
||||
NUL, SOH, STX, ETX, EOT, ENQ, ACK, BEL,
|
||||
BS, HT, LF, VT, FF, CR, SO, SI,
|
||||
DLE, DC1, DC2, DC3, DC4, NAK, SYN, ETB,
|
||||
CAN, EM, SUB, ESC, FSP, GSP, RSP, USP,
|
||||
|
||||
' ', '!', '"', '#', '$', '%', '&', ''',
|
||||
'(', ')', '*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', ':', ';', '<', '=', '>', '?',
|
||||
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[', '\', ']', '^', '_',
|
||||
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', '{', '|', '}', '~', DEL,
|
||||
C128, C129, C130, C131, C132, C133, C134, C135,
|
||||
C136, C137, C138, C139, C140, C141, C142, C143,
|
||||
C144, C145, C146, C147, C148, C149, C150, C151,
|
||||
C152, C153, C154, C155, C156, C157, C158, C159,
|
||||
' ', '¡', '¢', '£', '¤', '¥', '¦', '§',
|
||||
'¨', '©', 'ª', '«', '¬', '', '®', '¯',
|
||||
'°', '±', '²', '³', '´', 'µ', '¶', '·',
|
||||
'¸', '¹', 'º', '»', '¼', '½', '¾', '¿',
|
||||
'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç',
|
||||
'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï',
|
||||
'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×',
|
||||
'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß',
|
||||
'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç',
|
||||
'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï',
|
||||
'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷',
|
||||
'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ');
|
||||
|
||||
|
||||
|
||||
type SEVERITY_LEVEL is (NOTE, WARNING, ERROR, FAILURE);
|
||||
|
||||
-- predefined numeric types:
|
||||
|
||||
-- Do INTEGER first to aid implicit declarations of "**".
|
||||
type INTEGER is range -2147483647 to 2147483647;
|
||||
|
||||
type $UNIVERSAL_INTEGER is range $- to $+;
|
||||
|
||||
type $UNIVERSAL_REAL is range $-. to $+.;
|
||||
|
||||
function "*" ($LEFT: $UNIVERSAL_REAL; $RIGHT: $UNIVERSAL_INTEGER)
|
||||
return $UNIVERSAL_REAL;
|
||||
|
||||
function "*" ($LEFT: $UNIVERSAL_INTEGER; $RIGHT: $UNIVERSAL_REAL)
|
||||
return $UNIVERSAL_REAL;
|
||||
|
||||
function "/" ($LEFT: $UNIVERSAL_REAL; $RIGHT: $UNIVERSAL_INTEGER)
|
||||
return $UNIVERSAL_REAL;
|
||||
|
||||
type REAL is range $-. to $+.;
|
||||
|
||||
-- predefined type TIME:
|
||||
|
||||
type TIME is range $- to $+
|
||||
units
|
||||
fs; -- femtosecond
|
||||
ps = 1000 fs; -- picosecond
|
||||
ns = 1000 ps; -- nanosecond
|
||||
us = 1000 ns; -- microsecond
|
||||
ms = 1000 us; -- millisecond
|
||||
sec = 1000 ms; -- second
|
||||
min = 60 sec; -- minute
|
||||
hr = 60 min; -- hour;
|
||||
end units;
|
||||
|
||||
-- subtype used internally for checking time expressions for non-negativness:
|
||||
|
||||
subtype $NATURAL_TIME is TIME range 0 sec to TIME'HIGH;
|
||||
|
||||
subtype DELAY_LENGTH is TIME range 0 fs to TIME'HIGH;
|
||||
|
||||
-- function that returns the current simulation time:
|
||||
|
||||
impure function NOW return TIME;
|
||||
|
||||
-- predefined numeric subtypes:
|
||||
|
||||
subtype NATURAL is INTEGER range 0 to INTEGER'HIGH;
|
||||
|
||||
subtype POSITIVE is INTEGER range 1 to INTEGER'HIGH;
|
||||
|
||||
-- predefined array types:
|
||||
|
||||
type STRING is array (POSITIVE range <>) of CHARACTER;
|
||||
|
||||
type BIT_VECTOR is array (NATURAL range <>) of BIT;
|
||||
|
||||
--type FILE_OPEN_KIND is (READ_OPEN, WRITE_OPEN, APPEND_OPEN);
|
||||
|
||||
type FILE_OPEN_KIND is (READ_MODE, WRITE_MODE, APPEND_MODE);
|
||||
|
||||
type FILE_OPEN_STATUS is (OPEN_OK, STATUS_ERROR, NAME_ERROR, MODE_ERROR);
|
||||
|
||||
attribute FOREIGN: STRING;
|
||||
|
||||
--
|
||||
-- The rest of this package is SVEN specific stuff required to make
|
||||
-- this implementation go.
|
||||
-- Note that all things are declared use leading $ characters, so we don't
|
||||
-- trample the user's name space.
|
||||
--
|
||||
|
||||
attribute $BUILTIN: BOOLEAN;
|
||||
|
||||
procedure $RTINDEX (I: NATURAL; FIRSTARG: INTEGER; PASSAP,SAVEFREGS: BOOLEAN);
|
||||
procedure $RTSYMBOL (S: STRING; FIRSTARG: INTEGER; PASSAP,SAVEFREGS: BOOLEAN);
|
||||
|
||||
attribute $BUILTIN of all: function is TRUE;
|
||||
attribute $BUILTIN of all: procedure is TRUE;
|
||||
|
||||
end STANDARD;
|
||||
@@ -0,0 +1,178 @@
|
||||
-- --------------------------------------------------------------------
|
||||
--
|
||||
-- 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 of
|
||||
-- : this package. Tool developers may choose to implement
|
||||
-- : the package body in the most efficient manner available
|
||||
-- : to them.
|
||||
-- :
|
||||
-- --------------------------------------------------------------------
|
||||
-- modification history :
|
||||
-- --------------------------------------------------------------------
|
||||
-- version | mod. date:|
|
||||
-- v4.200 | 01/02/92 |
|
||||
-- --------------------------------------------------------------------
|
||||
|
||||
PACKAGE std_logic_1164 IS
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- logic state system (unresolved)
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
);
|
||||
-------------------------------------------------------------------
|
||||
-- unconstrained array of std_ulogic for use with the resolution function
|
||||
-------------------------------------------------------------------
|
||||
TYPE std_ulogic_vector IS ARRAY ( NATURAL RANGE <> ) OF std_ulogic;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- resolution function
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION resolved ( s : std_ulogic_vector ) RETURN std_ulogic;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- *** industry standard logic type ***
|
||||
-------------------------------------------------------------------
|
||||
SUBTYPE std_logic IS resolved std_ulogic;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- unconstrained array of std_logic for use in declaring signal arrays
|
||||
-------------------------------------------------------------------
|
||||
TYPE std_logic_vector IS ARRAY ( NATURAL RANGE <>) OF std_logic;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- common subtypes
|
||||
-------------------------------------------------------------------
|
||||
SUBTYPE X01 IS resolved std_ulogic RANGE 'X' TO '1'; -- ('X','0','1')
|
||||
SUBTYPE X01Z IS resolved std_ulogic RANGE 'X' TO 'Z'; -- ('X','0','1','Z')
|
||||
SUBTYPE UX01 IS resolved std_ulogic RANGE 'U' TO '1'; -- ('U','X','0','1')
|
||||
SUBTYPE UX01Z IS resolved std_ulogic RANGE 'U' TO 'Z'; -- ('U','X','0','1','Z')
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- overloaded logical operators
|
||||
-------------------------------------------------------------------
|
||||
|
||||
FUNCTION "and" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
FUNCTION "nand" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
FUNCTION "or" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
FUNCTION "nor" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
FUNCTION "xor" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
function "xnor" ( l : std_ulogic; r : std_ulogic ) return ux01;
|
||||
FUNCTION "not" ( l : std_ulogic ) RETURN UX01;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- vectorized overloaded logical operators
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION "and" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "and" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
FUNCTION "nand" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "nand" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
FUNCTION "or" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "or" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
FUNCTION "nor" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "nor" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
FUNCTION "xor" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "xor" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
-- -----------------------------------------------------------------------
|
||||
-- Note : The declaration and implementation of the "xnor" function is
|
||||
-- specifically commented until at which time the VHDL language has been
|
||||
-- officially adopted as containing such a function. At such a point,
|
||||
-- the following comments may be removed along with this notice without
|
||||
-- further "official" ballotting of this std_logic_1164 package. It is
|
||||
-- the intent of this effort to provide such a function once it becomes
|
||||
-- available in the VHDL standard.
|
||||
-- -----------------------------------------------------------------------
|
||||
function "xnor" ( l, r : std_logic_vector ) return std_logic_vector;
|
||||
function "xnor" ( l, r : std_ulogic_vector ) return std_ulogic_vector;
|
||||
|
||||
FUNCTION "not" ( l : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "not" ( l : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- conversion functions
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION To_bit ( s : std_ulogic; xmap : BIT := '0')
|
||||
RETURN BIT;
|
||||
FUNCTION To_bitvector ( s : std_logic_vector ; xmap : BIT := '0')
|
||||
RETURN BIT_VECTOR;
|
||||
FUNCTION To_bitvector ( s : std_ulogic_vector; xmap : BIT := '0')
|
||||
RETURN BIT_VECTOR;
|
||||
|
||||
FUNCTION To_StdULogic (b : BIT ) RETURN std_ulogic;
|
||||
FUNCTION To_StdLogicVector (b : BIT_VECTOR ) RETURN std_logic_vector;
|
||||
FUNCTION To_StdLogicVector (s : std_ulogic_vector) RETURN std_logic_vector;
|
||||
FUNCTION To_StdULogicVector(b : BIT_VECTOR ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_StdULogicVector(s : std_logic_vector) RETURN std_ulogic_vector;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- strength strippers and type convertors
|
||||
-------------------------------------------------------------------
|
||||
|
||||
FUNCTION To_X01 ( s : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION To_X01 ( s : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_X01 ( s : std_ulogic ) RETURN X01;
|
||||
FUNCTION To_X01 ( b : BIT_VECTOR ) RETURN std_logic_vector;
|
||||
FUNCTION To_X01 ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_X01 ( b : BIT ) RETURN X01;
|
||||
|
||||
FUNCTION To_X01Z ( s : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION To_X01Z ( s : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_X01Z ( s : std_ulogic ) RETURN X01Z;
|
||||
FUNCTION To_X01Z ( b : BIT_VECTOR ) RETURN std_logic_vector;
|
||||
FUNCTION To_X01Z ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_X01Z ( b : BIT ) RETURN X01Z;
|
||||
|
||||
FUNCTION To_UX01 ( s : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION To_UX01 ( s : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_UX01 ( s : std_ulogic ) RETURN UX01;
|
||||
FUNCTION To_UX01 ( b : BIT_VECTOR ) RETURN std_logic_vector;
|
||||
FUNCTION To_UX01 ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_UX01 ( b : BIT ) RETURN UX01;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- edge detection
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION rising_edge (SIGNAL s : std_ulogic) RETURN BOOLEAN;
|
||||
FUNCTION falling_edge (SIGNAL s : std_ulogic) RETURN BOOLEAN;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- object contains an unknown
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION Is_X ( s : std_ulogic_vector ) RETURN BOOLEAN;
|
||||
FUNCTION Is_X ( s : std_logic_vector ) RETURN BOOLEAN;
|
||||
FUNCTION Is_X ( s : std_ulogic ) RETURN BOOLEAN;
|
||||
|
||||
END std_logic_1164;
|
||||
@@ -0,0 +1,217 @@
|
||||
-- --------------------------------------------------------------------
|
||||
--
|
||||
-- Title : STD_LOGIC_ARITH arithmetic support for STD_ULOGIC/
|
||||
-- : STD_LOGIC_VECTOR data type
|
||||
-- Library : This package shall be compiled into a logical library
|
||||
-- : named IEEE.
|
||||
-- Purpose : To support unsigned arithmetic operations such as
|
||||
-- : addition, subtraction, multiplication etc. for std_ulogic
|
||||
-- : and std_logic_vector data types. Besides it supports
|
||||
-- : functions and operators for Conditional operations,
|
||||
-- : shift operations, relational operation between integer
|
||||
-- : and std_logic_vector types, aligning size between operands
|
||||
-- : of different sizes, type conversion.
|
||||
-- : It also supports a set of arithemtic, conversion, and
|
||||
-- : comparison functions for SIGNED, UNSIGNED, SMALL_INT,
|
||||
-- : INTEGER, STD_ULOGIC, STD_LOGIC, and STD_LOGIC_VECTOR.
|
||||
-- :
|
||||
-- Note : No declarations or definitions shall be included in,
|
||||
-- : or excluded from this package.
|
||||
-- :
|
||||
-- : Modification History: TH, 24th Jan., 1994
|
||||
-- : Following functions are overloaded for STD_ULOGIC_VECTOR
|
||||
-- : type: "+", "-", "*", "cond_op", "<", ">", "<=", ">=", "=",
|
||||
-- : "/=", sh_left, sh_right, align_size and "to_integer"
|
||||
-- : New functions added are:
|
||||
-- : To_StdUlogicVector (oper: INTEGER; length: NATURAL)
|
||||
-- : return STD_ULOGIC_VECTOR
|
||||
-- : "+"(op1: STD_ULOGIC; op2: STD_ULOGIC) return STD_ULOGIC;
|
||||
-- : "-"(op1: STD_ULOGIC; op2: STD_ULOGIC) return STD_ULOGIC;
|
||||
--
|
||||
-- : Name changes from STD_LOGIC_ARITH to STD_LOGIC_ARITH
|
||||
-- : operator "/" added.
|
||||
-- : Vinaya: 13/9/94.
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
|
||||
package STD_LOGIC_ARITH is
|
||||
|
||||
-- ADD/SUBTRACT OPERATORS
|
||||
|
||||
function "+"(op1, op2: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(op1: STD_LOGIC_VECTOR; op2: STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "+"(op1: STD_ULOGIC; op2: STD_LOGIC_VECTOR)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "+"(op1: INTEGER; op2: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(op1: STD_LOGIC_VECTOR; op2: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(op1, op2: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1: STD_ULOGIC_VECTOR; op2: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1: STD_ULOGIC; op2: STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1: INTEGER; op2: STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1: STD_ULOGIC_VECTOR; op2: INTEGER)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1, op2 : STD_ULOGIC) return STD_ULOGIC;
|
||||
|
||||
|
||||
function "-"(op1, op2: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(op1: STD_LOGIC_VECTOR; op2: STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "-"(op1: STD_ULOGIC; op2: STD_LOGIC_VECTOR)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "-"(op1: INTEGER; op2: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(op1: STD_LOGIC_VECTOR; op2: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(op1, op2: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1: STD_ULOGIC_VECTOR; op2: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1: STD_ULOGIC; op2: STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1: INTEGER; op2: STD_ULOGIC_VECTOR)return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1: STD_ULOGIC_VECTOR; op2: INTEGER)return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1, op2 : STD_ULOGIC) return STD_ULOGIC;
|
||||
|
||||
-- UNARY OPERATORS
|
||||
|
||||
function "+" (op1: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+" (op1: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- MULTIPLYING OPERATORS
|
||||
|
||||
function "*" (op1, op2 : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "*" (op1: STD_ULOGIC; op2 : STD_LOGIC_VECTOR)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "*" (op1: STD_LOGIC_VECTOR; op2 : STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "*" (op1, op2 : STD_ULOGIC) return STD_ULOGIC;
|
||||
|
||||
function "*" (op1, op2 : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
function "*" (op1: STD_ULOGIC; op2 : STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "*" (op1: STD_ULOGIC_VECTOR; op2 : STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- DIVISION OPERATORS
|
||||
-- The division operators are only for internal use
|
||||
-- It is not advisible to use them in design.
|
||||
|
||||
function "/" (op1, op2 : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "/" (op1: STD_LOGIC_VECTOR; op2 : STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "/" (op1: STD_ULOGIC; op2 : STD_LOGIC_VECTOR)
|
||||
return STD_ULOGIC;
|
||||
function "/" (op1, op2 : STD_ULOGIC) return STD_ULOGIC;
|
||||
|
||||
|
||||
-- CONDITIONAL FUNCTIONS
|
||||
|
||||
function cond_op (cond : boolean; left_val, right_val: STD_LOGIC_VECTOR)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function cond_op (cond : boolean; left_val, right_val: STD_ULOGIC)
|
||||
return STD_ULOGIC;
|
||||
function cond_op (cond : boolean; left_val, right_val: STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- RELATIONAL OPERATORS
|
||||
|
||||
function "<"(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "<="(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function ">"(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function ">="(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "="(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "/="(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
|
||||
function "<"(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "<="(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function ">"(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function ">="(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "="(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "/="(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
-- SHIFT OPERATORS
|
||||
|
||||
function sh_left(op1: STD_LOGIC_VECTOR; op2: NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function sh_right(op1: STD_LOGIC_VECTOR; op2: NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function sh_left(op1: STD_ULOGIC_VECTOR; op2: NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function sh_right(op1: STD_ULOGIC_VECTOR; op2: NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
|
||||
-- FUNCTIONS TO ALLOW ASSIGNMENTS OF STD_LOGIC_VECTOR OF UNEQUAL SIZES
|
||||
|
||||
|
||||
function align_size (oper : STD_LOGIC_VECTOR; size : NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function align_size (oper : STD_ULOGIC; size : NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function align_size (oper : STD_ULOGIC_VECTOR; size : NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function align_size (oper : STD_ULOGIC; size : NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- CONVERSION TO INTEGER FROM STD_LOGIC AND STD_LOGIC_VECTOR
|
||||
|
||||
function to_integer (oper : STD_LOGIC_VECTOR) return INTEGER;
|
||||
function to_integer (oper: STD_ULOGIC) return INTEGER;
|
||||
function to_integer (oper : STD_ULOGIC_VECTOR) return INTEGER;
|
||||
|
||||
|
||||
-- CONVERSION TO STD_LOGIC_VECTOR FROM INTEGER
|
||||
|
||||
function To_StdLogicVector (oper: INTEGER; length: NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function To_StdUlogicVector (oper: INTEGER; length: NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- UTILITY FUNCTIONS
|
||||
|
||||
function drive (V: STD_LOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
function drive (V: STD_ULOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function Sense (V: STD_ULOGIC; vZ, vU, vDC: STD_ULOGIC) return STD_ULOGIC;
|
||||
function Sense (V: STD_ULOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function Sense (V: STD_LOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- CONVERSION TABLE FOR TO_INTEGER
|
||||
|
||||
type tbl_type is array (STD_ULOGIC) of STD_ULOGIC;
|
||||
constant tbl_BINARY : tbl_type :=
|
||||
('X', 'X', '0', '1', 'X', 'X', '0', '1', 'X');
|
||||
|
||||
end STD_LOGIC_ARITH;
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990,1991,1992 by Synopsys, Inc. All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_ARITH --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of arithemtic, conversion, and comparison functions --
|
||||
-- for SIGNED, UNSIGNED, SMALL_INT, INTEGER, --
|
||||
-- STD_ULOGIC, STD_LOGIC, and STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
package std_logic_arith is
|
||||
|
||||
type UNSIGNED is array (NATURAL range <>) of STD_LOGIC;
|
||||
type SIGNED is array (NATURAL range <>) of STD_LOGIC;
|
||||
subtype SMALL_INT is INTEGER range 0 to 1;
|
||||
|
||||
function "+"(L: UNSIGNED; R: UNSIGNED) return UNSIGNED;
|
||||
function "+"(L: SIGNED; R: SIGNED) return SIGNED;
|
||||
function "+"(L: UNSIGNED; R: SIGNED) return SIGNED;
|
||||
function "+"(L: SIGNED; R: UNSIGNED) return SIGNED;
|
||||
function "+"(L: UNSIGNED; R: INTEGER) return UNSIGNED;
|
||||
function "+"(L: INTEGER; R: UNSIGNED) return UNSIGNED;
|
||||
function "+"(L: SIGNED; R: INTEGER) return SIGNED;
|
||||
function "+"(L: INTEGER; R: SIGNED) return SIGNED;
|
||||
function "+"(L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED;
|
||||
function "+"(L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED;
|
||||
function "+"(L: SIGNED; R: STD_ULOGIC) return SIGNED;
|
||||
function "+"(L: STD_ULOGIC; R: SIGNED) return SIGNED;
|
||||
|
||||
function "+"(L: UNSIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: UNSIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: UNSIGNED; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: UNSIGNED; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_ULOGIC; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_ULOGIC; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: UNSIGNED; R: UNSIGNED) return UNSIGNED;
|
||||
function "-"(L: SIGNED; R: SIGNED) return SIGNED;
|
||||
function "-"(L: UNSIGNED; R: SIGNED) return SIGNED;
|
||||
function "-"(L: SIGNED; R: UNSIGNED) return SIGNED;
|
||||
function "-"(L: UNSIGNED; R: INTEGER) return UNSIGNED;
|
||||
function "-"(L: INTEGER; R: UNSIGNED) return UNSIGNED;
|
||||
function "-"(L: SIGNED; R: INTEGER) return SIGNED;
|
||||
function "-"(L: INTEGER; R: SIGNED) return SIGNED;
|
||||
function "-"(L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED;
|
||||
function "-"(L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED;
|
||||
function "-"(L: SIGNED; R: STD_ULOGIC) return SIGNED;
|
||||
function "-"(L: STD_ULOGIC; R: SIGNED) return SIGNED;
|
||||
|
||||
function "-"(L: UNSIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: UNSIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: UNSIGNED; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: UNSIGNED; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_ULOGIC; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_ULOGIC; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: UNSIGNED) return UNSIGNED;
|
||||
function "+"(L: SIGNED) return SIGNED;
|
||||
function "-"(L: SIGNED) return SIGNED;
|
||||
function "ABS"(L: SIGNED) return SIGNED;
|
||||
|
||||
function "+"(L: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "ABS"(L: SIGNED) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "*"(L: UNSIGNED; R: UNSIGNED) return UNSIGNED;
|
||||
function "*"(L: SIGNED; R: SIGNED) return SIGNED;
|
||||
function "*"(L: SIGNED; R: UNSIGNED) return SIGNED;
|
||||
function "*"(L: UNSIGNED; R: SIGNED) return SIGNED;
|
||||
|
||||
function "*"(L: UNSIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "*"(L: SIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "*"(L: SIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "*"(L: UNSIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "<"(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "<"(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "<"(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "<"(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function "<"(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function "<="(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "<="(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "<="(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "<="(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "<="(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function "<="(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function ">"(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function ">"(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function ">"(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function ">"(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function ">"(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function ">"(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function ">="(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function ">="(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function ">="(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function ">="(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function ">="(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function ">="(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function "="(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "="(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "="(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "="(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "="(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function "="(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function "/="(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "/="(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "/="(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "/="(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "/="(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function "/="(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function SHL(ARG: UNSIGNED; COUNT: UNSIGNED) return UNSIGNED;
|
||||
function SHL(ARG: SIGNED; COUNT: UNSIGNED) return SIGNED;
|
||||
function SHR(ARG: UNSIGNED; COUNT: UNSIGNED) return UNSIGNED;
|
||||
function SHR(ARG: SIGNED; COUNT: UNSIGNED) return SIGNED;
|
||||
|
||||
function CONV_INTEGER(ARG: INTEGER) return INTEGER;
|
||||
function CONV_INTEGER(ARG: UNSIGNED) return INTEGER;
|
||||
function CONV_INTEGER(ARG: SIGNED) return INTEGER;
|
||||
function CONV_INTEGER(ARG: STD_ULOGIC) return SMALL_INT;
|
||||
|
||||
function CONV_UNSIGNED(ARG: INTEGER; SIZE: INTEGER) return UNSIGNED;
|
||||
function CONV_UNSIGNED(ARG: UNSIGNED; SIZE: INTEGER) return UNSIGNED;
|
||||
function CONV_UNSIGNED(ARG: SIGNED; SIZE: INTEGER) return UNSIGNED;
|
||||
function CONV_UNSIGNED(ARG: STD_ULOGIC; SIZE: INTEGER) return UNSIGNED;
|
||||
|
||||
function CONV_SIGNED(ARG: INTEGER; SIZE: INTEGER) return SIGNED;
|
||||
function CONV_SIGNED(ARG: UNSIGNED; SIZE: INTEGER) return SIGNED;
|
||||
function CONV_SIGNED(ARG: SIGNED; SIZE: INTEGER) return SIGNED;
|
||||
function CONV_SIGNED(ARG: STD_ULOGIC; SIZE: INTEGER) return SIGNED;
|
||||
|
||||
function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function CONV_STD_LOGIC_VECTOR(ARG: UNSIGNED; SIZE: INTEGER)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function CONV_STD_LOGIC_VECTOR(ARG: SIGNED; SIZE: INTEGER)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function CONV_STD_LOGIC_VECTOR(ARG: STD_ULOGIC; SIZE: INTEGER)
|
||||
return STD_LOGIC_VECTOR;
|
||||
-- zero extend STD_LOGIC_VECTOR (ARG) to SIZE,
|
||||
-- SIZE < 0 is same as SIZE = 0
|
||||
-- returns STD_LOGIC_VECTOR(SIZE-1 downto 0)
|
||||
function EXT(ARG: STD_LOGIC_VECTOR; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
-- sign extend STD_LOGIC_VECTOR (ARG) to SIZE,
|
||||
-- SIZE < 0 is same as SIZE = 0
|
||||
-- return STD_LOGIC_VECTOR(SIZE-1 downto 0)
|
||||
function SXT(ARG: STD_LOGIC_VECTOR; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end Std_logic_arith;
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. --
|
||||
-- All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_SIGNED --
|
||||
-- --
|
||||
-- --
|
||||
-- Date: 09/11/91 KN --
|
||||
-- 10/08/92 AMT change std_ulogic to signed std_logic --
|
||||
-- 10/28/92 AMT added signed functions, -, ABS --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of signed arithemtic, conversion, --
|
||||
-- and comparision functions for STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
-- Note: Comparision of same length std_logic_vector is defined --
|
||||
-- in the LRM. The interpretation is for unsigned vectors --
|
||||
-- This package will "overload" that definition. --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package STD_LOGIC_SIGNED is
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "ABS"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER;
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
-- function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end STD_LOGIC_SIGNED;
|
||||
@@ -0,0 +1,73 @@
|
||||
--
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. All rights reserved.
|
||||
--
|
||||
-- This source file may be used and distributed without restriction
|
||||
-- provided that this copyright statement is not removed from the file
|
||||
-- and that any derivative work contains this copyright notice.
|
||||
--
|
||||
-- Package name: STD_LOGIC_TEXTIO
|
||||
--
|
||||
-- Purpose: This package overloads the standard TEXTIO procedures
|
||||
-- READ and WRITE.
|
||||
--
|
||||
-- Author: CRC, TS
|
||||
--
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
use STD.textio.all;
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
package STD_LOGIC_TEXTIO is
|
||||
--synopsys synthesis_off
|
||||
-- Read and Write procedures for STD_ULOGIC and STD_ULOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC; GOOD: out BOOLEAN);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out
|
||||
BOOLEAN);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
-- Read and Write procedures for STD_LOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out
|
||||
BOOLEAN);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
--
|
||||
-- Read and Write procedures for Hex and Octal values.
|
||||
-- The values appear in the file as a series of characters
|
||||
-- between 0-F (Hex), or 0-7 (Octal) respectively.
|
||||
--
|
||||
|
||||
-- Hex
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD:
|
||||
out BOOLEAN);
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out
|
||||
BOOLEAN);
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
-- Octal
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD:
|
||||
out BOOLEAN);
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out
|
||||
BOOLEAN);
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
|
||||
--synopsys synthesis_on
|
||||
end STD_LOGIC_TEXTIO;
|
||||
@@ -0,0 +1,79 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. --
|
||||
-- All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_UNSIGNED --
|
||||
-- --
|
||||
-- --
|
||||
-- Date: 09/11/92 KN --
|
||||
-- 10/08/92 AMT --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of unsigned arithemtic, conversion, --
|
||||
-- and comparision functions for STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
-- Note: comparision of same length discrete arrays is defined --
|
||||
-- by the LRM. This package will "overload" those --
|
||||
-- definitions --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package STD_LOGIC_UNSIGNED is
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER;
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
-- function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end STD_LOGIC_UNSIGNED;
|
||||
@@ -0,0 +1,86 @@
|
||||
-- textio.vhdl
|
||||
|
||||
library std; use std.standard.all; -- needed for bootstrap mode
|
||||
|
||||
package TEXTIO is
|
||||
|
||||
-- Type Definitions for Text I/O
|
||||
|
||||
type LINE is access STRING; -- a line is a pointer to a STRING value
|
||||
|
||||
type TEXT is file of STRING; -- a file of variable-length ASCII records
|
||||
|
||||
type SIDE is (RIGHT, LEFT); -- for justifying output data within fields
|
||||
|
||||
subtype WIDTH is NATURAL; -- for specifying widths of output fields
|
||||
|
||||
-- Standard Text Files
|
||||
|
||||
file INPUT: TEXT open READ_MODE is "STD_INPUT";
|
||||
|
||||
file OUTPUT: TEXT open WRITE_MODE is "STD_OUTPUT";
|
||||
|
||||
-- Input Routines for Standard Types
|
||||
|
||||
procedure READLINE (file F: TEXT; L: inout LINE);
|
||||
|
||||
procedure READ (L: inout LINE; VALUE: out BIT; GOOD: out BOOLEAN);
|
||||
procedure READ (L: inout LINE; VALUE: out BIT);
|
||||
|
||||
procedure READ (L: inout LINE; VALUE: out BIT_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure READ (L: inout LINE; VALUE: out BIT_VECTOR);
|
||||
|
||||
procedure READ (L: inout LINE; VALUE: out BOOLEAN; GOOD: out BOOLEAN);
|
||||
procedure READ (L: inout LINE; VALUE: out BOOLEAN);
|
||||
|
||||
procedure READ (L: inout LINE; VALUE: out CHARACTER; GOOD: out BOOLEAN);
|
||||
procedure READ (L: inout LINE; VALUE: out CHARACTER);
|
||||
|
||||
procedure READ (L: inout LINE; VALUE: out INTEGER; GOOD: out BOOLEAN);
|
||||
procedure READ (L: inout LINE; VALUE: out INTEGER);
|
||||
|
||||
procedure READ (L: inout LINE; VALUE: out REAL; GOOD: out BOOLEAN);
|
||||
procedure READ (L: inout LINE; VALUE: out REAL);
|
||||
|
||||
procedure READ (L: inout LINE; VALUE: out STRING; GOOD: out BOOLEAN);
|
||||
procedure READ (L: inout LINE; VALUE: out STRING);
|
||||
|
||||
procedure READ (L: inout LINE; VALUE: out TIME; GOOD: out BOOLEAN);
|
||||
procedure READ (L: inout LINE; VALUE: out TIME);
|
||||
|
||||
-- Output Routines for Standard Types
|
||||
|
||||
procedure WRITELINE (file F: TEXT; L: inout LINE);
|
||||
|
||||
procedure WRITE (L: inout LINE; VALUE: in BIT;
|
||||
JUSTIFIED: in SIDE := RIGHT; FIELD: in WIDTH := 0);
|
||||
|
||||
procedure WRITE (L: inout LINE; VALUE: in BIT_VECTOR;
|
||||
JUSTIFIED: in SIDE := RIGHT; FIELD: in WIDTH := 0);
|
||||
|
||||
procedure WRITE (L: inout LINE; VALUE: in BOOLEAN;
|
||||
JUSTIFIED: in SIDE := RIGHT; FIELD: in WIDTH := 0);
|
||||
|
||||
procedure WRITE (L: inout LINE; VALUE: in CHARACTER;
|
||||
JUSTIFIED: in SIDE := RIGHT; FIELD: in WIDTH := 0);
|
||||
|
||||
procedure WRITE (L: inout LINE; VALUE: in INTEGER;
|
||||
JUSTIFIED: in SIDE := RIGHT; FIELD: in WIDTH := 0);
|
||||
|
||||
procedure WRITE (L: inout LINE; VALUE: in REAL;
|
||||
JUSTIFIED: in SIDE := RIGHT; FIELD: in WIDTH := 0;
|
||||
DIGITS: in NATURAL := 0);
|
||||
|
||||
procedure WRITE (L: inout LINE; VALUE: in STRING;
|
||||
JUSTIFIED: in SIDE := RIGHT; FIELD: in WIDTH := 0);
|
||||
|
||||
procedure WRITE (L: inout LINE; VALUE: in TIME;
|
||||
JUSTIFIED: in SIDE := RIGHT; FIELD: in WIDTH := 0;
|
||||
UNIT: in TIME := ns);
|
||||
|
||||
-- File Position Predicates
|
||||
|
||||
function ENDLINE (L: in LINE) return BOOLEAN;
|
||||
|
||||
|
||||
end TEXTIO;
|
||||
@@ -0,0 +1,813 @@
|
||||
-- ----------------------------------------------------------------------------
|
||||
--
|
||||
-- Copyright 1995 by IEEE. All rights reserved.
|
||||
--
|
||||
--This source file is considered by the IEEE to be an essential part of the use
|
||||
-- of the standard 1076.3 and as such may be distributed without change, except
|
||||
--as permitted by the standard. This source file may not be sold or distributed
|
||||
-- for profit. This package may be modified to include additional data required
|
||||
-- by tools, but must in no way change the external interfaces or simulation
|
||||
-- behaviour of the description. It is permissible to add comments and/or
|
||||
-- attributes to the package declarations, but not to change or delete any
|
||||
-- original lines of the approved package declaration. The package body may be
|
||||
-- changed only in accordance with the terms of clauses 7.1 and 7.2 of the
|
||||
-- standard.
|
||||
--
|
||||
-- Title : Standard VHDL Synthesis Package (1076.3, NUMERIC_BIT)
|
||||
--
|
||||
-- Library : This package shall be compiled into a library symbolically
|
||||
-- : named IEEE.
|
||||
--
|
||||
-- Developers : IEEE DASC Synthesis Working Group, PAR 1076.3
|
||||
--
|
||||
-- Purpose : This package defines numeric types and arithmetic functions
|
||||
-- : for use with synthesis tools. Two numeric types are defined:
|
||||
-- : -- > UNSIGNED: represents an UNSIGNED number in vector form
|
||||
-- : -- > SIGNED: represents a SIGNED number in vector form
|
||||
-- : The base element type is type BIT.
|
||||
-- : The leftmost bit is treated as the most significant bit.
|
||||
-- : Signed vectors are represented in two's complement form.
|
||||
-- : This package contains overloaded arithmetic operators on
|
||||
-- : the SIGNED and UNSIGNED types. The package also contains
|
||||
-- : useful type conversions functions, clock detection
|
||||
-- : functions, and other utility functions.
|
||||
-- :
|
||||
-- : If any argument to a function is a null array, a null array is
|
||||
-- : returned (exceptions, if any, are noted individually).
|
||||
--
|
||||
-- Limitation :
|
||||
--
|
||||
-- Note : No declarations or definitions shall be included in,
|
||||
-- : or excluded from this package. The "package declaration"
|
||||
-- : defines the types, subtypes and declarations of
|
||||
-- : NUMERIC_BIT. The NUMERIC_BIT package body shall be
|
||||
-- : considered the formal definition of the semantics of
|
||||
-- : this package. Tool developers may choose to implement
|
||||
-- : the package body in the most efficient manner available
|
||||
-- : to them.
|
||||
-- :
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- Version : 2.4
|
||||
-- Date : 12 April 1995
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
||||
package NUMERIC_BIT is
|
||||
constant CopyRightNotice: STRING
|
||||
:= "Copyright 1995 IEEE. All rights reserved.";
|
||||
|
||||
--===========================================================================
|
||||
-- Numeric array type definitions
|
||||
--===========================================================================
|
||||
|
||||
type UNSIGNED is array (NATURAL range <> ) of BIT;
|
||||
type SIGNED is array (NATURAL range <> ) of BIT;
|
||||
|
||||
--===========================================================================
|
||||
-- Arithmetic Operators:
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.1
|
||||
function "abs" (ARG: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
|
||||
-- Result: Returns the absolute value of a SIGNED vector ARG.
|
||||
|
||||
-- Id: A.2
|
||||
function "-" (ARG: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
|
||||
-- Result: Returns the value of the unary minus operation on a
|
||||
-- SIGNED vector ARG.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.3
|
||||
function "+" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Adds two UNSIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.4
|
||||
function "+" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Adds two SIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.5
|
||||
function "+" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Adds an UNSIGNED vector, L, with a non-negative INTEGER, R.
|
||||
|
||||
-- Id: A.6
|
||||
function "+" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Adds a non-negative INTEGER, L, with an UNSIGNED vector, R.
|
||||
|
||||
-- Id: A.7
|
||||
function "+" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Adds an INTEGER, L(may be positive or negative), to a SIGNED
|
||||
-- vector, R.
|
||||
|
||||
-- Id: A.8
|
||||
function "+" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Adds a SIGNED vector, L, to an INTEGER, R.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.9
|
||||
function "-" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Subtracts two UNSIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.10
|
||||
function "-" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Subtracts a SIGNED vector, R, from another SIGNED vector, L,
|
||||
-- that may possibly be of different lengths.
|
||||
|
||||
-- Id: A.11
|
||||
function "-" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts a non-negative INTEGER, R, from an UNSIGNED vector, L.
|
||||
|
||||
-- Id: A.12
|
||||
function "-" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts an UNSIGNED vector, R, from a non-negative INTEGER, L.
|
||||
|
||||
-- Id: A.13
|
||||
function "-" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts an INTEGER, R, from a SIGNED vector, L.
|
||||
|
||||
-- Id: A.14
|
||||
function "-" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts a SIGNED vector, R, from an INTEGER, L.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.15
|
||||
function "*" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((L'LENGTH+R'LENGTH-1) downto 0).
|
||||
-- Result: Performs the multiplication operation on two UNSIGNED vectors
|
||||
-- that may possibly be of different lengths.
|
||||
|
||||
-- Id: A.16
|
||||
function "*" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED((L'LENGTH+R'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies two SIGNED vectors that may possibly be of
|
||||
-- different lengths.
|
||||
|
||||
-- Id: A.17
|
||||
function "*" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((L'LENGTH+L'LENGTH-1) downto 0).
|
||||
-- Result: Multiplies an UNSIGNED vector, L, with a non-negative
|
||||
-- INTEGER, R. R is converted to an UNSIGNED vector of
|
||||
-- size L'LENGTH before multiplication.
|
||||
|
||||
-- Id: A.18
|
||||
function "*" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((R'LENGTH+R'LENGTH-1) downto 0).
|
||||
-- Result: Multiplies an UNSIGNED vector, R, with a non-negative
|
||||
-- INTEGER, L. L is converted to an UNSIGNED vector of
|
||||
-- size R'LENGTH before multiplication.
|
||||
|
||||
-- Id: A.19
|
||||
function "*" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED((L'LENGTH+L'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies a SIGNED vector, L, with an INTEGER, R. R is
|
||||
-- converted to a SIGNED vector of size L'LENGTH before
|
||||
-- multiplication.
|
||||
|
||||
-- Id: A.20
|
||||
function "*" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED((R'LENGTH+R'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies a SIGNED vector, R, with an INTEGER, L. L is
|
||||
-- converted to a SIGNED vector of size R'LENGTH before
|
||||
-- multiplication.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "/" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.21
|
||||
function "/" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an UNSIGNED vector, L, by another UNSIGNED vector, R.
|
||||
|
||||
-- Id: A.22
|
||||
function "/" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an SIGNED vector, L, by another SIGNED vector, R.
|
||||
|
||||
-- Id: A.23
|
||||
function "/" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an UNSIGNED vector, L, by a non-negative INTEGER, R.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.24
|
||||
function "/" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Divides a non-negative INTEGER, L, by an UNSIGNED vector, R.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.25
|
||||
function "/" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides a SIGNED vector, L, by an INTEGER, R.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.26
|
||||
function "/" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Divides an INTEGER, L, by a SIGNED vector, R.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "rem" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.27
|
||||
function "rem" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L and R are UNSIGNED vectors.
|
||||
|
||||
-- Id: A.28
|
||||
function "rem" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L and R are SIGNED vectors.
|
||||
|
||||
-- Id: A.29
|
||||
function "rem" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L is an UNSIGNED vector and R is a
|
||||
-- non-negative INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.30
|
||||
function "rem" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where R is an UNSIGNED vector and L is a
|
||||
-- non-negative INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.31
|
||||
function "rem" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L is SIGNED vector and R is an INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.32
|
||||
function "rem" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where R is SIGNED vector and L is an INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "mod" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.33
|
||||
function "mod" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L and R are UNSIGNED vectors.
|
||||
|
||||
-- Id: A.34
|
||||
function "mod" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L and R are SIGNED vectors.
|
||||
|
||||
-- Id: A.35
|
||||
function "mod" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is an UNSIGNED vector and R
|
||||
-- is a non-negative INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.36
|
||||
function "mod" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where R is an UNSIGNED vector and L
|
||||
-- is a non-negative INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.37
|
||||
function "mod" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.38
|
||||
function "mod" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
-- Comparison Operators
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.1
|
||||
function ">" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.2
|
||||
function ">" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.3
|
||||
function ">" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.4
|
||||
function ">" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.5
|
||||
function ">" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.6
|
||||
function ">" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a SIGNED vector and
|
||||
-- R is a INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.7
|
||||
function "<" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.8
|
||||
function "<" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.9
|
||||
function "<" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.10
|
||||
function "<" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.11
|
||||
function "<" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.12
|
||||
function "<" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.13
|
||||
function "<=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.14
|
||||
function "<=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.15
|
||||
function "<=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.16
|
||||
function "<=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.17
|
||||
function "<=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.18
|
||||
function "<=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.19
|
||||
function ">=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.20
|
||||
function ">=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.21
|
||||
function ">=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.22
|
||||
function ">=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.23
|
||||
function ">=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.24
|
||||
function ">=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.25
|
||||
function "=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.26
|
||||
function "=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.27
|
||||
function "=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.28
|
||||
function "=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.29
|
||||
function "=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.30
|
||||
function "=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.31
|
||||
function "/=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.32
|
||||
function "/=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.33
|
||||
function "/=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.34
|
||||
function "/=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.35
|
||||
function "/=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.36
|
||||
function "/=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
-- Shift and Rotate Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: S.1
|
||||
function SHIFT_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-left on an UNSIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with Bit '0'.
|
||||
-- The COUNT leftmost bits are lost.
|
||||
|
||||
-- Id: S.2
|
||||
function SHIFT_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-right on an UNSIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with Bit '0'.
|
||||
-- The COUNT rightmost bits are lost.
|
||||
|
||||
-- Id: S.3
|
||||
function SHIFT_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-left on a SIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with Bit '0'.
|
||||
-- The COUNT leftmost bits, except ARG'LEFT, are lost.
|
||||
|
||||
-- Id: S.4
|
||||
function SHIFT_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-right on a SIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with the leftmost bit, ARG'LEFT.
|
||||
-- The COUNT rightmost bits are lost.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: S.5
|
||||
function ROTATE_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a rotate-left of an UNSIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.6
|
||||
function ROTATE_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a rotate-right of an UNSIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.7
|
||||
function ROTATE_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a logical rotate-left of a SIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.8
|
||||
function ROTATE_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a logical rotate-right of a SIGNED vector COUNT times.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.9 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.9
|
||||
function "sll" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.10 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.10
|
||||
function "sll" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.11 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.11
|
||||
function "srl" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_RIGHT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.12 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.12
|
||||
function "srl" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SIGNED(SHIFT_RIGHT(UNSIGNED(ARG), COUNT))
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.13 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.13
|
||||
function "rol" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.14 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.14
|
||||
function "rol" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.15 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.15
|
||||
function "ror" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_RIGHT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.16 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.16
|
||||
function "ror" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_RIGHT(ARG, COUNT)
|
||||
|
||||
--===========================================================================
|
||||
-- RESIZE Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: R.1
|
||||
function RESIZE (ARG: SIGNED; NEW_SIZE: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(NEW_SIZE-1 downto 0)
|
||||
-- Result: Resizes the SIGNED vector ARG to the specified size.
|
||||
-- To create a larger vector, the new [leftmost] bit positions
|
||||
-- are filled with the sign bit (ARG'LEFT). When truncating,
|
||||
-- the sign bit is retained along with the rightmost part.
|
||||
|
||||
-- Id: R.2
|
||||
function RESIZE (ARG: UNSIGNED; NEW_SIZE: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(NEW_SIZE-1 downto 0)
|
||||
-- Result: Resizes the UNSIGNED vector ARG to the specified size.
|
||||
-- To create a larger vector, the new [leftmost] bit positions
|
||||
-- are filled with '0'. When truncating, the leftmost bits
|
||||
-- are dropped.
|
||||
|
||||
--===========================================================================
|
||||
-- Conversion Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: D.1
|
||||
function TO_INTEGER (ARG: UNSIGNED) return NATURAL;
|
||||
-- Result subtype: NATURAL. Value cannot be negative since parameter is an
|
||||
-- UNSIGNED vector.
|
||||
-- Result: Converts the UNSIGNED vector to an INTEGER.
|
||||
|
||||
-- Id: D.2
|
||||
function TO_INTEGER (ARG: SIGNED) return INTEGER;
|
||||
-- Result subtype: INTEGER
|
||||
-- Result: Converts a SIGNED vector to an INTEGER.
|
||||
|
||||
-- Id: D.3
|
||||
function TO_UNSIGNED (ARG, SIZE: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(SIZE-1 downto 0)
|
||||
-- Result: Converts a non-negative INTEGER to an UNSIGNED vector with
|
||||
-- the specified size.
|
||||
|
||||
-- Id: D.4
|
||||
function TO_SIGNED (ARG: INTEGER; SIZE: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(SIZE-1 downto 0)
|
||||
-- Result: Converts an INTEGER to a SIGNED vector of the specified size.
|
||||
|
||||
--===========================================================================
|
||||
-- Logical Operators
|
||||
--===========================================================================
|
||||
|
||||
-- Id: L.1
|
||||
function "not" (L: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Termwise inversion
|
||||
|
||||
-- Id: L.2
|
||||
function "and" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector AND operation
|
||||
|
||||
-- Id: L.3
|
||||
function "or" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector OR operation
|
||||
|
||||
-- Id: L.4
|
||||
function "nand" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NAND operation
|
||||
|
||||
-- Id: L.5
|
||||
function "nor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NOR operation
|
||||
|
||||
-- Id: L.6
|
||||
function "xor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XOR operation
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function L.7 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: L.7
|
||||
function "xnor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XNOR operation
|
||||
|
||||
-- Id: L.8
|
||||
function "not" (L: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Termwise inversion
|
||||
|
||||
-- Id: L.9
|
||||
function "and" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector AND operation
|
||||
|
||||
-- Id: L.10
|
||||
function "or" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector OR operation
|
||||
|
||||
-- Id: L.11
|
||||
function "nand" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NAND operation
|
||||
|
||||
-- Id: L.12
|
||||
function "nor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NOR operation
|
||||
|
||||
-- Id: L.13
|
||||
function "xor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XOR operation
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function L.14 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: L.14
|
||||
function "xnor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XNOR operation
|
||||
|
||||
--===========================================================================
|
||||
-- Edge Detection Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: E.1
|
||||
function RISING_EDGE (signal S: BIT) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Returns TRUE if an event is detected on signal S and the
|
||||
-- value changed from a '0' to a '1'.
|
||||
|
||||
-- Id: E.2
|
||||
function FALLING_EDGE (signal S: BIT) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Returns TRUE if an event is detected on signal S and the
|
||||
-- value changed from a '1' to a '0'.
|
||||
|
||||
end NUMERIC_BIT;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,853 @@
|
||||
-- --------------------------------------------------------------------
|
||||
--
|
||||
-- Copyright 1995 by IEEE. All rights reserved.
|
||||
--
|
||||
--This source file is considered by the IEEE to be an essential part of the use
|
||||
-- of the standard 1076.3 and as such may be distributed without change, except
|
||||
--as permitted by the standard. This source file may not be sold or distributed
|
||||
-- for profit. This package may be modified to include additional data required
|
||||
-- by tools, but must in no way change the external interfaces or simulation
|
||||
-- behaviour of the description. It is permissible to add comments and/or
|
||||
-- attributes to the package declarations, but not to change or delete any
|
||||
-- original lines of the approved package declaration. The package body may be
|
||||
-- changed only in accordance with the terms of clauses 7.1 and 7.2 of the
|
||||
-- standard.
|
||||
--
|
||||
-- Title : Standard VHDL Synthesis Package (1076.3, NUMERIC_STD)
|
||||
--
|
||||
-- Library : This package shall be compiled into a library symbolically
|
||||
-- : named IEEE.
|
||||
--
|
||||
-- Developers : IEEE DASC Synthesis Working Group, PAR 1076.3
|
||||
--
|
||||
-- Purpose : This package defines numeric types and arithmetic functions
|
||||
-- : for use with synthesis tools. Two numeric types are defined:
|
||||
-- : -- > UNSIGNED: represents UNSIGNED number in vector form
|
||||
-- : -- > SIGNED: represents a SIGNED number in vector form
|
||||
-- : The base element type is type STD_LOGIC.
|
||||
-- : The leftmost bit is treated as the most significant bit.
|
||||
-- : Signed vectors are represented in two's complement form.
|
||||
-- : This package contains overloaded arithmetic operators on
|
||||
-- : the SIGNED and UNSIGNED types. The package also contains
|
||||
-- : useful type conversions functions.
|
||||
-- :
|
||||
-- : If any argument to a function is a null array, a null array is
|
||||
-- : returned (exceptions, if any, are noted individually).
|
||||
--
|
||||
-- Limitation :
|
||||
--
|
||||
-- Note : No declarations or definitions shall be included in,
|
||||
-- : or excluded from this package. The "package declaration"
|
||||
-- : defines the types, subtypes and declarations of
|
||||
-- : NUMERIC_STD. The NUMERIC_STD package body shall be
|
||||
-- : considered the formal definition of the semantics of
|
||||
-- : this package. Tool developers may choose to implement
|
||||
-- : the package body in the most efficient manner available
|
||||
-- : to them.
|
||||
--
|
||||
-- --------------------------------------------------------------------
|
||||
-- modification history :
|
||||
-- --------------------------------------------------------------------
|
||||
-- Version: 2.4
|
||||
-- Date : 12 April 1995
|
||||
-- ----------------------------------------------------------------------------
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.all;
|
||||
|
||||
package NUMERIC_STD is
|
||||
constant CopyRightNotice: STRING
|
||||
:= "Copyright 1995 IEEE. All rights reserved.";
|
||||
|
||||
--===========================================================================
|
||||
-- Numeric array type definitions
|
||||
--===========================================================================
|
||||
|
||||
type UNSIGNED is array (NATURAL range <>) of STD_LOGIC;
|
||||
type SIGNED is array (NATURAL range <>) of STD_LOGIC;
|
||||
|
||||
--===========================================================================
|
||||
-- Arithmetic Operators:
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.1
|
||||
function "abs" (ARG: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
|
||||
-- Result: Returns the absolute value of a SIGNED vector ARG.
|
||||
|
||||
-- Id: A.2
|
||||
function "-" (ARG: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
|
||||
-- Result: Returns the value of the unary minus operation on a
|
||||
-- SIGNED vector ARG.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.3
|
||||
function "+" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Adds two UNSIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.4
|
||||
function "+" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Adds two SIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.5
|
||||
function "+" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Adds an UNSIGNED vector, L, with a non-negative INTEGER, R.
|
||||
|
||||
-- Id: A.6
|
||||
function "+" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Adds a non-negative INTEGER, L, with an UNSIGNED vector, R.
|
||||
|
||||
-- Id: A.7
|
||||
function "+" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Adds an INTEGER, L(may be positive or negative), to a SIGNED
|
||||
-- vector, R.
|
||||
|
||||
-- Id: A.8
|
||||
function "+" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Adds a SIGNED vector, L, to an INTEGER, R.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.9
|
||||
function "-" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Subtracts two UNSIGNED vectors that may be of different lengths.
|
||||
|
||||
-- Id: A.10
|
||||
function "-" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
|
||||
-- Result: Subtracts a SIGNED vector, R, from another SIGNED vector, L,
|
||||
-- that may possibly be of different lengths.
|
||||
|
||||
-- Id: A.11
|
||||
function "-" (L: UNSIGNED;R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts a non-negative INTEGER, R, from an UNSIGNED vector, L.
|
||||
|
||||
-- Id: A.12
|
||||
function "-" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts an UNSIGNED vector, R, from a non-negative INTEGER, L.
|
||||
|
||||
-- Id: A.13
|
||||
function "-" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts an INTEGER, R, from a SIGNED vector, L.
|
||||
|
||||
-- Id: A.14
|
||||
function "-" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0).
|
||||
-- Result: Subtracts a SIGNED vector, R, from an INTEGER, L.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: A.15
|
||||
function "*" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((L'LENGTH+R'LENGTH-1) downto 0).
|
||||
-- Result: Performs the multiplication operation on two UNSIGNED vectors
|
||||
-- that may possibly be of different lengths.
|
||||
|
||||
-- Id: A.16
|
||||
function "*" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED((L'LENGTH+R'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies two SIGNED vectors that may possibly be of
|
||||
-- different lengths.
|
||||
|
||||
-- Id: A.17
|
||||
function "*" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((L'LENGTH+L'LENGTH-1) downto 0).
|
||||
-- Result: Multiplies an UNSIGNED vector, L, with a non-negative
|
||||
-- INTEGER, R. R is converted to an UNSIGNED vector of
|
||||
-- SIZE L'LENGTH before multiplication.
|
||||
|
||||
-- Id: A.18
|
||||
function "*" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED((R'LENGTH+R'LENGTH-1) downto 0).
|
||||
-- Result: Multiplies an UNSIGNED vector, R, with a non-negative
|
||||
-- INTEGER, L. L is converted to an UNSIGNED vector of
|
||||
-- SIZE R'LENGTH before multiplication.
|
||||
|
||||
-- Id: A.19
|
||||
function "*" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED((L'LENGTH+L'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies a SIGNED vector, L, with an INTEGER, R. R is
|
||||
-- converted to a SIGNED vector of SIZE L'LENGTH before
|
||||
-- multiplication.
|
||||
|
||||
-- Id: A.20
|
||||
function "*" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED((R'LENGTH+R'LENGTH-1) downto 0)
|
||||
-- Result: Multiplies a SIGNED vector, R, with an INTEGER, L. L is
|
||||
-- converted to a SIGNED vector of SIZE R'LENGTH before
|
||||
-- multiplication.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "/" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.21
|
||||
function "/" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an UNSIGNED vector, L, by another UNSIGNED vector, R.
|
||||
|
||||
-- Id: A.22
|
||||
function "/" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an SIGNED vector, L, by another SIGNED vector, R.
|
||||
|
||||
-- Id: A.23
|
||||
function "/" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides an UNSIGNED vector, L, by a non-negative INTEGER, R.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.24
|
||||
function "/" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Divides a non-negative INTEGER, L, by an UNSIGNED vector, R.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.25
|
||||
function "/" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Divides a SIGNED vector, L, by an INTEGER, R.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.26
|
||||
function "/" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Divides an INTEGER, L, by a SIGNED vector, R.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "rem" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.27
|
||||
function "rem" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L and R are UNSIGNED vectors.
|
||||
|
||||
-- Id: A.28
|
||||
function "rem" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L and R are SIGNED vectors.
|
||||
|
||||
-- Id: A.29
|
||||
function "rem" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L is an UNSIGNED vector and R is a
|
||||
-- non-negative INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.30
|
||||
function "rem" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where R is an UNSIGNED vector and L is a
|
||||
-- non-negative INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.31
|
||||
function "rem" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where L is SIGNED vector and R is an INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.32
|
||||
function "rem" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L rem R" where R is SIGNED vector and L is an INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
--
|
||||
-- NOTE: If second argument is zero for "mod" operator, a severity level
|
||||
-- of ERROR is issued.
|
||||
|
||||
-- Id: A.33
|
||||
function "mod" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L and R are UNSIGNED vectors.
|
||||
|
||||
-- Id: A.34
|
||||
function "mod" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L and R are SIGNED vectors.
|
||||
|
||||
-- Id: A.35
|
||||
function "mod" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is an UNSIGNED vector and R
|
||||
-- is a non-negative INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.36
|
||||
function "mod" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where R is an UNSIGNED vector and L
|
||||
-- is a non-negative INTEGER.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
-- Id: A.37
|
||||
function "mod" (L: SIGNED; R: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
-- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
|
||||
|
||||
-- Id: A.38
|
||||
function "mod" (L: INTEGER; R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(R'LENGTH-1 downto 0)
|
||||
-- Result: Computes "L mod R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
-- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
|
||||
|
||||
--===========================================================================
|
||||
-- Comparison Operators
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.1
|
||||
function ">" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.2
|
||||
function ">" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.3
|
||||
function ">" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.4
|
||||
function ">" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.5
|
||||
function ">" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.6
|
||||
function ">" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L > R" where L is a SIGNED vector and
|
||||
-- R is a INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.7
|
||||
function "<" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.8
|
||||
function "<" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.9
|
||||
function "<" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.10
|
||||
function "<" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.11
|
||||
function "<" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.12
|
||||
function "<" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L < R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.13
|
||||
function "<=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.14
|
||||
function "<=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.15
|
||||
function "<=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.16
|
||||
function "<=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.17
|
||||
function "<=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.18
|
||||
function "<=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L <= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.19
|
||||
function ">=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.20
|
||||
function ">=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.21
|
||||
function ">=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.22
|
||||
function ">=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.23
|
||||
function ">=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.24
|
||||
function ">=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L >= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.25
|
||||
function "=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.26
|
||||
function "=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.27
|
||||
function "=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.28
|
||||
function "=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.29
|
||||
function "=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.30
|
||||
function "=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L = R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: C.31
|
||||
function "/=" (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.32
|
||||
function "/=" (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L and R are SIGNED vectors possibly
|
||||
-- of different lengths.
|
||||
|
||||
-- Id: C.33
|
||||
function "/=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is a non-negative INTEGER and
|
||||
-- R is an UNSIGNED vector.
|
||||
|
||||
-- Id: C.34
|
||||
function "/=" (L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is an INTEGER and
|
||||
-- R is a SIGNED vector.
|
||||
|
||||
-- Id: C.35
|
||||
function "/=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is an UNSIGNED vector and
|
||||
-- R is a non-negative INTEGER.
|
||||
|
||||
-- Id: C.36
|
||||
function "/=" (L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: Computes "L /= R" where L is a SIGNED vector and
|
||||
-- R is an INTEGER.
|
||||
|
||||
--===========================================================================
|
||||
-- Shift and Rotate Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: S.1
|
||||
function SHIFT_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-left on an UNSIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with '0'.
|
||||
-- The COUNT leftmost elements are lost.
|
||||
|
||||
-- Id: S.2
|
||||
function SHIFT_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-right on an UNSIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with '0'.
|
||||
-- The COUNT rightmost elements are lost.
|
||||
|
||||
-- Id: S.3
|
||||
function SHIFT_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-left on a SIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with '0'.
|
||||
-- The COUNT leftmost elements are lost.
|
||||
|
||||
-- Id: S.4
|
||||
function SHIFT_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a shift-right on a SIGNED vector COUNT times.
|
||||
-- The vacated positions are filled with the leftmost
|
||||
-- element, ARG'LEFT. The COUNT rightmost elements are lost.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-- Id: S.5
|
||||
function ROTATE_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a rotate-left of an UNSIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.6
|
||||
function ROTATE_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a rotate-right of an UNSIGNED vector COUNT times.
|
||||
|
||||
-- Id: S.7
|
||||
function ROTATE_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a logical rotate-left of a SIGNED
|
||||
-- vector COUNT times.
|
||||
|
||||
-- Id: S.8
|
||||
function ROTATE_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: Performs a logical rotate-right of a SIGNED
|
||||
-- vector COUNT times.
|
||||
|
||||
--===========================================================================
|
||||
|
||||
--===========================================================================
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.9 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.9
|
||||
function "sll" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.10 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.10
|
||||
function "sll" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.11 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.11
|
||||
function "srl" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SHIFT_RIGHT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.12 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.12
|
||||
function "srl" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: SIGNED(SHIFT_RIGHT(UNSIGNED(ARG), COUNT))
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.13 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.13
|
||||
function "rol" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.14 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.14
|
||||
function "rol" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_LEFT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.15 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.15
|
||||
function "ror" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_RIGHT(ARG, COUNT)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Note : Function S.16 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-----------------------------------------------------------------------------
|
||||
-- Id: S.16
|
||||
function "ror" (ARG: SIGNED; COUNT: INTEGER) return SIGNED;
|
||||
-- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
|
||||
-- Result: ROTATE_RIGHT(ARG, COUNT)
|
||||
|
||||
--===========================================================================
|
||||
-- RESIZE Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: R.1
|
||||
function RESIZE (ARG: SIGNED; NEW_SIZE: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(NEW_SIZE-1 downto 0)
|
||||
-- Result: Resizes the SIGNED vector ARG to the specified size.
|
||||
-- To create a larger vector, the new [leftmost] bit positions
|
||||
-- are filled with the sign bit (ARG'LEFT). When truncating,
|
||||
-- the sign bit is retained along with the rightmost part.
|
||||
|
||||
-- Id: R.2
|
||||
function RESIZE (ARG: UNSIGNED; NEW_SIZE: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(NEW_SIZE-1 downto 0)
|
||||
-- Result: Resizes the SIGNED vector ARG to the specified size.
|
||||
-- To create a larger vector, the new [leftmost] bit positions
|
||||
-- are filled with '0'. When truncating, the leftmost bits
|
||||
-- are dropped.
|
||||
|
||||
--===========================================================================
|
||||
-- Conversion Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: D.1
|
||||
function TO_INTEGER (ARG: UNSIGNED) return NATURAL;
|
||||
-- Result subtype: NATURAL. Value cannot be negative since parameter is an
|
||||
-- UNSIGNED vector.
|
||||
-- Result: Converts the UNSIGNED vector to an INTEGER.
|
||||
|
||||
-- Id: D.2
|
||||
function TO_INTEGER (ARG: SIGNED) return INTEGER;
|
||||
-- Result subtype: INTEGER
|
||||
-- Result: Converts a SIGNED vector to an INTEGER.
|
||||
|
||||
-- Id: D.3
|
||||
function TO_UNSIGNED (ARG, SIZE: NATURAL) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(SIZE-1 downto 0)
|
||||
-- Result: Converts a non-negative INTEGER to an UNSIGNED vector with
|
||||
-- the specified SIZE.
|
||||
|
||||
-- Id: D.4
|
||||
function TO_SIGNED (ARG: INTEGER; SIZE: NATURAL) return SIGNED;
|
||||
-- Result subtype: SIGNED(SIZE-1 downto 0)
|
||||
-- Result: Converts an INTEGER to a SIGNED vector of the specified SIZE.
|
||||
|
||||
--===========================================================================
|
||||
-- Logical Operators
|
||||
--===========================================================================
|
||||
|
||||
-- Id: L.1
|
||||
function "not" (L: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Termwise inversion
|
||||
|
||||
-- Id: L.2
|
||||
function "and" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector AND operation
|
||||
|
||||
-- Id: L.3
|
||||
function "or" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector OR operation
|
||||
|
||||
-- Id: L.4
|
||||
function "nand" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NAND operation
|
||||
|
||||
-- Id: L.5
|
||||
function "nor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NOR operation
|
||||
|
||||
-- Id: L.6
|
||||
function "xor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XOR operation
|
||||
|
||||
-- --------------------------------------------------------------------------
|
||||
-- Note : Function L.7 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-- --------------------------------------------------------------------------
|
||||
-- Id: L.7
|
||||
function "xnor" (L, R: UNSIGNED) return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XNOR operation
|
||||
|
||||
-- Id: L.8
|
||||
function "not" (L: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Termwise inversion
|
||||
|
||||
-- Id: L.9
|
||||
function "and" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector AND operation
|
||||
|
||||
-- Id: L.10
|
||||
function "or" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector OR operation
|
||||
|
||||
-- Id: L.11
|
||||
function "nand" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NAND operation
|
||||
|
||||
-- Id: L.12
|
||||
function "nor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector NOR operation
|
||||
|
||||
-- Id: L.13
|
||||
function "xor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XOR operation
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- Note : Function L.14 is not compatible with VHDL 1076-1987. Comment
|
||||
-- out the function (declaration and body) for VHDL 1076-1987 compatibility.
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- Id: L.14
|
||||
function "xnor" (L, R: SIGNED) return SIGNED;
|
||||
-- Result subtype: SIGNED(L'LENGTH-1 downto 0)
|
||||
-- Result: Vector XNOR operation
|
||||
|
||||
--===========================================================================
|
||||
-- Match Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: M.1
|
||||
function STD_MATCH (L, R: STD_ULOGIC) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
-- Id: M.2
|
||||
function STD_MATCH (L, R: UNSIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
-- Id: M.3
|
||||
function STD_MATCH (L, R: SIGNED) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
-- Id: M.4
|
||||
function STD_MATCH (L, R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
-- Id: M.5
|
||||
function STD_MATCH (L, R: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
-- Result subtype: BOOLEAN
|
||||
-- Result: terms compared per STD_LOGIC_1164 intent
|
||||
|
||||
--===========================================================================
|
||||
-- Translation Functions
|
||||
--===========================================================================
|
||||
|
||||
-- Id: T.1
|
||||
function TO_01 (S: UNSIGNED; XMAP: STD_LOGIC := '0') return UNSIGNED;
|
||||
-- Result subtype: UNSIGNED(S'RANGE)
|
||||
-- Result: Termwise, 'H' is translated to '1', and 'L' is translated
|
||||
-- to '0'. If a value other than '0'|'1'|'H'|'L' is found,
|
||||
-- the array is set to (others => XMAP), and a warning is
|
||||
-- issued.
|
||||
|
||||
-- Id: T.2
|
||||
function TO_01 (S: SIGNED; XMAP: STD_LOGIC := '0') return SIGNED;
|
||||
-- Result subtype: SIGNED(S'RANGE)
|
||||
-- Result: Termwise, 'H' is translated to '1', and 'L' is translated
|
||||
-- to '0'. If a value other than '0'|'1'|'H'|'L' is found,
|
||||
-- the array is set to (others => XMAP), and a warning is
|
||||
-- issued.
|
||||
|
||||
end NUMERIC_STD;
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,178 @@
|
||||
-- --------------------------------------------------------------------
|
||||
--
|
||||
-- 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 of
|
||||
-- : this package. Tool developers may choose to implement
|
||||
-- : the package body in the most efficient manner available
|
||||
-- : to them.
|
||||
-- :
|
||||
-- --------------------------------------------------------------------
|
||||
-- modification history :
|
||||
-- --------------------------------------------------------------------
|
||||
-- version | mod. date:|
|
||||
-- v4.200 | 01/02/92 |
|
||||
-- --------------------------------------------------------------------
|
||||
|
||||
PACKAGE std_logic_1164 IS
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- logic state system (unresolved)
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
);
|
||||
-------------------------------------------------------------------
|
||||
-- unconstrained array of std_ulogic for use with the resolution function
|
||||
-------------------------------------------------------------------
|
||||
TYPE std_ulogic_vector IS ARRAY ( NATURAL RANGE <> ) OF std_ulogic;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- resolution function
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION resolved ( s : std_ulogic_vector ) RETURN std_ulogic;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- *** industry standard logic type ***
|
||||
-------------------------------------------------------------------
|
||||
SUBTYPE std_logic IS resolved std_ulogic;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- unconstrained array of std_logic for use in declaring signal arrays
|
||||
-------------------------------------------------------------------
|
||||
TYPE std_logic_vector IS ARRAY ( NATURAL RANGE <>) OF std_logic;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- common subtypes
|
||||
-------------------------------------------------------------------
|
||||
SUBTYPE X01 IS resolved std_ulogic RANGE 'X' TO '1'; -- ('X','0','1')
|
||||
SUBTYPE X01Z IS resolved std_ulogic RANGE 'X' TO 'Z'; -- ('X','0','1','Z')
|
||||
SUBTYPE UX01 IS resolved std_ulogic RANGE 'U' TO '1'; -- ('U','X','0','1')
|
||||
SUBTYPE UX01Z IS resolved std_ulogic RANGE 'U' TO 'Z'; -- ('U','X','0','1','Z')
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- overloaded logical operators
|
||||
-------------------------------------------------------------------
|
||||
|
||||
FUNCTION "and" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
FUNCTION "nand" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
FUNCTION "or" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
FUNCTION "nor" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
FUNCTION "xor" ( l : std_ulogic; r : std_ulogic ) RETURN UX01;
|
||||
function "xnor" ( l : std_ulogic; r : std_ulogic ) return ux01;
|
||||
FUNCTION "not" ( l : std_ulogic ) RETURN UX01;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- vectorized overloaded logical operators
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION "and" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "and" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
FUNCTION "nand" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "nand" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
FUNCTION "or" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "or" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
FUNCTION "nor" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "nor" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
FUNCTION "xor" ( l, r : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "xor" ( l, r : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
-- -----------------------------------------------------------------------
|
||||
-- Note : The declaration and implementation of the "xnor" function is
|
||||
-- specifically commented until at which time the VHDL language has been
|
||||
-- officially adopted as containing such a function. At such a point,
|
||||
-- the following comments may be removed along with this notice without
|
||||
-- further "official" ballotting of this std_logic_1164 package. It is
|
||||
-- the intent of this effort to provide such a function once it becomes
|
||||
-- available in the VHDL standard.
|
||||
-- -----------------------------------------------------------------------
|
||||
function "xnor" ( l, r : std_logic_vector ) return std_logic_vector;
|
||||
function "xnor" ( l, r : std_ulogic_vector ) return std_ulogic_vector;
|
||||
|
||||
FUNCTION "not" ( l : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION "not" ( l : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- conversion functions
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION To_bit ( s : std_ulogic; xmap : BIT := '0')
|
||||
RETURN BIT;
|
||||
FUNCTION To_bitvector ( s : std_logic_vector ; xmap : BIT := '0')
|
||||
RETURN BIT_VECTOR;
|
||||
FUNCTION To_bitvector ( s : std_ulogic_vector; xmap : BIT := '0')
|
||||
RETURN BIT_VECTOR;
|
||||
|
||||
FUNCTION To_StdULogic (b : BIT ) RETURN std_ulogic;
|
||||
FUNCTION To_StdLogicVector (b : BIT_VECTOR ) RETURN std_logic_vector;
|
||||
FUNCTION To_StdLogicVector (s : std_ulogic_vector) RETURN std_logic_vector;
|
||||
FUNCTION To_StdULogicVector(b : BIT_VECTOR ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_StdULogicVector(s : std_logic_vector) RETURN std_ulogic_vector;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- strength strippers and type convertors
|
||||
-------------------------------------------------------------------
|
||||
|
||||
FUNCTION To_X01 ( s : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION To_X01 ( s : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_X01 ( s : std_ulogic ) RETURN X01;
|
||||
FUNCTION To_X01 ( b : BIT_VECTOR ) RETURN std_logic_vector;
|
||||
FUNCTION To_X01 ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_X01 ( b : BIT ) RETURN X01;
|
||||
|
||||
FUNCTION To_X01Z ( s : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION To_X01Z ( s : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_X01Z ( s : std_ulogic ) RETURN X01Z;
|
||||
FUNCTION To_X01Z ( b : BIT_VECTOR ) RETURN std_logic_vector;
|
||||
FUNCTION To_X01Z ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_X01Z ( b : BIT ) RETURN X01Z;
|
||||
|
||||
FUNCTION To_UX01 ( s : std_logic_vector ) RETURN std_logic_vector;
|
||||
FUNCTION To_UX01 ( s : std_ulogic_vector ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_UX01 ( s : std_ulogic ) RETURN UX01;
|
||||
FUNCTION To_UX01 ( b : BIT_VECTOR ) RETURN std_logic_vector;
|
||||
FUNCTION To_UX01 ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
|
||||
FUNCTION To_UX01 ( b : BIT ) RETURN UX01;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- edge detection
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION rising_edge (SIGNAL s : std_ulogic) RETURN BOOLEAN;
|
||||
FUNCTION falling_edge (SIGNAL s : std_ulogic) RETURN BOOLEAN;
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- object contains an unknown
|
||||
-------------------------------------------------------------------
|
||||
FUNCTION Is_X ( s : std_ulogic_vector ) RETURN BOOLEAN;
|
||||
FUNCTION Is_X ( s : std_logic_vector ) RETURN BOOLEAN;
|
||||
FUNCTION Is_X ( s : std_ulogic ) RETURN BOOLEAN;
|
||||
|
||||
END std_logic_1164;
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,217 @@
|
||||
-- --------------------------------------------------------------------
|
||||
--
|
||||
-- Title : STD_LOGIC_ARITH arithmetic support for STD_ULOGIC/
|
||||
-- : STD_LOGIC_VECTOR data type
|
||||
-- Library : This package shall be compiled into a logical library
|
||||
-- : named IEEE.
|
||||
-- Purpose : To support unsigned arithmetic operations such as
|
||||
-- : addition, subtraction, multiplication etc. for std_ulogic
|
||||
-- : and std_logic_vector data types. Besides it supports
|
||||
-- : functions and operators for Conditional operations,
|
||||
-- : shift operations, relational operation between integer
|
||||
-- : and std_logic_vector types, aligning size between operands
|
||||
-- : of different sizes, type conversion.
|
||||
-- : It also supports a set of arithemtic, conversion, and
|
||||
-- : comparison functions for SIGNED, UNSIGNED, SMALL_INT,
|
||||
-- : INTEGER, STD_ULOGIC, STD_LOGIC, and STD_LOGIC_VECTOR.
|
||||
-- :
|
||||
-- Note : No declarations or definitions shall be included in,
|
||||
-- : or excluded from this package.
|
||||
-- :
|
||||
-- : Modification History: TH, 24th Jan., 1994
|
||||
-- : Following functions are overloaded for STD_ULOGIC_VECTOR
|
||||
-- : type: "+", "-", "*", "cond_op", "<", ">", "<=", ">=", "=",
|
||||
-- : "/=", sh_left, sh_right, align_size and "to_integer"
|
||||
-- : New functions added are:
|
||||
-- : To_StdUlogicVector (oper: INTEGER; length: NATURAL)
|
||||
-- : return STD_ULOGIC_VECTOR
|
||||
-- : "+"(op1: STD_ULOGIC; op2: STD_ULOGIC) return STD_ULOGIC;
|
||||
-- : "-"(op1: STD_ULOGIC; op2: STD_ULOGIC) return STD_ULOGIC;
|
||||
--
|
||||
-- : Name changes from STD_LOGIC_ARITH to STD_LOGIC_ARITH
|
||||
-- : operator "/" added.
|
||||
-- : Vinaya: 13/9/94.
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
|
||||
package STD_LOGIC_ARITH is
|
||||
|
||||
-- ADD/SUBTRACT OPERATORS
|
||||
|
||||
function "+"(op1, op2: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(op1: STD_LOGIC_VECTOR; op2: STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "+"(op1: STD_ULOGIC; op2: STD_LOGIC_VECTOR)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "+"(op1: INTEGER; op2: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(op1: STD_LOGIC_VECTOR; op2: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(op1, op2: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1: STD_ULOGIC_VECTOR; op2: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1: STD_ULOGIC; op2: STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1: INTEGER; op2: STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1: STD_ULOGIC_VECTOR; op2: INTEGER)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "+"(op1, op2 : STD_ULOGIC) return STD_ULOGIC;
|
||||
|
||||
|
||||
function "-"(op1, op2: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(op1: STD_LOGIC_VECTOR; op2: STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "-"(op1: STD_ULOGIC; op2: STD_LOGIC_VECTOR)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "-"(op1: INTEGER; op2: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(op1: STD_LOGIC_VECTOR; op2: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(op1, op2: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1: STD_ULOGIC_VECTOR; op2: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1: STD_ULOGIC; op2: STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1: INTEGER; op2: STD_ULOGIC_VECTOR)return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1: STD_ULOGIC_VECTOR; op2: INTEGER)return STD_ULOGIC_VECTOR;
|
||||
function "-"(op1, op2 : STD_ULOGIC) return STD_ULOGIC;
|
||||
|
||||
-- UNARY OPERATORS
|
||||
|
||||
function "+" (op1: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+" (op1: STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- MULTIPLYING OPERATORS
|
||||
|
||||
function "*" (op1, op2 : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "*" (op1: STD_ULOGIC; op2 : STD_LOGIC_VECTOR)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "*" (op1: STD_LOGIC_VECTOR; op2 : STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "*" (op1, op2 : STD_ULOGIC) return STD_ULOGIC;
|
||||
|
||||
function "*" (op1, op2 : STD_ULOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
function "*" (op1: STD_ULOGIC; op2 : STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function "*" (op1: STD_ULOGIC_VECTOR; op2 : STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- DIVISION OPERATORS
|
||||
-- The division operators are only for internal use
|
||||
-- It is not advisible to use them in design.
|
||||
|
||||
function "/" (op1, op2 : STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "/" (op1: STD_LOGIC_VECTOR; op2 : STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function "/" (op1: STD_ULOGIC; op2 : STD_LOGIC_VECTOR)
|
||||
return STD_ULOGIC;
|
||||
function "/" (op1, op2 : STD_ULOGIC) return STD_ULOGIC;
|
||||
|
||||
|
||||
-- CONDITIONAL FUNCTIONS
|
||||
|
||||
function cond_op (cond : boolean; left_val, right_val: STD_LOGIC_VECTOR)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function cond_op (cond : boolean; left_val, right_val: STD_ULOGIC)
|
||||
return STD_ULOGIC;
|
||||
function cond_op (cond : boolean; left_val, right_val: STD_ULOGIC_VECTOR)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- RELATIONAL OPERATORS
|
||||
|
||||
function "<"(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "<="(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function ">"(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function ">="(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "="(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "/="(op1: INTEGER; op2: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(op1: STD_LOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
|
||||
function "<"(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "<="(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function ">"(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function ">="(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "="(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
function "/="(op1: INTEGER; op2: STD_ULOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(op1: STD_ULOGIC_VECTOR; op2: INTEGER) return BOOLEAN;
|
||||
|
||||
-- SHIFT OPERATORS
|
||||
|
||||
function sh_left(op1: STD_LOGIC_VECTOR; op2: NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function sh_right(op1: STD_LOGIC_VECTOR; op2: NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function sh_left(op1: STD_ULOGIC_VECTOR; op2: NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function sh_right(op1: STD_ULOGIC_VECTOR; op2: NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
|
||||
-- FUNCTIONS TO ALLOW ASSIGNMENTS OF STD_LOGIC_VECTOR OF UNEQUAL SIZES
|
||||
|
||||
|
||||
function align_size (oper : STD_LOGIC_VECTOR; size : NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function align_size (oper : STD_ULOGIC; size : NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function align_size (oper : STD_ULOGIC_VECTOR; size : NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function align_size (oper : STD_ULOGIC; size : NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- CONVERSION TO INTEGER FROM STD_LOGIC AND STD_LOGIC_VECTOR
|
||||
|
||||
function to_integer (oper : STD_LOGIC_VECTOR) return INTEGER;
|
||||
function to_integer (oper: STD_ULOGIC) return INTEGER;
|
||||
function to_integer (oper : STD_ULOGIC_VECTOR) return INTEGER;
|
||||
|
||||
|
||||
-- CONVERSION TO STD_LOGIC_VECTOR FROM INTEGER
|
||||
|
||||
function To_StdLogicVector (oper: INTEGER; length: NATURAL)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function To_StdUlogicVector (oper: INTEGER; length: NATURAL)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- UTILITY FUNCTIONS
|
||||
|
||||
function drive (V: STD_LOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
function drive (V: STD_ULOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function Sense (V: STD_ULOGIC; vZ, vU, vDC: STD_ULOGIC) return STD_ULOGIC;
|
||||
function Sense (V: STD_ULOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
function Sense (V: STD_LOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
-- CONVERSION TABLE FOR TO_INTEGER
|
||||
|
||||
type tbl_type is array (STD_ULOGIC) of STD_ULOGIC;
|
||||
constant tbl_BINARY : tbl_type :=
|
||||
('X', 'X', '0', '1', 'X', 'X', '0', '1', 'X');
|
||||
|
||||
end STD_LOGIC_ARITH;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,192 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990,1991,1992 by Synopsys, Inc. All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_ARITH --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of arithemtic, conversion, and comparison functions --
|
||||
-- for SIGNED, UNSIGNED, SMALL_INT, INTEGER, --
|
||||
-- STD_ULOGIC, STD_LOGIC, and STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
package std_logic_arith is
|
||||
|
||||
type UNSIGNED is array (NATURAL range <>) of STD_LOGIC;
|
||||
type SIGNED is array (NATURAL range <>) of STD_LOGIC;
|
||||
subtype SMALL_INT is INTEGER range 0 to 1;
|
||||
|
||||
function "+"(L: UNSIGNED; R: UNSIGNED) return UNSIGNED;
|
||||
function "+"(L: SIGNED; R: SIGNED) return SIGNED;
|
||||
function "+"(L: UNSIGNED; R: SIGNED) return SIGNED;
|
||||
function "+"(L: SIGNED; R: UNSIGNED) return SIGNED;
|
||||
function "+"(L: UNSIGNED; R: INTEGER) return UNSIGNED;
|
||||
function "+"(L: INTEGER; R: UNSIGNED) return UNSIGNED;
|
||||
function "+"(L: SIGNED; R: INTEGER) return SIGNED;
|
||||
function "+"(L: INTEGER; R: SIGNED) return SIGNED;
|
||||
function "+"(L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED;
|
||||
function "+"(L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED;
|
||||
function "+"(L: SIGNED; R: STD_ULOGIC) return SIGNED;
|
||||
function "+"(L: STD_ULOGIC; R: SIGNED) return SIGNED;
|
||||
|
||||
function "+"(L: UNSIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: UNSIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: UNSIGNED; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: UNSIGNED; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_ULOGIC; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_ULOGIC; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: UNSIGNED; R: UNSIGNED) return UNSIGNED;
|
||||
function "-"(L: SIGNED; R: SIGNED) return SIGNED;
|
||||
function "-"(L: UNSIGNED; R: SIGNED) return SIGNED;
|
||||
function "-"(L: SIGNED; R: UNSIGNED) return SIGNED;
|
||||
function "-"(L: UNSIGNED; R: INTEGER) return UNSIGNED;
|
||||
function "-"(L: INTEGER; R: UNSIGNED) return UNSIGNED;
|
||||
function "-"(L: SIGNED; R: INTEGER) return SIGNED;
|
||||
function "-"(L: INTEGER; R: SIGNED) return SIGNED;
|
||||
function "-"(L: UNSIGNED; R: STD_ULOGIC) return UNSIGNED;
|
||||
function "-"(L: STD_ULOGIC; R: UNSIGNED) return UNSIGNED;
|
||||
function "-"(L: SIGNED; R: STD_ULOGIC) return SIGNED;
|
||||
function "-"(L: STD_ULOGIC; R: SIGNED) return SIGNED;
|
||||
|
||||
function "-"(L: UNSIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: UNSIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: UNSIGNED; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: UNSIGNED; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_ULOGIC; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED; R: STD_ULOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_ULOGIC; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: UNSIGNED) return UNSIGNED;
|
||||
function "+"(L: SIGNED) return SIGNED;
|
||||
function "-"(L: SIGNED) return SIGNED;
|
||||
function "ABS"(L: SIGNED) return SIGNED;
|
||||
|
||||
function "+"(L: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "ABS"(L: SIGNED) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "*"(L: UNSIGNED; R: UNSIGNED) return UNSIGNED;
|
||||
function "*"(L: SIGNED; R: SIGNED) return SIGNED;
|
||||
function "*"(L: SIGNED; R: UNSIGNED) return SIGNED;
|
||||
function "*"(L: UNSIGNED; R: SIGNED) return SIGNED;
|
||||
|
||||
function "*"(L: UNSIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "*"(L: SIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
function "*"(L: SIGNED; R: UNSIGNED) return STD_LOGIC_VECTOR;
|
||||
function "*"(L: UNSIGNED; R: SIGNED) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "<"(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "<"(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "<"(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "<"(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function "<"(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function "<="(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "<="(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "<="(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "<="(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "<="(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function "<="(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function ">"(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function ">"(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function ">"(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function ">"(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function ">"(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function ">"(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function ">="(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function ">="(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function ">="(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function ">="(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function ">="(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function ">="(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function "="(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "="(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "="(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "="(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "="(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function "="(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function "/="(L: UNSIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "/="(L: SIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "/="(L: UNSIGNED; R: SIGNED) return BOOLEAN;
|
||||
function "/="(L: SIGNED; R: UNSIGNED) return BOOLEAN;
|
||||
function "/="(L: UNSIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: UNSIGNED) return BOOLEAN;
|
||||
function "/="(L: SIGNED; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: SIGNED) return BOOLEAN;
|
||||
|
||||
function SHL(ARG: UNSIGNED; COUNT: UNSIGNED) return UNSIGNED;
|
||||
function SHL(ARG: SIGNED; COUNT: UNSIGNED) return SIGNED;
|
||||
function SHR(ARG: UNSIGNED; COUNT: UNSIGNED) return UNSIGNED;
|
||||
function SHR(ARG: SIGNED; COUNT: UNSIGNED) return SIGNED;
|
||||
|
||||
function CONV_INTEGER(ARG: INTEGER) return INTEGER;
|
||||
function CONV_INTEGER(ARG: UNSIGNED) return INTEGER;
|
||||
function CONV_INTEGER(ARG: SIGNED) return INTEGER;
|
||||
function CONV_INTEGER(ARG: STD_ULOGIC) return SMALL_INT;
|
||||
|
||||
function CONV_UNSIGNED(ARG: INTEGER; SIZE: INTEGER) return UNSIGNED;
|
||||
function CONV_UNSIGNED(ARG: UNSIGNED; SIZE: INTEGER) return UNSIGNED;
|
||||
function CONV_UNSIGNED(ARG: SIGNED; SIZE: INTEGER) return UNSIGNED;
|
||||
function CONV_UNSIGNED(ARG: STD_ULOGIC; SIZE: INTEGER) return UNSIGNED;
|
||||
|
||||
function CONV_SIGNED(ARG: INTEGER; SIZE: INTEGER) return SIGNED;
|
||||
function CONV_SIGNED(ARG: UNSIGNED; SIZE: INTEGER) return SIGNED;
|
||||
function CONV_SIGNED(ARG: SIGNED; SIZE: INTEGER) return SIGNED;
|
||||
function CONV_SIGNED(ARG: STD_ULOGIC; SIZE: INTEGER) return SIGNED;
|
||||
|
||||
function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function CONV_STD_LOGIC_VECTOR(ARG: UNSIGNED; SIZE: INTEGER)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function CONV_STD_LOGIC_VECTOR(ARG: SIGNED; SIZE: INTEGER)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function CONV_STD_LOGIC_VECTOR(ARG: STD_ULOGIC; SIZE: INTEGER)
|
||||
return STD_LOGIC_VECTOR;
|
||||
-- zero extend STD_LOGIC_VECTOR (ARG) to SIZE,
|
||||
-- SIZE < 0 is same as SIZE = 0
|
||||
-- returns STD_LOGIC_VECTOR(SIZE-1 downto 0)
|
||||
function EXT(ARG: STD_LOGIC_VECTOR; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
-- sign extend STD_LOGIC_VECTOR (ARG) to SIZE,
|
||||
-- SIZE < 0 is same as SIZE = 0
|
||||
-- return STD_LOGIC_VECTOR(SIZE-1 downto 0)
|
||||
function SXT(ARG: STD_LOGIC_VECTOR; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end Std_logic_arith;
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. --
|
||||
-- All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_SIGNED --
|
||||
-- --
|
||||
-- --
|
||||
-- Date: 09/11/91 KN --
|
||||
-- 10/08/92 AMT change std_ulogic to signed std_logic --
|
||||
-- 10/28/92 AMT added signed functions, -, ABS --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of signed arithemtic, conversion, --
|
||||
-- and comparision functions for STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
-- Note: Comparision of same length std_logic_vector is defined --
|
||||
-- in the LRM. The interpretation is for unsigned vectors --
|
||||
-- This package will "overload" that definition. --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package STD_LOGIC_SIGNED is
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "ABS"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER;
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
-- function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end STD_LOGIC_SIGNED;
|
||||
@@ -0,0 +1,343 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. --
|
||||
-- All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_SIGNED --
|
||||
-- --
|
||||
-- --
|
||||
-- Date: 09/11/91 KN --
|
||||
-- 10/08/92 AMT change std_ulogic to signed std_logic --
|
||||
-- 10/28/92 AMT added signed functions, -, ABS --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of signed arithemtic, conversion, --
|
||||
-- and comparision functions for STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
-- Note: Comparision of same length std_logic_vector is defined --
|
||||
-- in the LRM. The interpretation is for unsigned vectors --
|
||||
-- This package will "overload" that definition. --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package STD_LOGIC_SIGNED is
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "ABS"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER;
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
-- function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end STD_LOGIC_SIGNED;
|
||||
|
||||
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package body STD_LOGIC_SIGNED is
|
||||
|
||||
|
||||
function maximum(L, R: INTEGER) return INTEGER is
|
||||
begin
|
||||
if L > R then
|
||||
return L;
|
||||
else
|
||||
return R;
|
||||
end if;
|
||||
end;
|
||||
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR (length-1 downto 0);
|
||||
begin
|
||||
result := SIGNED(L) + SIGNED(R); -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := SIGNED(L) + R; -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L + SIGNED(R); -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := SIGNED(L) + R; -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L + SIGNED(R); -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR (length-1 downto 0);
|
||||
begin
|
||||
result := SIGNED(L) - SIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := SIGNED(L) - R; -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L - SIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := SIGNED(L) - R; -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L - SIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := + SIGNED(L); -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := - SIGNED(L); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "ABS"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := ABS( SIGNED(L));
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to mult
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR ((L'length+R'length-1) downto 0);
|
||||
begin
|
||||
result := SIGNED(L) * SIGNED(R); -- pragma label mult
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
begin
|
||||
return SIGNED(L) < SIGNED(R); -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
begin
|
||||
return SIGNED(L) < R; -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
begin
|
||||
return L < SIGNED(R); -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return SIGNED(L) <= SIGNED(R); -- pragma label leq
|
||||
end;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return SIGNED(L) <= R; -- pragma label leq
|
||||
end;
|
||||
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return L <= SIGNED(R); -- pragma label leq
|
||||
end;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return SIGNED(L) > SIGNED(R); -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return SIGNED(L) > R; -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return L > SIGNED(R); -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return SIGNED(L) >= SIGNED(R); -- pragma label geq
|
||||
end;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return SIGNED(L) >= R; -- pragma label geq
|
||||
end;
|
||||
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return L >= SIGNED(R); -- pragma label geq
|
||||
end;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return SIGNED(L) = SIGNED(R);
|
||||
end;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
begin
|
||||
return SIGNED(L) = R;
|
||||
end;
|
||||
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return L = SIGNED(R);
|
||||
end;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return SIGNED(L) /= SIGNED(R);
|
||||
end;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
begin
|
||||
return SIGNED(L) /= R;
|
||||
end;
|
||||
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return L /= SIGNED(R);
|
||||
end;
|
||||
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
begin
|
||||
return STD_LOGIC_VECTOR(SHL(SIGNED(ARG),UNSIGNED(COUNT)));
|
||||
end;
|
||||
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
begin
|
||||
return STD_LOGIC_VECTOR(SHR(SIGNED(ARG),UNSIGNED(COUNT)));
|
||||
end;
|
||||
|
||||
|
||||
|
||||
-- This function converts std_logic_vector to a signed integer value
|
||||
-- using a conversion function in std_logic_arith
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER is
|
||||
variable result : SIGNED(ARG'range);
|
||||
begin
|
||||
result := SIGNED(ARG);
|
||||
return CONV_INTEGER(result);
|
||||
end;
|
||||
end STD_LOGIC_SIGNED;
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
--
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. All rights reserved.
|
||||
--
|
||||
-- This source file may be used and distributed without restriction
|
||||
-- provided that this copyright statement is not removed from the file
|
||||
-- and that any derivative work contains this copyright notice.
|
||||
--
|
||||
-- Package name: STD_LOGIC_TEXTIO
|
||||
--
|
||||
-- Purpose: This package overloads the standard TEXTIO procedures
|
||||
-- READ and WRITE.
|
||||
--
|
||||
-- Author: CRC, TS
|
||||
--
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
use STD.textio.all;
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
package STD_LOGIC_TEXTIO is
|
||||
--synopsys synthesis_off
|
||||
-- Read and Write procedures for STD_ULOGIC and STD_ULOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC; GOOD: out BOOLEAN);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out
|
||||
BOOLEAN);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
-- Read and Write procedures for STD_LOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out
|
||||
BOOLEAN);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
--
|
||||
-- Read and Write procedures for Hex and Octal values.
|
||||
-- The values appear in the file as a series of characters
|
||||
-- between 0-F (Hex), or 0-7 (Octal) respectively.
|
||||
--
|
||||
|
||||
-- Hex
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD:
|
||||
out BOOLEAN);
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out
|
||||
BOOLEAN);
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
-- Octal
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD:
|
||||
out BOOLEAN);
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out
|
||||
BOOLEAN);
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
|
||||
--synopsys synthesis_on
|
||||
end STD_LOGIC_TEXTIO;
|
||||
@@ -0,0 +1,634 @@
|
||||
----------------------------------------------------------------------------
|
||||
--
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. All rights reserved.
|
||||
--
|
||||
-- This source file may be used and distributed without restriction
|
||||
-- provided that this copyright statement is not removed from the file
|
||||
-- and that any derivative work contains this copyright notice.
|
||||
--
|
||||
-- Package name: STD_LOGIC_TEXTIO
|
||||
--
|
||||
-- Purpose: This package overloads the standard TEXTIO procedures
|
||||
-- READ and WRITE.
|
||||
--
|
||||
-- Author: CRC, TS
|
||||
--
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
use STD.textio.all;
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
package STD_LOGIC_TEXTIO is
|
||||
--synopsys synthesis_off
|
||||
-- Read and Write procedures for STD_ULOGIC and STD_ULOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC; GOOD: out BOOLEAN);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
-- Read and Write procedures for STD_LOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
--
|
||||
-- Read and Write procedures for Hex and Octal values.
|
||||
-- The values appear in the file as a series of characters
|
||||
-- between 0-F (Hex), or 0-7 (Octal) respectively.
|
||||
--
|
||||
|
||||
-- Hex
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
-- Octal
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
|
||||
--synopsys synthesis_on
|
||||
end STD_LOGIC_TEXTIO;
|
||||
|
||||
package body STD_LOGIC_TEXTIO is
|
||||
--synopsys synthesis_off
|
||||
|
||||
-- Type and constant definitions used to map STD_ULOGIC values
|
||||
-- into/from character values.
|
||||
|
||||
type MVL9plus is ('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-', ERROR);
|
||||
type char_indexed_by_MVL9 is array (STD_ULOGIC) of character;
|
||||
type MVL9_indexed_by_char is array (character) of STD_ULOGIC;
|
||||
type MVL9plus_indexed_by_char is array (character) of MVL9plus;
|
||||
|
||||
constant MVL9_to_char: char_indexed_by_MVL9 := "UX01ZWLH-";
|
||||
constant char_to_MVL9: MVL9_indexed_by_char :=
|
||||
('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
|
||||
'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => 'U');
|
||||
constant char_to_MVL9plus: MVL9plus_indexed_by_char :=
|
||||
('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
|
||||
'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => ERROR);
|
||||
|
||||
|
||||
-- Overloaded procedures.
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC; GOOD:out BOOLEAN) is
|
||||
variable c: character;
|
||||
begin
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
if (char_to_MVL9plus(c) = ERROR) then
|
||||
value := 'U';
|
||||
good := FALSE;
|
||||
else
|
||||
value := char_to_MVL9(c);
|
||||
good := TRUE;
|
||||
end if;
|
||||
end READ;
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD:out BOOLEAN) is
|
||||
variable m: STD_ULOGIC;
|
||||
variable c: character;
|
||||
variable s: string(1 to value'length-1);
|
||||
variable mv: STD_ULOGIC_VECTOR(0 to value'length-1);
|
||||
constant allU: STD_ULOGIC_VECTOR(0 to value'length-1)
|
||||
:= (others => 'U');
|
||||
begin
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
if (char_to_MVL9plus(c) = ERROR) then
|
||||
value := allU;
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(l, s);
|
||||
for i in 1 to value'length-1 loop
|
||||
if (char_to_MVL9plus(s(i)) = ERROR) then
|
||||
value := allU;
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
mv(0) := char_to_MVL9(c);
|
||||
for i in 1 to value'length-1 loop
|
||||
mv(i) := char_to_MVL9(s(i));
|
||||
end loop;
|
||||
value := mv;
|
||||
good := TRUE;
|
||||
end READ;
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC) is
|
||||
variable c: character;
|
||||
begin
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
if (char_to_MVL9plus(c) = ERROR) then
|
||||
value := 'U';
|
||||
assert FALSE report "READ(STD_ULOGIC) Error: Character '" &
|
||||
c & "' read, expected STD_ULOGIC literal.";
|
||||
else
|
||||
value := char_to_MVL9(c);
|
||||
end if;
|
||||
end READ;
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR) is
|
||||
variable m: STD_ULOGIC;
|
||||
variable c: character;
|
||||
variable s: string(1 to value'length-1);
|
||||
variable mv: STD_ULOGIC_VECTOR(0 to value'length-1);
|
||||
constant allU: STD_ULOGIC_VECTOR(0 to value'length-1)
|
||||
:= (others => 'U');
|
||||
begin
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
if (char_to_MVL9plus(c) = ERROR) then
|
||||
value := allU;
|
||||
assert FALSE report
|
||||
"READ(STD_ULOGIC_VECTOR) Error: Character '" &
|
||||
c & "' read, expected STD_ULOGIC literal.";
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(l, s);
|
||||
for i in 1 to value'length-1 loop
|
||||
if (char_to_MVL9plus(s(i)) = ERROR) then
|
||||
value := allU;
|
||||
assert FALSE report
|
||||
"READ(STD_ULOGIC_VECTOR) Error: Character '" &
|
||||
s(i) & "' read, expected STD_ULOGIC literal.";
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
mv(0) := char_to_MVL9(c);
|
||||
for i in 1 to value'length-1 loop
|
||||
mv(i) := char_to_MVL9(s(i));
|
||||
end loop;
|
||||
value := mv;
|
||||
end READ;
|
||||
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
write(l, MVL9_to_char(value), justified, field);
|
||||
end WRITE;
|
||||
|
||||
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
variable s: string(1 to value'length);
|
||||
variable m: STD_ULOGIC_VECTOR(1 to value'length) := value;
|
||||
begin
|
||||
for i in 1 to value'length loop
|
||||
s(i) := MVL9_to_char(m(i));
|
||||
end loop;
|
||||
write(l, s, justified, field);
|
||||
end WRITE;
|
||||
|
||||
-- Read and Write procedures for STD_LOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
READ(L, tmp);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end READ;
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
READ(L, tmp, GOOD);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end READ;
|
||||
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
WRITE(L, STD_ULOGIC_VECTOR(VALUE), JUSTIFIED, FIELD);
|
||||
end WRITE;
|
||||
|
||||
|
||||
--
|
||||
-- Hex Read and Write procedures.
|
||||
--
|
||||
|
||||
--
|
||||
-- Hex, and Octal Read and Write procedures for BIT_VECTOR
|
||||
-- (these procedures are not exported, they are only used
|
||||
-- by the STD_ULOGIC hex/octal reads and writes below.
|
||||
--
|
||||
--
|
||||
|
||||
procedure Char2QuadBits(C: Character;
|
||||
RESULT: out Bit_Vector(3 downto 0);
|
||||
GOOD: out Boolean;
|
||||
ISSUE_ERROR: in Boolean) is
|
||||
begin
|
||||
case c is
|
||||
when '0' => result := x"0"; good := TRUE;
|
||||
when '1' => result := x"1"; good := TRUE;
|
||||
when '2' => result := x"2"; good := TRUE;
|
||||
when '3' => result := x"3"; good := TRUE;
|
||||
when '4' => result := x"4"; good := TRUE;
|
||||
when '5' => result := x"5"; good := TRUE;
|
||||
when '6' => result := x"6"; good := TRUE;
|
||||
when '7' => result := x"7"; good := TRUE;
|
||||
when '8' => result := x"8"; good := TRUE;
|
||||
when '9' => result := x"9"; good := TRUE;
|
||||
when 'A' => result := x"A"; good := TRUE;
|
||||
when 'B' => result := x"B"; good := TRUE;
|
||||
when 'C' => result := x"C"; good := TRUE;
|
||||
when 'D' => result := x"D"; good := TRUE;
|
||||
when 'E' => result := x"E"; good := TRUE;
|
||||
when 'F' => result := x"F"; good := TRUE;
|
||||
|
||||
when 'a' => result := x"A"; good := TRUE;
|
||||
when 'b' => result := x"B"; good := TRUE;
|
||||
when 'c' => result := x"C"; good := TRUE;
|
||||
when 'd' => result := x"D"; good := TRUE;
|
||||
when 'e' => result := x"E"; good := TRUE;
|
||||
when 'f' => result := x"F"; good := TRUE;
|
||||
when others =>
|
||||
if ISSUE_ERROR then
|
||||
assert FALSE report
|
||||
"HREAD Error: Read a '" & c &
|
||||
"', expected a Hex character (0-F).";
|
||||
end if;
|
||||
good := FALSE;
|
||||
end case;
|
||||
end;
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out BIT_VECTOR) is
|
||||
variable ok: boolean;
|
||||
variable c: character;
|
||||
constant ne: integer := value'length/4;
|
||||
variable bv: bit_vector(0 to value'length-1);
|
||||
variable s: string(1 to ne-1);
|
||||
begin
|
||||
if value'length mod 4 /= 0 then
|
||||
assert FALSE report
|
||||
"HREAD Error: Trying to read vector " &
|
||||
"with an odd (non multiple of 4) length";
|
||||
return;
|
||||
end if;
|
||||
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
Char2QuadBits(c, bv(0 to 3), ok, TRUE);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
assert FALSE
|
||||
report "HREAD Error: Failed to read the STRING";
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 1 to ne-1 loop
|
||||
Char2QuadBits(s(i), bv(4*i to 4*i+3), ok, TRUE);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
value := bv;
|
||||
end HREAD;
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out BIT_VECTOR;GOOD: out BOOLEAN) is
|
||||
variable ok: boolean;
|
||||
variable c: character;
|
||||
constant ne: integer := value'length/4;
|
||||
variable bv: bit_vector(0 to value'length-1);
|
||||
variable s: string(1 to ne-1);
|
||||
begin
|
||||
if value'length mod 4 /= 0 then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
Char2QuadBits(c, bv(0 to 3), ok, FALSE);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 1 to ne-1 loop
|
||||
Char2QuadBits(s(i), bv(4*i to 4*i+3), ok, FALSE);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
good := TRUE;
|
||||
value := bv;
|
||||
end HREAD;
|
||||
|
||||
|
||||
procedure HWRITE(L:inout LINE; VALUE:in BIT_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
variable quad: bit_vector(0 to 3);
|
||||
constant ne: integer := value'length/4;
|
||||
variable bv: bit_vector(0 to value'length-1) := value;
|
||||
variable s: string(1 to ne);
|
||||
begin
|
||||
if value'length mod 4 /= 0 then
|
||||
assert FALSE report
|
||||
"HWRITE Error: Trying to read vector " &
|
||||
"with an odd (non multiple of 4) length";
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 0 to ne-1 loop
|
||||
quad := bv(4*i to 4*i+3);
|
||||
case quad is
|
||||
when x"0" => s(i+1) := '0';
|
||||
when x"1" => s(i+1) := '1';
|
||||
when x"2" => s(i+1) := '2';
|
||||
when x"3" => s(i+1) := '3';
|
||||
when x"4" => s(i+1) := '4';
|
||||
when x"5" => s(i+1) := '5';
|
||||
when x"6" => s(i+1) := '6';
|
||||
when x"7" => s(i+1) := '7';
|
||||
when x"8" => s(i+1) := '8';
|
||||
when x"9" => s(i+1) := '9';
|
||||
when x"A" => s(i+1) := 'A';
|
||||
when x"B" => s(i+1) := 'B';
|
||||
when x"C" => s(i+1) := 'C';
|
||||
when x"D" => s(i+1) := 'D';
|
||||
when x"E" => s(i+1) := 'E';
|
||||
when x"F" => s(i+1) := 'F';
|
||||
end case;
|
||||
end loop;
|
||||
write(L, s, JUSTIFIED, FIELD);
|
||||
end HWRITE;
|
||||
|
||||
procedure Char2TriBits(C: Character;
|
||||
RESULT: out bit_vector(2 downto 0);
|
||||
GOOD: out Boolean;
|
||||
ISSUE_ERROR: in Boolean) is
|
||||
begin
|
||||
case c is
|
||||
when '0' => result := o"0"; good := TRUE;
|
||||
when '1' => result := o"1"; good := TRUE;
|
||||
when '2' => result := o"2"; good := TRUE;
|
||||
when '3' => result := o"3"; good := TRUE;
|
||||
when '4' => result := o"4"; good := TRUE;
|
||||
when '5' => result := o"5"; good := TRUE;
|
||||
when '6' => result := o"6"; good := TRUE;
|
||||
when '7' => result := o"7"; good := TRUE;
|
||||
when others =>
|
||||
if ISSUE_ERROR then
|
||||
assert FALSE report
|
||||
"OREAD Error: Read a '" & c &
|
||||
"', expected an Octal character (0-7).";
|
||||
end if;
|
||||
good := FALSE;
|
||||
end case;
|
||||
end;
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out BIT_VECTOR) is
|
||||
variable c: character;
|
||||
variable ok: boolean;
|
||||
constant ne: integer := value'length/3;
|
||||
variable bv: bit_vector(0 to value'length-1);
|
||||
variable s: string(1 to ne-1);
|
||||
begin
|
||||
if value'length mod 3 /= 0 then
|
||||
assert FALSE report
|
||||
"OREAD Error: Trying to read vector " &
|
||||
"with an odd (non multiple of 3) length";
|
||||
return;
|
||||
end if;
|
||||
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
Char2TriBits(c, bv(0 to 2), ok, TRUE);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
assert FALSE
|
||||
report "OREAD Error: Failed to read the STRING";
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 1 to ne-1 loop
|
||||
Char2TriBits(s(i), bv(3*i to 3*i+2), ok, TRUE);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
value := bv;
|
||||
end OREAD;
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out BIT_VECTOR;GOOD: out BOOLEAN) is
|
||||
variable ok: boolean;
|
||||
variable c: character;
|
||||
constant ne: integer := value'length/3;
|
||||
variable bv: bit_vector(0 to value'length-1);
|
||||
variable s: string(1 to ne-1);
|
||||
begin
|
||||
if value'length mod 3 /= 0 then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
Char2TriBits(c, bv(0 to 2), ok, FALSE);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 1 to ne-1 loop
|
||||
Char2TriBits(s(i), bv(3*i to 3*i+2), ok, FALSE);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
good := TRUE;
|
||||
value := bv;
|
||||
end OREAD;
|
||||
|
||||
|
||||
procedure OWRITE(L:inout LINE; VALUE:in BIT_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
variable tri: bit_vector(0 to 2);
|
||||
constant ne: integer := value'length/3;
|
||||
variable bv: bit_vector(0 to value'length-1) := value;
|
||||
variable s: string(1 to ne);
|
||||
begin
|
||||
if value'length mod 3 /= 0 then
|
||||
assert FALSE report
|
||||
"OWRITE Error: Trying to read vector " &
|
||||
"with an odd (non multiple of 3) length";
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 0 to ne-1 loop
|
||||
tri := bv(3*i to 3*i+2);
|
||||
case tri is
|
||||
when o"0" => s(i+1) := '0';
|
||||
when o"1" => s(i+1) := '1';
|
||||
when o"2" => s(i+1) := '2';
|
||||
when o"3" => s(i+1) := '3';
|
||||
when o"4" => s(i+1) := '4';
|
||||
when o"5" => s(i+1) := '5';
|
||||
when o"6" => s(i+1) := '6';
|
||||
when o"7" => s(i+1) := '7';
|
||||
end case;
|
||||
end loop;
|
||||
write(L, s, JUSTIFIED, FIELD);
|
||||
end OWRITE;
|
||||
|
||||
-- Hex Read and Write procedures for STD_LOGIC_VECTOR
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR;GOOD:out BOOLEAN) is
|
||||
variable tmp: bit_vector(VALUE'length-1 downto 0);
|
||||
begin
|
||||
HREAD(L, tmp, GOOD);
|
||||
VALUE := To_X01(tmp);
|
||||
end HREAD;
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR) is
|
||||
variable tmp: bit_vector(VALUE'length-1 downto 0);
|
||||
begin
|
||||
HREAD(L, tmp);
|
||||
VALUE := To_X01(tmp);
|
||||
end HREAD;
|
||||
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
HWRITE(L, To_bitvector(VALUE),JUSTIFIED, FIELD);
|
||||
end HWRITE;
|
||||
|
||||
-- Hex Read and Write procedures for STD_LOGIC_VECTOR
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
HREAD(L, tmp);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end HREAD;
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
HREAD(L, tmp, GOOD);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end HREAD;
|
||||
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
HWRITE(L, To_bitvector(VALUE), JUSTIFIED, FIELD);
|
||||
end HWRITE;
|
||||
|
||||
|
||||
-- Octal Read and Write procedures for STD_ULOGIC_VECTOR
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR;GOOD:out BOOLEAN) is
|
||||
variable tmp: bit_vector(VALUE'length-1 downto 0);
|
||||
begin
|
||||
OREAD(L, tmp, GOOD);
|
||||
VALUE := To_X01(tmp);
|
||||
end OREAD;
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR) is
|
||||
variable tmp: bit_vector(VALUE'length-1 downto 0);
|
||||
begin
|
||||
OREAD(L, tmp);
|
||||
VALUE := To_X01(tmp);
|
||||
end OREAD;
|
||||
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
OWRITE(L, To_bitvector(VALUE),JUSTIFIED, FIELD);
|
||||
end OWRITE;
|
||||
|
||||
-- Octal Read and Write procedures for STD_LOGIC_VECTOR
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
OREAD(L, tmp);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end OREAD;
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
OREAD(L, tmp, GOOD);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end OREAD;
|
||||
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
OWRITE(L, STD_ULOGIC_VECTOR(VALUE), JUSTIFIED, FIELD);
|
||||
end OWRITE;
|
||||
|
||||
|
||||
--synopsys synthesis_on
|
||||
end STD_LOGIC_TEXTIO;
|
||||
@@ -0,0 +1,79 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. --
|
||||
-- All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_UNSIGNED --
|
||||
-- --
|
||||
-- --
|
||||
-- Date: 09/11/92 KN --
|
||||
-- 10/08/92 AMT --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of unsigned arithemtic, conversion, --
|
||||
-- and comparision functions for STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
-- Note: comparision of same length discrete arrays is defined --
|
||||
-- by the LRM. This package will "overload" those --
|
||||
-- definitions --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package STD_LOGIC_UNSIGNED is
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER;
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
-- function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end STD_LOGIC_UNSIGNED;
|
||||
@@ -0,0 +1,329 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. --
|
||||
-- All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_UNSIGNED --
|
||||
-- --
|
||||
-- --
|
||||
-- Date: 09/11/92 KN --
|
||||
-- 10/08/92 AMT --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of unsigned arithemtic, conversion, --
|
||||
-- and comparision functions for STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
-- Note: comparision of same length discrete arrays is defined --
|
||||
-- by the LRM. This package will "overload" those --
|
||||
-- definitions --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package STD_LOGIC_UNSIGNED is
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER;
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
-- function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end STD_LOGIC_UNSIGNED;
|
||||
|
||||
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package body STD_LOGIC_UNSIGNED is
|
||||
|
||||
|
||||
function maximum(L, R: INTEGER) return INTEGER is
|
||||
begin
|
||||
if L > R then
|
||||
return L;
|
||||
else
|
||||
return R;
|
||||
end if;
|
||||
end;
|
||||
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR (length-1 downto 0);
|
||||
begin
|
||||
result := UNSIGNED(L) + UNSIGNED(R);-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := UNSIGNED(L) + R;-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L + UNSIGNED(R);-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := UNSIGNED(L) + R;-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L + UNSIGNED(R);-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR (length-1 downto 0);
|
||||
begin
|
||||
result := UNSIGNED(L) - UNSIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := UNSIGNED(L) - R; -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L - UNSIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR is
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := UNSIGNED(L) - R;
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L - UNSIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := + UNSIGNED(L);
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to mult
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR ((L'length+R'length-1) downto 0);
|
||||
begin
|
||||
result := UNSIGNED(L) * UNSIGNED(R); -- pragma label mult
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
begin
|
||||
return UNSIGNED(L) < UNSIGNED(R); -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
begin
|
||||
return UNSIGNED(L) < R; -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
begin
|
||||
return L < UNSIGNED(R); -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return UNSIGNED(L) <= UNSIGNED(R); -- pragma label leq
|
||||
end;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return UNSIGNED(L) <= R; -- pragma label leq
|
||||
end;
|
||||
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return L <= UNSIGNED(R); -- pragma label leq
|
||||
end;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return UNSIGNED(L) > UNSIGNED(R); -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return UNSIGNED(L) > R; -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return L > UNSIGNED(R); -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return UNSIGNED(L) >= UNSIGNED(R); -- pragma label geq
|
||||
end;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return UNSIGNED(L) >= R; -- pragma label geq
|
||||
end;
|
||||
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return L >= UNSIGNED(R); -- pragma label geq
|
||||
end;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return UNSIGNED(L) = UNSIGNED(R);
|
||||
end;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
begin
|
||||
return UNSIGNED(L) = R;
|
||||
end;
|
||||
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return L = UNSIGNED(R);
|
||||
end;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return UNSIGNED(L) /= UNSIGNED(R);
|
||||
end;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
begin
|
||||
return UNSIGNED(L) /= R;
|
||||
end;
|
||||
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return L /= UNSIGNED(R);
|
||||
end;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER is
|
||||
variable result : UNSIGNED(ARG'range);
|
||||
begin
|
||||
result := UNSIGNED(ARG);
|
||||
return CONV_INTEGER(result);
|
||||
end;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
begin
|
||||
return STD_LOGIC_VECTOR(SHL(UNSIGNED(ARG),UNSIGNED(COUNT)));
|
||||
end;
|
||||
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
begin
|
||||
return STD_LOGIC_VECTOR(SHR(UNSIGNED(ARG),UNSIGNED(COUNT)));
|
||||
end;
|
||||
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
--function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR is
|
||||
--variable result1 : UNSIGNED (SIZE-1 downto 0);
|
||||
--variable result2 : STD_LOGIC_VECTOR (SIZE-1 downto 0);
|
||||
--begin
|
||||
--result1 := CONV_UNSIGNED(ARG,SIZE);
|
||||
--return std_logic_vector(result1);
|
||||
--end;
|
||||
|
||||
|
||||
end STD_LOGIC_UNSIGNED;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,130 @@
|
||||
-- Std.Textio package declaration. This file is part of GHDL.
|
||||
-- This file was written from the clause 14.3 of the VHDL LRM.
|
||||
-- Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
|
||||
--
|
||||
-- GHDL is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU General Public License as published by the Free
|
||||
-- Software Foundation; either version 2, or (at your option) any later
|
||||
-- version.
|
||||
--
|
||||
-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
-- for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with GCC; see the file COPYING. If not, write to the Free
|
||||
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
-- 02111-1307, USA.
|
||||
|
||||
package textio is
|
||||
|
||||
-- type definitions for text i/o
|
||||
|
||||
-- a LINE is a pointer to a string value.
|
||||
type line is access string;
|
||||
|
||||
-- A file of variable-length ASCII records.
|
||||
-- Note: in order to work correctly, the TEXT file type must be declared in
|
||||
-- the textio package of library std. Otherwise, a file of string has a
|
||||
-- non-ASCII format.
|
||||
type text is file of string;
|
||||
|
||||
type side is (right, left); -- For justifying ouput data within fields.
|
||||
subtype width is natural; -- For specifying widths of output fields.
|
||||
|
||||
-- standard text files
|
||||
|
||||
file input: text is in "STD_INPUT"; --V87
|
||||
file output: text is out "STD_OUTPUT"; --V87
|
||||
file input : text open read_mode is "STD_INPUT"; --V93
|
||||
file output : text open write_mode is "STD_OUTPUT"; --V93
|
||||
|
||||
-- input routines for standard types
|
||||
|
||||
procedure readline (variable f: in text; l: inout line); --V87
|
||||
procedure readline (file f: text; l: inout line); --V93
|
||||
|
||||
-- For READ procedures:
|
||||
-- In this implementation, any L is accepted (ie, there is no constraints
|
||||
-- on direction, or left bound). Therefore, even variable of type LINE
|
||||
-- not initialized by READLINE are accepted. Strictly speaking, this is
|
||||
-- not required by LRM, nor prevented. However, other implementations may
|
||||
-- fail at parsing such strings.
|
||||
--
|
||||
-- Also, in case of error (GOOD is false), this implementation do not
|
||||
-- modify L (as specified by the LRM) nor VALUE.
|
||||
--
|
||||
-- For READ procedures without a GOOD argument, an assertion fails in case
|
||||
-- of error.
|
||||
--
|
||||
-- In case of overflow (ie, if the number is out of the bounds of the type),
|
||||
-- the procedure will fail with an execution error.
|
||||
-- FIXME: this should not occur for a bad string.
|
||||
|
||||
procedure read (l: inout line; value: out bit; good: out boolean);
|
||||
procedure read (l: inout line; value: out bit);
|
||||
|
||||
procedure read (l: inout line; value: out bit_vector; good: out boolean);
|
||||
procedure read (l: inout line; value: out bit_vector);
|
||||
|
||||
procedure read (l: inout line; value: out boolean; good: out boolean);
|
||||
procedure read (l: inout line; value: out boolean);
|
||||
|
||||
procedure read (l: inout line; value: out character; good: out boolean);
|
||||
procedure read (l: inout line; value: out character);
|
||||
|
||||
procedure read (l: inout line; value: out integer; good: out boolean);
|
||||
procedure read (l: inout line; value: out integer);
|
||||
|
||||
procedure read (l: inout line; value: out real; good: out boolean);
|
||||
procedure read (l: inout line; value: out real);
|
||||
|
||||
procedure read (l: inout line; value: out string; good: out boolean);
|
||||
procedure read (l: inout line; value: out string);
|
||||
|
||||
-- This implementation requires no space after the unit identifier,
|
||||
-- ie "7.5 nsv" is parsed as 7.5 ns.
|
||||
-- The unit identifier can be in lower case, upper case or mixed case.
|
||||
procedure read (l: inout line; value: out time; good: out boolean);
|
||||
procedure read (l: inout line; value: out time);
|
||||
|
||||
-- output routines for standard types
|
||||
|
||||
procedure writeline (variable f: out text; l: inout line); --V87
|
||||
procedure writeline (file f: text; l: inout line); --V93
|
||||
|
||||
-- This implementation accept any value for all the types.
|
||||
procedure write
|
||||
(l: inout line; value: in bit;
|
||||
justified: in side := right; field: in width := 0);
|
||||
procedure write
|
||||
(l: inout line; value: in bit_vector;
|
||||
justified: in side := right; field: in width := 0);
|
||||
procedure write
|
||||
(l: inout line; value: in boolean;
|
||||
justified: in side := right; field: in width := 0);
|
||||
procedure write
|
||||
(l: inout line; value: in character;
|
||||
justified: in side := right; field: in width := 0);
|
||||
procedure write
|
||||
(l: inout line; value: in integer;
|
||||
justified: in side := right; field: in width := 0);
|
||||
procedure write
|
||||
(L: inout line; value: in real;
|
||||
justified: in side := right; field: in width := 0;
|
||||
digits: in natural := 0);
|
||||
procedure write
|
||||
(l: inout line; value: in string;
|
||||
justified: in side := right; field: in width := 0);
|
||||
|
||||
-- UNIT must be a unit name declared in std.standard. Of course, no rules
|
||||
-- in the core VHDL language prevent you from using a value that is not a
|
||||
-- unit (eg: 10 ns or even 5 fs).
|
||||
-- An assertion error message is generated in this case, and question mark
|
||||
-- (?) is written at the place of the unit name.
|
||||
procedure write
|
||||
(l: inout line; value : in time;
|
||||
justified: in side := right; field: in width := 0; unit : in TIME := ns);
|
||||
|
||||
end textio;
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,966 @@
|
||||
--------------------------------------------------------------------------
|
||||
--
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. All rights reserved.
|
||||
--
|
||||
-- This source file may be used and distributed without restriction
|
||||
-- provided that this copyright statement is not removed from the file
|
||||
-- and that any derivative work contains this copyright notice.
|
||||
--
|
||||
-- Package name: std_logic_misc
|
||||
--
|
||||
-- Purpose: This package defines supplemental types, subtypes,
|
||||
-- constants, and functions for the Std_logic_1164 Package.
|
||||
--
|
||||
-- Author: GWH
|
||||
--
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.all;
|
||||
library SYNOPSYS;
|
||||
use SYNOPSYS.attributes.all;
|
||||
|
||||
|
||||
package std_logic_misc is
|
||||
|
||||
-- output-strength types
|
||||
|
||||
type STRENGTH is (strn_X01, strn_X0H, strn_XL1, strn_X0Z, strn_XZ1,
|
||||
strn_WLH, strn_WLZ, strn_WZH, strn_W0H, strn_WL1);
|
||||
|
||||
|
||||
--synopsys synthesis_off
|
||||
|
||||
type MINOMAX is array (1 to 3) of TIME;
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- functions for mapping the STD_(U)LOGIC according to STRENGTH
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
function strength_map(input: STD_ULOGIC; strn: STRENGTH) return STD_LOGIC;
|
||||
|
||||
function strength_map_z(input:STD_ULOGIC; strn:STRENGTH) return STD_LOGIC;
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- conversion functions for STD_ULOGIC_VECTOR and STD_LOGIC_VECTOR
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
--synopsys synthesis_on
|
||||
function Drive (V: STD_ULOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function Drive (V: STD_LOGIC_VECTOR) return STD_ULOGIC_VECTOR;
|
||||
--synopsys synthesis_off
|
||||
|
||||
attribute CLOSELY_RELATED_TCF of Drive: function is TRUE;
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- conversion functions for sensing various types
|
||||
-- (the second argument allows the user to specify the value to
|
||||
-- be returned when the network is undriven)
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
function Sense (V: STD_ULOGIC; vZ, vU, vDC: STD_ULOGIC) return STD_LOGIC;
|
||||
|
||||
function Sense (V: STD_ULOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function Sense (V: STD_ULOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
function Sense (V: STD_LOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR;
|
||||
function Sense (V: STD_LOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR;
|
||||
|
||||
--synopsys synthesis_on
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- Function: STD_LOGIC_VECTORtoBIT_VECTOR STD_ULOGIC_VECTORtoBIT_VECTOR
|
||||
--
|
||||
-- Purpose: Conversion fun. from STD_(U)LOGIC_VECTOR to BIT_VECTOR
|
||||
--
|
||||
-- Mapping: 0, L --> 0
|
||||
-- 1, H --> 1
|
||||
-- X, W --> vX if Xflag is TRUE
|
||||
-- X, W --> 0 if Xflag is FALSE
|
||||
-- Z --> vZ if Zflag is TRUE
|
||||
-- Z --> 0 if Zflag is FALSE
|
||||
-- U --> vU if Uflag is TRUE
|
||||
-- U --> 0 if Uflag is FALSE
|
||||
-- - --> vDC if DCflag is TRUE
|
||||
-- - --> 0 if DCflag is FALSE
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
function STD_LOGIC_VECTORtoBIT_VECTOR (V: STD_LOGIC_VECTOR
|
||||
--synopsys synthesis_off
|
||||
; vX, vZ, vU, vDC: BIT := '0';
|
||||
Xflag, Zflag, Uflag, DCflag: BOOLEAN := FALSE
|
||||
--synopsys synthesis_on
|
||||
) return BIT_VECTOR;
|
||||
|
||||
function STD_ULOGIC_VECTORtoBIT_VECTOR (V: STD_ULOGIC_VECTOR
|
||||
--synopsys synthesis_off
|
||||
; vX, vZ, vU, vDC: BIT := '0';
|
||||
Xflag, Zflag, Uflag, DCflag: BOOLEAN := FALSE
|
||||
--synopsys synthesis_on
|
||||
) return BIT_VECTOR;
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- Function: STD_ULOGICtoBIT
|
||||
--
|
||||
-- Purpose: Conversion function from STD_(U)LOGIC to BIT
|
||||
--
|
||||
-- Mapping: 0, L --> 0
|
||||
-- 1, H --> 1
|
||||
-- X, W --> vX if Xflag is TRUE
|
||||
-- X, W --> 0 if Xflag is FALSE
|
||||
-- Z --> vZ if Zflag is TRUE
|
||||
-- Z --> 0 if Zflag is FALSE
|
||||
-- U --> vU if Uflag is TRUE
|
||||
-- U --> 0 if Uflag is FALSE
|
||||
-- - --> vDC if DCflag is TRUE
|
||||
-- - --> 0 if DCflag is FALSE
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
function STD_ULOGICtoBIT (V: STD_ULOGIC
|
||||
--synopsys synthesis_off
|
||||
; vX, vZ, vU, vDC: BIT := '0';
|
||||
Xflag, Zflag, Uflag, DCflag: BOOLEAN := FALSE
|
||||
--synopsys synthesis_on
|
||||
) return BIT;
|
||||
|
||||
--------------------------------------------------------------------
|
||||
function AND_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01;
|
||||
function NAND_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01;
|
||||
function OR_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01;
|
||||
function NOR_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01;
|
||||
function XOR_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01;
|
||||
function XNOR_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01;
|
||||
|
||||
function AND_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01;
|
||||
function NAND_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01;
|
||||
function OR_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01;
|
||||
function NOR_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01;
|
||||
function XOR_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01;
|
||||
function XNOR_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01;
|
||||
|
||||
--synopsys synthesis_off
|
||||
|
||||
function fun_BUF3S(Input, Enable: UX01; Strn: STRENGTH) return STD_LOGIC;
|
||||
function fun_BUF3SL(Input, Enable: UX01; Strn: STRENGTH) return STD_LOGIC;
|
||||
function fun_MUX2x1(Input0, Input1, Sel: UX01) return UX01;
|
||||
|
||||
function fun_MAJ23(Input0, Input1, Input2: UX01) return UX01;
|
||||
function fun_WiredX(Input0, Input1: std_ulogic) return STD_LOGIC;
|
||||
|
||||
--synopsys synthesis_on
|
||||
|
||||
end;
|
||||
|
||||
|
||||
package body std_logic_misc is
|
||||
|
||||
--synopsys synthesis_off
|
||||
|
||||
type STRN_STD_ULOGIC_TABLE is array (STD_ULOGIC,STRENGTH) of STD_ULOGIC;
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Truth tables for output strength --> STD_ULOGIC lookup
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
-- truth table for output strength --> STD_ULOGIC lookup
|
||||
constant tbl_STRN_STD_ULOGIC: STRN_STD_ULOGIC_TABLE :=
|
||||
-- ------------------------------------------------------------------
|
||||
-- | X01 X0H XL1 X0Z XZ1 WLH WLZ WZH W0H WL1 | strn/ output|
|
||||
-- ------------------------------------------------------------------
|
||||
(('U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U'), -- | U |
|
||||
('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'), -- | X |
|
||||
('0', '0', 'L', '0', 'Z', 'L', 'L', 'Z', '0', 'L'), -- | 0 |
|
||||
('1', 'H', '1', 'Z', '1', 'H', 'Z', 'H', 'H', '1'), -- | 1 |
|
||||
('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'), -- | Z |
|
||||
('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'), -- | W |
|
||||
('0', '0', 'L', '0', 'Z', 'L', 'L', 'Z', '0', 'L'), -- | L |
|
||||
('1', 'H', '1', 'Z', '1', 'H', 'Z', 'H', 'H', '1'), -- | H |
|
||||
('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W')); -- | - |
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Truth tables for strength --> STD_ULOGIC mapping ('Z' pass through)
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
-- truth table for output strength --> STD_ULOGIC lookup
|
||||
constant tbl_STRN_STD_ULOGIC_Z: STRN_STD_ULOGIC_TABLE :=
|
||||
-- ------------------------------------------------------------------
|
||||
-- | X01 X0H XL1 X0Z XZ1 WLH WLZ WZH W0H WL1 | strn/ output|
|
||||
-- ------------------------------------------------------------------
|
||||
(('U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U'), -- | U |
|
||||
('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'), -- | X |
|
||||
('0', '0', 'L', '0', 'Z', 'L', 'L', 'Z', '0', 'L'), -- | 0 |
|
||||
('1', 'H', '1', 'Z', '1', 'H', 'Z', 'H', 'H', '1'), -- | 1 |
|
||||
('Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'), -- | Z |
|
||||
('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W'), -- | W |
|
||||
('0', '0', 'L', '0', 'Z', 'L', 'L', 'Z', '0', 'L'), -- | L |
|
||||
('1', 'H', '1', 'Z', '1', 'H', 'Z', 'H', 'H', '1'), -- | H |
|
||||
('X', 'X', 'X', 'X', 'X', 'W', 'W', 'W', 'W', 'W')); -- | - |
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- functions for mapping the STD_(U)LOGIC according to STRENGTH
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
function strength_map(input: STD_ULOGIC; strn: STRENGTH) return STD_LOGIC is
|
||||
-- pragma subpgm_id 387
|
||||
begin
|
||||
return tbl_STRN_STD_ULOGIC(input, strn);
|
||||
end strength_map;
|
||||
|
||||
|
||||
function strength_map_z(input:STD_ULOGIC; strn:STRENGTH) return STD_LOGIC is
|
||||
-- pragma subpgm_id 388
|
||||
begin
|
||||
return tbl_STRN_STD_ULOGIC_Z(input, strn);
|
||||
end strength_map_z;
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- conversion functions for STD_LOGIC_VECTOR and STD_ULOGIC_VECTOR
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
--synopsys synthesis_on
|
||||
function Drive (V: STD_LOGIC_VECTOR) return STD_ULOGIC_VECTOR is
|
||||
-- pragma built_in SYN_FEED_THRU
|
||||
-- pragma subpgm_id 389
|
||||
--synopsys synthesis_off
|
||||
alias Value: STD_LOGIC_VECTOR (V'length-1 downto 0) is V;
|
||||
--synopsys synthesis_on
|
||||
begin
|
||||
--synopsys synthesis_off
|
||||
return STD_ULOGIC_VECTOR(Value);
|
||||
--synopsys synthesis_on
|
||||
end Drive;
|
||||
|
||||
|
||||
function Drive (V: STD_ULOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma built_in SYN_FEED_THRU
|
||||
-- pragma subpgm_id 390
|
||||
--synopsys synthesis_off
|
||||
alias Value: STD_ULOGIC_VECTOR (V'length-1 downto 0) is V;
|
||||
--synopsys synthesis_on
|
||||
begin
|
||||
--synopsys synthesis_off
|
||||
return STD_LOGIC_VECTOR(Value);
|
||||
--synopsys synthesis_on
|
||||
end Drive;
|
||||
--synopsys synthesis_off
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- conversion functions for sensing various types
|
||||
--
|
||||
-- (the second argument allows the user to specify the value to
|
||||
-- be returned when the network is undriven)
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
function Sense (V: STD_ULOGIC; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_LOGIC is
|
||||
-- pragma subpgm_id 391
|
||||
begin
|
||||
if V = 'Z' then
|
||||
return vZ;
|
||||
elsif V = 'U' then
|
||||
return vU;
|
||||
elsif V = '-' then
|
||||
return vDC;
|
||||
else
|
||||
return V;
|
||||
end if;
|
||||
end Sense;
|
||||
|
||||
|
||||
function Sense (V: STD_ULOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR is
|
||||
-- pragma subpgm_id 392
|
||||
alias Value: STD_ULOGIC_VECTOR (V'length-1 downto 0) is V;
|
||||
variable Result: STD_LOGIC_VECTOR (V'length-1 downto 0);
|
||||
begin
|
||||
for i in Value'range loop
|
||||
if ( Value(i) = 'Z' ) then
|
||||
Result(i) := vZ;
|
||||
elsif Value(i) = 'U' then
|
||||
Result(i) := vU;
|
||||
elsif Value(i) = '-' then
|
||||
Result(i) := vDC;
|
||||
else
|
||||
Result(i) := Value(i);
|
||||
end if;
|
||||
end loop;
|
||||
return Result;
|
||||
end Sense;
|
||||
|
||||
|
||||
function Sense (V: STD_ULOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR is
|
||||
-- pragma subpgm_id 393
|
||||
alias Value: STD_ULOGIC_VECTOR (V'length-1 downto 0) is V;
|
||||
variable Result: STD_ULOGIC_VECTOR (V'length-1 downto 0);
|
||||
begin
|
||||
for i in Value'range loop
|
||||
if ( Value(i) = 'Z' ) then
|
||||
Result(i) := vZ;
|
||||
elsif Value(i) = 'U' then
|
||||
Result(i) := vU;
|
||||
elsif Value(i) = '-' then
|
||||
Result(i) := vDC;
|
||||
else
|
||||
Result(i) := Value(i);
|
||||
end if;
|
||||
end loop;
|
||||
return Result;
|
||||
end Sense;
|
||||
|
||||
|
||||
function Sense (V: STD_LOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_LOGIC_VECTOR is
|
||||
-- pragma subpgm_id 394
|
||||
alias Value: STD_LOGIC_VECTOR (V'length-1 downto 0) is V;
|
||||
variable Result: STD_LOGIC_VECTOR (V'length-1 downto 0);
|
||||
begin
|
||||
for i in Value'range loop
|
||||
if ( Value(i) = 'Z' ) then
|
||||
Result(i) := vZ;
|
||||
elsif Value(i) = 'U' then
|
||||
Result(i) := vU;
|
||||
elsif Value(i) = '-' then
|
||||
Result(i) := vDC;
|
||||
else
|
||||
Result(i) := Value(i);
|
||||
end if;
|
||||
end loop;
|
||||
return Result;
|
||||
end Sense;
|
||||
|
||||
|
||||
function Sense (V: STD_LOGIC_VECTOR; vZ, vU, vDC: STD_ULOGIC)
|
||||
return STD_ULOGIC_VECTOR is
|
||||
-- pragma subpgm_id 395
|
||||
alias Value: STD_LOGIC_VECTOR (V'length-1 downto 0) is V;
|
||||
variable Result: STD_ULOGIC_VECTOR (V'length-1 downto 0);
|
||||
begin
|
||||
for i in Value'range loop
|
||||
if ( Value(i) = 'Z' ) then
|
||||
Result(i) := vZ;
|
||||
elsif Value(i) = 'U' then
|
||||
Result(i) := vU;
|
||||
elsif Value(i) = '-' then
|
||||
Result(i) := vDC;
|
||||
else
|
||||
Result(i) := Value(i);
|
||||
end if;
|
||||
end loop;
|
||||
return Result;
|
||||
end Sense;
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- Function: STD_LOGIC_VECTORtoBIT_VECTOR
|
||||
--
|
||||
-- Purpose: Conversion fun. from STD_LOGIC_VECTOR to BIT_VECTOR
|
||||
--
|
||||
-- Mapping: 0, L --> 0
|
||||
-- 1, H --> 1
|
||||
-- X, W --> vX if Xflag is TRUE
|
||||
-- X, W --> 0 if Xflag is FALSE
|
||||
-- Z --> vZ if Zflag is TRUE
|
||||
-- Z --> 0 if Zflag is FALSE
|
||||
-- U --> vU if Uflag is TRUE
|
||||
-- U --> 0 if Uflag is FALSE
|
||||
-- - --> vDC if DCflag is TRUE
|
||||
-- - --> 0 if DCflag is FALSE
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
--synopsys synthesis_on
|
||||
function STD_LOGIC_VECTORtoBIT_VECTOR (V: STD_LOGIC_VECTOR
|
||||
--synopsys synthesis_off
|
||||
; vX, vZ, vU, vDC: BIT := '0';
|
||||
Xflag, Zflag, Uflag, DCflag: BOOLEAN := FALSE
|
||||
--synopsys synthesis_on
|
||||
) return BIT_VECTOR is
|
||||
-- pragma built_in SYN_FEED_THRU
|
||||
-- pragma subpgm_id 396
|
||||
--synopsys synthesis_off
|
||||
alias Value: STD_LOGIC_VECTOR (V'length-1 downto 0) is V;
|
||||
variable Result: BIT_VECTOR (V'length-1 downto 0);
|
||||
--synopsys synthesis_on
|
||||
begin
|
||||
--synopsys synthesis_off
|
||||
for i in Value'range loop
|
||||
case Value(i) is
|
||||
when '0' | 'L' =>
|
||||
Result(i) := '0';
|
||||
when '1' | 'H' =>
|
||||
Result(i) := '1';
|
||||
when 'X' =>
|
||||
if ( Xflag ) then
|
||||
Result(i) := vX;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_LOGIC_VECTORtoBIT_VECTOR: X --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when 'W' =>
|
||||
if ( Xflag ) then
|
||||
Result(i) := vX;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_LOGIC_VECTORtoBIT_VECTOR: W --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when 'Z' =>
|
||||
if ( Zflag ) then
|
||||
Result(i) := vZ;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_LOGIC_VECTORtoBIT_VECTOR: Z --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when 'U' =>
|
||||
if ( Uflag ) then
|
||||
Result(i) := vU;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_LOGIC_VECTORtoBIT_VECTOR: U --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when '-' =>
|
||||
if ( DCflag ) then
|
||||
Result(i) := vDC;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_LOGIC_VECTORtoBIT_VECTOR: - --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
end case;
|
||||
end loop;
|
||||
return Result;
|
||||
--synopsys synthesis_on
|
||||
end STD_LOGIC_VECTORtoBIT_VECTOR;
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- Function: STD_ULOGIC_VECTORtoBIT_VECTOR
|
||||
--
|
||||
-- Purpose: Conversion fun. from STD_ULOGIC_VECTOR to BIT_VECTOR
|
||||
--
|
||||
-- Mapping: 0, L --> 0
|
||||
-- 1, H --> 1
|
||||
-- X, W --> vX if Xflag is TRUE
|
||||
-- X, W --> 0 if Xflag is FALSE
|
||||
-- Z --> vZ if Zflag is TRUE
|
||||
-- Z --> 0 if Zflag is FALSE
|
||||
-- U --> vU if Uflag is TRUE
|
||||
-- U --> 0 if Uflag is FALSE
|
||||
-- - --> vDC if DCflag is TRUE
|
||||
-- - --> 0 if DCflag is FALSE
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
function STD_ULOGIC_VECTORtoBIT_VECTOR (V: STD_ULOGIC_VECTOR
|
||||
--synopsys synthesis_off
|
||||
; vX, vZ, vU, vDC: BIT := '0';
|
||||
Xflag, Zflag, Uflag, DCflag: BOOLEAN := FALSE
|
||||
--synopsys synthesis_on
|
||||
) return BIT_VECTOR is
|
||||
-- pragma built_in SYN_FEED_THRU
|
||||
-- pragma subpgm_id 397
|
||||
--synopsys synthesis_off
|
||||
alias Value: STD_ULOGIC_VECTOR (V'length-1 downto 0) is V;
|
||||
variable Result: BIT_VECTOR (V'length-1 downto 0);
|
||||
--synopsys synthesis_on
|
||||
begin
|
||||
--synopsys synthesis_off
|
||||
for i in Value'range loop
|
||||
case Value(i) is
|
||||
when '0' | 'L' =>
|
||||
Result(i) := '0';
|
||||
when '1' | 'H' =>
|
||||
Result(i) := '1';
|
||||
when 'X' =>
|
||||
if ( Xflag ) then
|
||||
Result(i) := vX;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGIC_VECTORtoBIT_VECTOR: X --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when 'W' =>
|
||||
if ( Xflag ) then
|
||||
Result(i) := vX;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGIC_VECTORtoBIT_VECTOR: W --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when 'Z' =>
|
||||
if ( Zflag ) then
|
||||
Result(i) := vZ;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGIC_VECTORtoBIT_VECTOR: Z --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when 'U' =>
|
||||
if ( Uflag ) then
|
||||
Result(i) := vU;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGIC_VECTORtoBIT_VECTOR: U --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when '-' =>
|
||||
if ( DCflag ) then
|
||||
Result(i) := vDC;
|
||||
else
|
||||
Result(i) := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGIC_VECTORtoBIT_VECTOR: - --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
end case;
|
||||
end loop;
|
||||
return Result;
|
||||
--synopsys synthesis_on
|
||||
end STD_ULOGIC_VECTORtoBIT_VECTOR;
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--
|
||||
-- Function: STD_ULOGICtoBIT
|
||||
--
|
||||
-- Purpose: Conversion function from STD_ULOGIC to BIT
|
||||
--
|
||||
-- Mapping: 0, L --> 0
|
||||
-- 1, H --> 1
|
||||
-- X, W --> vX if Xflag is TRUE
|
||||
-- X, W --> 0 if Xflag is FALSE
|
||||
-- Z --> vZ if Zflag is TRUE
|
||||
-- Z --> 0 if Zflag is FALSE
|
||||
-- U --> vU if Uflag is TRUE
|
||||
-- U --> 0 if Uflag is FALSE
|
||||
-- - --> vDC if DCflag is TRUE
|
||||
-- - --> 0 if DCflag is FALSE
|
||||
--
|
||||
---------------------------------------------------------------------
|
||||
|
||||
function STD_ULOGICtoBIT (V: STD_ULOGIC
|
||||
--synopsys synthesis_off
|
||||
; vX, vZ, vU, vDC: BIT := '0';
|
||||
Xflag, Zflag, Uflag, DCflag: BOOLEAN := FALSE
|
||||
--synopsys synthesis_on
|
||||
) return BIT is
|
||||
-- pragma built_in SYN_FEED_THRU
|
||||
-- pragma subpgm_id 398
|
||||
variable Result: BIT;
|
||||
begin
|
||||
--synopsys synthesis_off
|
||||
case V is
|
||||
when '0' | 'L' =>
|
||||
Result := '0';
|
||||
when '1' | 'H' =>
|
||||
Result := '1';
|
||||
when 'X' =>
|
||||
if ( Xflag ) then
|
||||
Result := vX;
|
||||
else
|
||||
Result := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGICtoBIT: X --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when 'W' =>
|
||||
if ( Xflag ) then
|
||||
Result := vX;
|
||||
else
|
||||
Result := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGICtoBIT: W --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when 'Z' =>
|
||||
if ( Zflag ) then
|
||||
Result := vZ;
|
||||
else
|
||||
Result := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGICtoBIT: Z --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when 'U' =>
|
||||
if ( Uflag ) then
|
||||
Result := vU;
|
||||
else
|
||||
Result := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGICtoBIT: U --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
when '-' =>
|
||||
if ( DCflag ) then
|
||||
Result := vDC;
|
||||
else
|
||||
Result := '0';
|
||||
assert FALSE
|
||||
report "STD_ULOGICtoBIT: - --> 0"
|
||||
severity WARNING;
|
||||
end if;
|
||||
end case;
|
||||
return Result;
|
||||
--synopsys synthesis_on
|
||||
end STD_ULOGICtoBIT;
|
||||
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
function AND_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 399
|
||||
variable result: STD_LOGIC;
|
||||
begin
|
||||
result := '1';
|
||||
for i in ARG'range loop
|
||||
result := result and ARG(i);
|
||||
end loop;
|
||||
return result;
|
||||
end;
|
||||
|
||||
function NAND_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 400
|
||||
begin
|
||||
return not AND_REDUCE(ARG);
|
||||
end;
|
||||
|
||||
function OR_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 401
|
||||
variable result: STD_LOGIC;
|
||||
begin
|
||||
result := '0';
|
||||
for i in ARG'range loop
|
||||
result := result or ARG(i);
|
||||
end loop;
|
||||
return result;
|
||||
end;
|
||||
|
||||
function NOR_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 402
|
||||
begin
|
||||
return not OR_REDUCE(ARG);
|
||||
end;
|
||||
|
||||
function XOR_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 403
|
||||
variable result: STD_LOGIC;
|
||||
begin
|
||||
result := '0';
|
||||
for i in ARG'range loop
|
||||
result := result xor ARG(i);
|
||||
end loop;
|
||||
return result;
|
||||
end;
|
||||
|
||||
function XNOR_REDUCE(ARG: STD_LOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 404
|
||||
begin
|
||||
return not XOR_REDUCE(ARG);
|
||||
end;
|
||||
|
||||
function AND_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 405
|
||||
variable result: STD_LOGIC;
|
||||
begin
|
||||
result := '1';
|
||||
for i in ARG'range loop
|
||||
result := result and ARG(i);
|
||||
end loop;
|
||||
return result;
|
||||
end;
|
||||
|
||||
function NAND_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 406
|
||||
begin
|
||||
return not AND_REDUCE(ARG);
|
||||
end;
|
||||
|
||||
function OR_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 407
|
||||
variable result: STD_LOGIC;
|
||||
begin
|
||||
result := '0';
|
||||
for i in ARG'range loop
|
||||
result := result or ARG(i);
|
||||
end loop;
|
||||
return result;
|
||||
end;
|
||||
|
||||
function NOR_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 408
|
||||
begin
|
||||
return not OR_REDUCE(ARG);
|
||||
end;
|
||||
|
||||
function XOR_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 409
|
||||
variable result: STD_LOGIC;
|
||||
begin
|
||||
result := '0';
|
||||
for i in ARG'range loop
|
||||
result := result xor ARG(i);
|
||||
end loop;
|
||||
return result;
|
||||
end;
|
||||
|
||||
function XNOR_REDUCE(ARG: STD_ULOGIC_VECTOR) return UX01 is
|
||||
-- pragma subpgm_id 410
|
||||
begin
|
||||
return not XOR_REDUCE(ARG);
|
||||
end;
|
||||
|
||||
--synopsys synthesis_off
|
||||
|
||||
function fun_BUF3S(Input, Enable: UX01; Strn: STRENGTH) return STD_LOGIC is
|
||||
-- pragma subpgm_id 411
|
||||
type TRISTATE_TABLE is array(STRENGTH, UX01, UX01) of STD_LOGIC;
|
||||
|
||||
-- truth table for tristate "buf" function (Enable active Low)
|
||||
constant tbl_BUF3S: TRISTATE_TABLE :=
|
||||
-- ----------------------------------------------------
|
||||
-- | Input U X 0 1 | Enable Strength |
|
||||
-- ---------------------------------|-----------------|
|
||||
((('U', 'U', 'U', 'U'), --| U X01 |
|
||||
('U', 'X', 'X', 'X'), --| X X01 |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 X01 |
|
||||
('U', 'X', '0', '1')), --| 1 X01 |
|
||||
(('U', 'U', 'U', 'U'), --| U X0H |
|
||||
('U', 'X', 'X', 'X'), --| X X0H |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 X0H |
|
||||
('U', 'X', '0', 'H')), --| 1 X0H |
|
||||
(('U', 'U', 'U', 'U'), --| U XL1 |
|
||||
('U', 'X', 'X', 'X'), --| X XL1 |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 XL1 |
|
||||
('U', 'X', 'L', '1')), --| 1 XL1 |
|
||||
(('U', 'U', 'U', 'Z'), --| U X0Z |
|
||||
('U', 'X', 'X', 'Z'), --| X X0Z |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 X0Z |
|
||||
('U', 'X', '0', 'Z')), --| 1 X0Z |
|
||||
(('U', 'U', 'U', 'U'), --| U XZ1 |
|
||||
('U', 'X', 'X', 'X'), --| X XZ1 |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 XZ1 |
|
||||
('U', 'X', 'Z', '1')), --| 1 XZ1 |
|
||||
(('U', 'U', 'U', 'U'), --| U WLH |
|
||||
('U', 'W', 'W', 'W'), --| X WLH |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 WLH |
|
||||
('U', 'W', 'L', 'H')), --| 1 WLH |
|
||||
(('U', 'U', 'U', 'U'), --| U WLZ |
|
||||
('U', 'W', 'W', 'Z'), --| X WLZ |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 WLZ |
|
||||
('U', 'W', 'L', 'Z')), --| 1 WLZ |
|
||||
(('U', 'U', 'U', 'U'), --| U WZH |
|
||||
('U', 'W', 'W', 'W'), --| X WZH |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 WZH |
|
||||
('U', 'W', 'Z', 'H')), --| 1 WZH |
|
||||
(('U', 'U', 'U', 'U'), --| U W0H |
|
||||
('U', 'W', 'W', 'W'), --| X W0H |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 W0H |
|
||||
('U', 'W', '0', 'H')), --| 1 W0H |
|
||||
(('U', 'U', 'U', 'U'), --| U WL1 |
|
||||
('U', 'W', 'W', 'W'), --| X WL1 |
|
||||
('Z', 'Z', 'Z', 'Z'), --| 0 WL1 |
|
||||
('U', 'W', 'L', '1')));--| 1 WL1 |
|
||||
begin
|
||||
return tbl_BUF3S(Strn, Enable, Input);
|
||||
end fun_BUF3S;
|
||||
|
||||
|
||||
function fun_BUF3SL(Input, Enable: UX01; Strn: STRENGTH) return STD_LOGIC is
|
||||
-- pragma subpgm_id 412
|
||||
type TRISTATE_TABLE is array(STRENGTH, UX01, UX01) of STD_LOGIC;
|
||||
|
||||
-- truth table for tristate "buf" function (Enable active Low)
|
||||
constant tbl_BUF3SL: TRISTATE_TABLE :=
|
||||
-- ----------------------------------------------------
|
||||
-- | Input U X 0 1 | Enable Strength |
|
||||
-- ---------------------------------|-----------------|
|
||||
((('U', 'U', 'U', 'U'), --| U X01 |
|
||||
('U', 'X', 'X', 'X'), --| X X01 |
|
||||
('U', 'X', '0', '1'), --| 0 X01 |
|
||||
('Z', 'Z', 'Z', 'Z')), --| 1 X01 |
|
||||
(('U', 'U', 'U', 'U'), --| U X0H |
|
||||
('U', 'X', 'X', 'X'), --| X X0H |
|
||||
('U', 'X', '0', 'H'), --| 0 X0H |
|
||||
('Z', 'Z', 'Z', 'Z')), --| 1 X0H |
|
||||
(('U', 'U', 'U', 'U'), --| U XL1 |
|
||||
('U', 'X', 'X', 'X'), --| X XL1 |
|
||||
('U', 'X', 'L', '1'), --| 0 XL1 |
|
||||
('Z', 'Z', 'Z', 'Z')), --| 1 XL1 |
|
||||
(('U', 'U', 'U', 'Z'), --| U X0Z |
|
||||
('U', 'X', 'X', 'Z'), --| X X0Z |
|
||||
('U', 'X', '0', 'Z'), --| 0 X0Z |
|
||||
('Z', 'Z', 'Z', 'Z')), --| 1 X0Z |
|
||||
(('U', 'U', 'U', 'U'), --| U XZ1 |
|
||||
('U', 'X', 'X', 'X'), --| X XZ1 |
|
||||
('U', 'X', 'Z', '1'), --| 0 XZ1 |
|
||||
('Z', 'Z', 'Z', 'Z')), --| 1 XZ1 |
|
||||
(('U', 'U', 'U', 'U'), --| U WLH |
|
||||
('U', 'W', 'W', 'W'), --| X WLH |
|
||||
('U', 'W', 'L', 'H'), --| 0 WLH |
|
||||
('Z', 'Z', 'Z', 'Z')), --| 1 WLH |
|
||||
(('U', 'U', 'U', 'U'), --| U WLZ |
|
||||
('U', 'W', 'W', 'Z'), --| X WLZ |
|
||||
('U', 'W', 'L', 'Z'), --| 0 WLZ |
|
||||
('Z', 'Z', 'Z', 'Z')), --| 1 WLZ |
|
||||
(('U', 'U', 'U', 'U'), --| U WZH |
|
||||
('U', 'W', 'W', 'W'), --| X WZH |
|
||||
('U', 'W', 'Z', 'H'), --| 0 WZH |
|
||||
('Z', 'Z', 'Z', 'Z')), --| 1 WZH |
|
||||
(('U', 'U', 'U', 'U'), --| U W0H |
|
||||
('U', 'W', 'W', 'W'), --| X W0H |
|
||||
('U', 'W', '0', 'H'), --| 0 W0H |
|
||||
('Z', 'Z', 'Z', 'Z')), --| 1 W0H |
|
||||
(('U', 'U', 'U', 'U'), --| U WL1 |
|
||||
('U', 'W', 'W', 'W'), --| X WL1 |
|
||||
('U', 'W', 'L', '1'), --| 0 WL1 |
|
||||
('Z', 'Z', 'Z', 'Z')));--| 1 WL1 |
|
||||
begin
|
||||
return tbl_BUF3SL(Strn, Enable, Input);
|
||||
end fun_BUF3SL;
|
||||
|
||||
|
||||
function fun_MUX2x1(Input0, Input1, Sel: UX01) return UX01 is
|
||||
-- pragma subpgm_id 413
|
||||
type MUX_TABLE is array (UX01, UX01, UX01) of UX01;
|
||||
|
||||
-- truth table for "MUX2x1" function
|
||||
constant tbl_MUX2x1: MUX_TABLE :=
|
||||
--------------------------------------------
|
||||
--| In0 'U' 'X' '0' '1' | Sel In1 |
|
||||
--------------------------------------------
|
||||
((('U', 'U', 'U', 'U'), --| 'U' 'U' |
|
||||
('U', 'U', 'U', 'U'), --| 'X' 'U' |
|
||||
('U', 'X', '0', '1'), --| '0' 'U' |
|
||||
('U', 'U', 'U', 'U')), --| '1' 'U' |
|
||||
(('U', 'X', 'U', 'U'), --| 'U' 'X' |
|
||||
('U', 'X', 'X', 'X'), --| 'X' 'X' |
|
||||
('U', 'X', '0', '1'), --| '0' 'X' |
|
||||
('X', 'X', 'X', 'X')), --| '1' 'X' |
|
||||
(('U', 'U', '0', 'U'), --| 'U' '0' |
|
||||
('U', 'X', '0', 'X'), --| 'X' '0' |
|
||||
('U', 'X', '0', '1'), --| '0' '0' |
|
||||
('0', '0', '0', '0')), --| '1' '0' |
|
||||
(('U', 'U', 'U', '1'), --| 'U' '1' |
|
||||
('U', 'X', 'X', '1'), --| 'X' '1' |
|
||||
('U', 'X', '0', '1'), --| '0' '1' |
|
||||
('1', '1', '1', '1')));--| '1' '1' |
|
||||
begin
|
||||
return tbl_MUX2x1(Input1, Sel, Input0);
|
||||
end fun_MUX2x1;
|
||||
|
||||
|
||||
function fun_MAJ23(Input0, Input1, Input2: UX01) return UX01 is
|
||||
-- pragma subpgm_id 414
|
||||
type MAJ23_TABLE is array (UX01, UX01, UX01) of UX01;
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-- The "tbl_MAJ23" truth table return 1 if the majority of three
|
||||
-- inputs is 1, a 0 if the majority is 0, a X if unknown, and a U if
|
||||
-- uninitialized.
|
||||
----------------------------------------------------------------------------
|
||||
constant tbl_MAJ23: MAJ23_TABLE :=
|
||||
--------------------------------------------
|
||||
--| In0 'U' 'X' '0' '1' | In1 In2 |
|
||||
--------------------------------------------
|
||||
((('U', 'U', 'U', 'U'), --| 'U' 'U' |
|
||||
('U', 'U', 'U', 'U'), --| 'X' 'U' |
|
||||
('U', 'U', '0', 'U'), --| '0' 'U' |
|
||||
('U', 'U', 'U', '1')), --| '1' 'U' |
|
||||
(('U', 'U', 'U', 'U'), --| 'U' 'X' |
|
||||
('U', 'X', 'X', 'X'), --| 'X' 'X' |
|
||||
('U', 'X', '0', 'X'), --| '0' 'X' |
|
||||
('U', 'X', 'X', '1')), --| '1' 'X' |
|
||||
(('U', 'U', '0', 'U'), --| 'U' '0' |
|
||||
('U', 'X', '0', 'X'), --| 'X' '0' |
|
||||
('0', '0', '0', '0'), --| '0' '0' |
|
||||
('U', 'X', '0', '1')), --| '1' '0' |
|
||||
(('U', 'U', 'U', '1'), --| 'U' '1' |
|
||||
('U', 'X', 'X', '1'), --| 'X' '1' |
|
||||
('U', 'X', '0', '1'), --| '0' '1' |
|
||||
('1', '1', '1', '1')));--| '1' '1' |
|
||||
|
||||
begin
|
||||
return tbl_MAJ23(Input0, Input1, Input2);
|
||||
end fun_MAJ23;
|
||||
|
||||
|
||||
function fun_WiredX(Input0, Input1: STD_ULOGIC) return STD_LOGIC is
|
||||
-- pragma subpgm_id 415
|
||||
TYPE stdlogic_table IS ARRAY(STD_ULOGIC, STD_ULOGIC) OF STD_LOGIC;
|
||||
|
||||
-- truth table for "WiredX" function
|
||||
-------------------------------------------------------------------
|
||||
-- resolution function
|
||||
-------------------------------------------------------------------
|
||||
CONSTANT resolution_table : stdlogic_table := (
|
||||
-- ---------------------------------------------------------
|
||||
-- | U X 0 1 Z W L H - | |
|
||||
-- ---------------------------------------------------------
|
||||
( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ), -- | U |
|
||||
( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | X |
|
||||
( 'U', 'X', '0', 'X', '0', '0', '0', '0', 'X' ), -- | 0 |
|
||||
( 'U', 'X', 'X', '1', '1', '1', '1', '1', 'X' ), -- | 1 |
|
||||
( 'U', 'X', '0', '1', 'Z', 'W', 'L', 'H', 'X' ), -- | Z |
|
||||
( 'U', 'X', '0', '1', 'W', 'W', 'W', 'W', 'X' ), -- | W |
|
||||
( 'U', 'X', '0', '1', 'L', 'W', 'L', 'W', 'X' ), -- | L |
|
||||
( 'U', 'X', '0', '1', 'H', 'W', 'W', 'H', 'X' ), -- | H |
|
||||
( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ));-- | - |
|
||||
begin
|
||||
return resolution_table(Input0, Input1);
|
||||
end fun_WiredX;
|
||||
|
||||
--synopsys synthesis_on
|
||||
|
||||
end;
|
||||
@@ -0,0 +1,343 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. --
|
||||
-- All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_SIGNED --
|
||||
-- --
|
||||
-- --
|
||||
-- Date: 09/11/91 KN --
|
||||
-- 10/08/92 AMT change std_ulogic to signed std_logic --
|
||||
-- 10/28/92 AMT added signed functions, -, ABS --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of signed arithemtic, conversion, --
|
||||
-- and comparision functions for STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
-- Note: Comparision of same length std_logic_vector is defined --
|
||||
-- in the LRM. The interpretation is for unsigned vectors --
|
||||
-- This package will "overload" that definition. --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package STD_LOGIC_SIGNED is
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "ABS"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER;
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
-- function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end STD_LOGIC_SIGNED;
|
||||
|
||||
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package body STD_LOGIC_SIGNED is
|
||||
|
||||
|
||||
function maximum(L, R: INTEGER) return INTEGER is
|
||||
begin
|
||||
if L > R then
|
||||
return L;
|
||||
else
|
||||
return R;
|
||||
end if;
|
||||
end;
|
||||
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR (length-1 downto 0);
|
||||
begin
|
||||
result := SIGNED(L) + SIGNED(R); -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := SIGNED(L) + R; -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L + SIGNED(R); -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := SIGNED(L) + R; -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L + SIGNED(R); -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR (length-1 downto 0);
|
||||
begin
|
||||
result := SIGNED(L) - SIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := SIGNED(L) - R; -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L - SIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := SIGNED(L) - R; -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L - SIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := + SIGNED(L); -- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := - SIGNED(L); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "ABS"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := ABS( SIGNED(L));
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to mult
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR ((L'length+R'length-1) downto 0);
|
||||
begin
|
||||
result := SIGNED(L) * SIGNED(R); -- pragma label mult
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
begin
|
||||
return SIGNED(L) < SIGNED(R); -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
begin
|
||||
return SIGNED(L) < R; -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
begin
|
||||
return L < SIGNED(R); -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return SIGNED(L) <= SIGNED(R); -- pragma label leq
|
||||
end;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return SIGNED(L) <= R; -- pragma label leq
|
||||
end;
|
||||
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return L <= SIGNED(R); -- pragma label leq
|
||||
end;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return SIGNED(L) > SIGNED(R); -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return SIGNED(L) > R; -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return L > SIGNED(R); -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return SIGNED(L) >= SIGNED(R); -- pragma label geq
|
||||
end;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return SIGNED(L) >= R; -- pragma label geq
|
||||
end;
|
||||
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return L >= SIGNED(R); -- pragma label geq
|
||||
end;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return SIGNED(L) = SIGNED(R);
|
||||
end;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
begin
|
||||
return SIGNED(L) = R;
|
||||
end;
|
||||
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return L = SIGNED(R);
|
||||
end;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return SIGNED(L) /= SIGNED(R);
|
||||
end;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
begin
|
||||
return SIGNED(L) /= R;
|
||||
end;
|
||||
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return L /= SIGNED(R);
|
||||
end;
|
||||
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
begin
|
||||
return STD_LOGIC_VECTOR(SHL(SIGNED(ARG),UNSIGNED(COUNT)));
|
||||
end;
|
||||
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
begin
|
||||
return STD_LOGIC_VECTOR(SHR(SIGNED(ARG),UNSIGNED(COUNT)));
|
||||
end;
|
||||
|
||||
|
||||
|
||||
-- This function converts std_logic_vector to a signed integer value
|
||||
-- using a conversion function in std_logic_arith
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER is
|
||||
variable result : SIGNED(ARG'range);
|
||||
begin
|
||||
result := SIGNED(ARG);
|
||||
return CONV_INTEGER(result);
|
||||
end;
|
||||
end STD_LOGIC_SIGNED;
|
||||
|
||||
|
||||
@@ -0,0 +1,654 @@
|
||||
----------------------------------------------------------------------------
|
||||
--
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. All rights reserved.
|
||||
--
|
||||
-- This source file may be used and distributed without restriction
|
||||
-- provided that this copyright statement is not removed from the file
|
||||
-- and that any derivative work contains this copyright notice.
|
||||
--
|
||||
-- Package name: STD_LOGIC_TEXTIO
|
||||
--
|
||||
-- Purpose: This package overloads the standard TEXTIO procedures
|
||||
-- READ and WRITE.
|
||||
--
|
||||
-- Author: CRC, TS
|
||||
--
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
use STD.textio.all;
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
package STD_LOGIC_TEXTIO is
|
||||
--synopsys synthesis_off
|
||||
-- Read and Write procedures for STD_ULOGIC and STD_ULOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC; GOOD: out BOOLEAN);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
-- Read and Write procedures for STD_LOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
--
|
||||
-- Read and Write procedures for Hex and Octal values.
|
||||
-- The values appear in the file as a series of characters
|
||||
-- between 0-F (Hex), or 0-7 (Octal) respectively.
|
||||
--
|
||||
|
||||
-- Hex
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
-- Octal
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN);
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
|
||||
|
||||
|
||||
--synopsys synthesis_on
|
||||
end STD_LOGIC_TEXTIO;
|
||||
|
||||
package body STD_LOGIC_TEXTIO is
|
||||
--synopsys synthesis_off
|
||||
|
||||
-- Type and constant definitions used to map STD_ULOGIC values
|
||||
-- into/from character values.
|
||||
|
||||
type MVL9plus is ('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-', ERROR);
|
||||
type char_indexed_by_MVL9 is array (STD_ULOGIC) of character;
|
||||
type MVL9_indexed_by_char is array (character) of STD_ULOGIC;
|
||||
type MVL9plus_indexed_by_char is array (character) of MVL9plus;
|
||||
|
||||
constant MVL9_to_char: char_indexed_by_MVL9 := "UX01ZWLH-";
|
||||
constant char_to_MVL9: MVL9_indexed_by_char :=
|
||||
('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
|
||||
'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => 'U');
|
||||
constant char_to_MVL9plus: MVL9plus_indexed_by_char :=
|
||||
('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
|
||||
'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => ERROR);
|
||||
|
||||
|
||||
-- Overloaded procedures.
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC; GOOD:out BOOLEAN) is
|
||||
variable c: character;
|
||||
variable readOk: BOOLEAN;
|
||||
begin
|
||||
loop -- skip white space
|
||||
read(l,c,readOk); -- but also exit on a bad read
|
||||
exit when ((readOk = FALSE) or ((c /= ' ') and (c /= CR) and (c /= HT)));
|
||||
end loop;
|
||||
|
||||
if (readOk = FALSE) then
|
||||
good := FALSE;
|
||||
else
|
||||
if (char_to_MVL9plus(c) = ERROR) then
|
||||
value := 'U';
|
||||
good := FALSE;
|
||||
else
|
||||
value := char_to_MVL9(c);
|
||||
good := TRUE;
|
||||
end if;
|
||||
end if;
|
||||
end READ;
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD:out BOOLEAN) is
|
||||
variable m: STD_ULOGIC;
|
||||
variable c: character;
|
||||
variable s: string(1 to value'length-1);
|
||||
variable mv: STD_ULOGIC_VECTOR(0 to value'length-1);
|
||||
constant allU: STD_ULOGIC_VECTOR(0 to value'length-1)
|
||||
:= (others => 'U');
|
||||
variable readOk: BOOLEAN;
|
||||
|
||||
begin
|
||||
loop -- skip white space
|
||||
read(l,c,readOk);
|
||||
exit when ((readOk = FALSE) or ((c /= ' ') and (c /= CR) and (c /= HT)));
|
||||
end loop;
|
||||
|
||||
-- Bail out if there was a bad read
|
||||
if (readOk = FALSE) then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
if (char_to_MVL9plus(c) = ERROR) then
|
||||
value := allU;
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(l, s, readOk);
|
||||
-- Bail out if there was a bad read
|
||||
if (readOk = FALSE) then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 1 to value'length-1 loop
|
||||
if (char_to_MVL9plus(s(i)) = ERROR) then
|
||||
value := allU;
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
mv(0) := char_to_MVL9(c);
|
||||
for i in 1 to value'length-1 loop
|
||||
mv(i) := char_to_MVL9(s(i));
|
||||
end loop;
|
||||
value := mv;
|
||||
good := TRUE;
|
||||
end READ;
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC) is
|
||||
variable c: character;
|
||||
begin
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
if (char_to_MVL9plus(c) = ERROR) then
|
||||
value := 'U';
|
||||
assert FALSE report "READ(STD_ULOGIC) Error: Character '" &
|
||||
c & "' read, expected STD_ULOGIC literal.";
|
||||
else
|
||||
value := char_to_MVL9(c);
|
||||
end if;
|
||||
end READ;
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR) is
|
||||
variable m: STD_ULOGIC;
|
||||
variable c: character;
|
||||
variable s: string(1 to value'length-1);
|
||||
variable mv: STD_ULOGIC_VECTOR(0 to value'length-1);
|
||||
constant allU: STD_ULOGIC_VECTOR(0 to value'length-1)
|
||||
:= (others => 'U');
|
||||
begin
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
if (char_to_MVL9plus(c) = ERROR) then
|
||||
value := allU;
|
||||
assert FALSE report
|
||||
"READ(STD_ULOGIC_VECTOR) Error: Character '" &
|
||||
c & "' read, expected STD_ULOGIC literal.";
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(l, s);
|
||||
for i in 1 to value'length-1 loop
|
||||
if (char_to_MVL9plus(s(i)) = ERROR) then
|
||||
value := allU;
|
||||
assert FALSE report
|
||||
"READ(STD_ULOGIC_VECTOR) Error: Character '" &
|
||||
s(i) & "' read, expected STD_ULOGIC literal.";
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
mv(0) := char_to_MVL9(c);
|
||||
for i in 1 to value'length-1 loop
|
||||
mv(i) := char_to_MVL9(s(i));
|
||||
end loop;
|
||||
value := mv;
|
||||
end READ;
|
||||
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
write(l, MVL9_to_char(value), justified, field);
|
||||
end WRITE;
|
||||
|
||||
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
variable s: string(1 to value'length);
|
||||
variable m: STD_ULOGIC_VECTOR(1 to value'length) := value;
|
||||
begin
|
||||
for i in 1 to value'length loop
|
||||
s(i) := MVL9_to_char(m(i));
|
||||
end loop;
|
||||
write(l, s, justified, field);
|
||||
end WRITE;
|
||||
|
||||
-- Read and Write procedures for STD_LOGIC_VECTOR
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
READ(L, tmp);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end READ;
|
||||
|
||||
procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
READ(L, tmp, GOOD);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end READ;
|
||||
|
||||
procedure WRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
WRITE(L, STD_ULOGIC_VECTOR(VALUE), JUSTIFIED, FIELD);
|
||||
end WRITE;
|
||||
|
||||
|
||||
--
|
||||
-- Hex Read and Write procedures.
|
||||
--
|
||||
|
||||
--
|
||||
-- Hex, and Octal Read and Write procedures for BIT_VECTOR
|
||||
-- (these procedures are not exported, they are only used
|
||||
-- by the STD_ULOGIC hex/octal reads and writes below.
|
||||
--
|
||||
--
|
||||
|
||||
procedure Char2QuadBits(C: Character;
|
||||
RESULT: out std_ulogic_vector(3 downto 0);
|
||||
GOOD: out Boolean;
|
||||
ISSUE_ERROR: in Boolean) is
|
||||
begin
|
||||
case c is
|
||||
when '0' => result := x"0"; good := TRUE;
|
||||
when '1' => result := x"1"; good := TRUE;
|
||||
when '2' => result := x"2"; good := TRUE;
|
||||
when '3' => result := x"3"; good := TRUE;
|
||||
when '4' => result := x"4"; good := TRUE;
|
||||
when '5' => result := x"5"; good := TRUE;
|
||||
when '6' => result := x"6"; good := TRUE;
|
||||
when '7' => result := x"7"; good := TRUE;
|
||||
when '8' => result := x"8"; good := TRUE;
|
||||
when '9' => result := x"9"; good := TRUE;
|
||||
when 'A' => result := x"A"; good := TRUE;
|
||||
when 'B' => result := x"B"; good := TRUE;
|
||||
when 'C' => result := x"C"; good := TRUE;
|
||||
when 'D' => result := x"D"; good := TRUE;
|
||||
when 'E' => result := x"E"; good := TRUE;
|
||||
when 'F' => result := x"F"; good := TRUE;
|
||||
when 'Z' => result(0) := 'Z'; result(1) := 'Z'; result(2) := 'Z'; result(3) := 'Z'; good := TRUE;
|
||||
when 'X' => result(0) := 'X'; result(1) := 'X'; result(2) := 'X'; result(3) := 'X'; good := TRUE;
|
||||
|
||||
when 'a' => result := x"A"; good := TRUE;
|
||||
when 'b' => result := x"B"; good := TRUE;
|
||||
when 'c' => result := x"C"; good := TRUE;
|
||||
when 'd' => result := x"D"; good := TRUE;
|
||||
when 'e' => result := x"E"; good := TRUE;
|
||||
when 'f' => result := x"F"; good := TRUE;
|
||||
when others =>
|
||||
if ISSUE_ERROR then
|
||||
assert FALSE report
|
||||
"HREAD Error: Read a '" & c &
|
||||
"', expected a Hex character (0-F).";
|
||||
end if;
|
||||
good := FALSE;
|
||||
end case;
|
||||
end;
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR) is
|
||||
variable ok: boolean;
|
||||
variable c: character;
|
||||
constant ne: integer := value'length/4;
|
||||
variable bv: std_ulogic_vector(0 to value'length-1);
|
||||
variable s: string(1 to ne-1);
|
||||
begin
|
||||
if value'length mod 4 /= 0 then
|
||||
assert FALSE report
|
||||
"HREAD Error: Trying to read vector " &
|
||||
"with an odd (non multiple of 4) length";
|
||||
return;
|
||||
end if;
|
||||
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
Char2QuadBits(c, bv(0 to 3), ok, TRUE);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
assert FALSE
|
||||
report "HREAD Error: Failed to read the STRING";
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 1 to ne-1 loop
|
||||
Char2QuadBits(s(i), bv(4*i to 4*i+3), ok, TRUE);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
value := bv;
|
||||
end HREAD;
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR;GOOD: out BOOLEAN) is
|
||||
variable ok: boolean;
|
||||
variable c: character;
|
||||
constant ne: integer := value'length/4;
|
||||
variable bv: std_ulogic_vector(0 to value'length-1);
|
||||
variable s: string(1 to ne-1);
|
||||
begin
|
||||
if value'length mod 4 /= 0 then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
Char2QuadBits(c, bv(0 to 3), ok, FALSE);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 1 to ne-1 loop
|
||||
Char2QuadBits(s(i), bv(4*i to 4*i+3), ok, FALSE);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
good := TRUE;
|
||||
value := bv;
|
||||
end HREAD;
|
||||
|
||||
procedure HWRITE(L:inout LINE; VALUE:in std_ulogic_vector;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
variable quad: std_ulogic_vector(0 to 3);
|
||||
constant ne: integer := value'length/4;
|
||||
variable bv: std_ulogic_vector(0 to value'length-1) := value;
|
||||
variable s: string(1 to ne);
|
||||
begin
|
||||
if value'length mod 4 /= 0 then
|
||||
assert FALSE report
|
||||
"HWRITE Error: Trying to read vector " &
|
||||
"with an odd (non multiple of 4) length";
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 0 to ne-1 loop
|
||||
quad := To_X01Z(bv(4*i to 4*i+3));
|
||||
case quad is
|
||||
when x"0" => s(i+1) := '0';
|
||||
when x"1" => s(i+1) := '1';
|
||||
when x"2" => s(i+1) := '2';
|
||||
when x"3" => s(i+1) := '3';
|
||||
when x"4" => s(i+1) := '4';
|
||||
when x"5" => s(i+1) := '5';
|
||||
when x"6" => s(i+1) := '6';
|
||||
when x"7" => s(i+1) := '7';
|
||||
when x"8" => s(i+1) := '8';
|
||||
when x"9" => s(i+1) := '9';
|
||||
when x"A" => s(i+1) := 'A';
|
||||
when x"B" => s(i+1) := 'B';
|
||||
when x"C" => s(i+1) := 'C';
|
||||
when x"D" => s(i+1) := 'D';
|
||||
when x"E" => s(i+1) := 'E';
|
||||
when x"F" => s(i+1) := 'F';
|
||||
when others =>
|
||||
if (quad = "ZZZZ") then
|
||||
s(i+1) := 'Z';
|
||||
else
|
||||
s(i+1) := 'X';
|
||||
end if;
|
||||
end case;
|
||||
end loop;
|
||||
write(L, s, JUSTIFIED, FIELD);
|
||||
end HWRITE;
|
||||
|
||||
procedure Char2TriBits(C: Character;
|
||||
RESULT: out bit_vector(2 downto 0);
|
||||
GOOD: out Boolean;
|
||||
ISSUE_ERROR: in Boolean) is
|
||||
begin
|
||||
case c is
|
||||
when '0' => result := o"0"; good := TRUE;
|
||||
when '1' => result := o"1"; good := TRUE;
|
||||
when '2' => result := o"2"; good := TRUE;
|
||||
when '3' => result := o"3"; good := TRUE;
|
||||
when '4' => result := o"4"; good := TRUE;
|
||||
when '5' => result := o"5"; good := TRUE;
|
||||
when '6' => result := o"6"; good := TRUE;
|
||||
when '7' => result := o"7"; good := TRUE;
|
||||
when others =>
|
||||
if ISSUE_ERROR then
|
||||
assert FALSE report
|
||||
"OREAD Error: Read a '" & c &
|
||||
"', expected an Octal character (0-7).";
|
||||
end if;
|
||||
good := FALSE;
|
||||
end case;
|
||||
end;
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out BIT_VECTOR) is
|
||||
variable c: character;
|
||||
variable ok: boolean;
|
||||
constant ne: integer := value'length/3;
|
||||
variable bv: bit_vector(0 to value'length-1);
|
||||
variable s: string(1 to ne-1);
|
||||
begin
|
||||
if value'length mod 3 /= 0 then
|
||||
assert FALSE report
|
||||
"OREAD Error: Trying to read vector " &
|
||||
"with an odd (non multiple of 3) length";
|
||||
return;
|
||||
end if;
|
||||
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
Char2TriBits(c, bv(0 to 2), ok, TRUE);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
assert FALSE
|
||||
report "OREAD Error: Failed to read the STRING";
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 1 to ne-1 loop
|
||||
Char2TriBits(s(i), bv(3*i to 3*i+2), ok, TRUE);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
value := bv;
|
||||
end OREAD;
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out BIT_VECTOR;GOOD: out BOOLEAN) is
|
||||
variable ok: boolean;
|
||||
variable c: character;
|
||||
constant ne: integer := value'length/3;
|
||||
variable bv: bit_vector(0 to value'length-1);
|
||||
variable s: string(1 to ne-1);
|
||||
begin
|
||||
if value'length mod 3 /= 0 then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
loop -- skip white space
|
||||
read(l,c);
|
||||
exit when ((c /= ' ') and (c /= CR) and (c /= HT));
|
||||
end loop;
|
||||
|
||||
Char2TriBits(c, bv(0 to 2), ok, FALSE);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 1 to ne-1 loop
|
||||
Char2TriBits(s(i), bv(3*i to 3*i+2), ok, FALSE);
|
||||
if not ok then
|
||||
good := FALSE;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
good := TRUE;
|
||||
value := bv;
|
||||
end OREAD;
|
||||
|
||||
|
||||
procedure OWRITE(L:inout LINE; VALUE:in std_ulogic_vector;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
variable tri: std_ulogic_vector(0 to 2);
|
||||
constant ne: integer := value'length/3;
|
||||
variable bv: std_ulogic_vector(0 to value'length-1) := value;
|
||||
variable s: string(1 to ne);
|
||||
begin
|
||||
if value'length mod 3 /= 0 then
|
||||
assert FALSE report
|
||||
"OWRITE Error: Trying to read vector " &
|
||||
"with an odd (non multiple of 3) length";
|
||||
return;
|
||||
end if;
|
||||
|
||||
for i in 0 to ne-1 loop
|
||||
tri := To_X01Z(bv(3*i to 3*i+2));
|
||||
case tri is
|
||||
when o"0" => s(i+1) := '0';
|
||||
when o"1" => s(i+1) := '1';
|
||||
when o"2" => s(i+1) := '2';
|
||||
when o"3" => s(i+1) := '3';
|
||||
when o"4" => s(i+1) := '4';
|
||||
when o"5" => s(i+1) := '5';
|
||||
when o"6" => s(i+1) := '6';
|
||||
when o"7" => s(i+1) := '7';
|
||||
when others =>
|
||||
if (tri = "ZZZ") then
|
||||
s(i+1) := 'Z';
|
||||
else
|
||||
s(i+1) := 'X';
|
||||
end if;
|
||||
end case;
|
||||
end loop;
|
||||
write(L, s, JUSTIFIED, FIELD);
|
||||
end OWRITE;
|
||||
|
||||
-- Hex Read and Write procedures for STD_LOGIC_VECTOR
|
||||
procedure HREAD(L:inout LINE; VALUE:out BIT_VECTOR;GOOD:out BOOLEAN) is
|
||||
variable tmp: std_ulogic_vector(VALUE'length-1 downto 0);
|
||||
begin
|
||||
HREAD(L, tmp, GOOD);
|
||||
VALUE := To_BitVector(tmp);
|
||||
end HREAD;
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out BIT_VECTOR) is
|
||||
variable tmp: std_ulogic_vector(VALUE'length-1 downto 0);
|
||||
begin
|
||||
HREAD(L, tmp);
|
||||
VALUE := To_BitVector(tmp);
|
||||
end HREAD;
|
||||
|
||||
-- Hex Read and Write procedures for STD_LOGIC_VECTOR
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
HREAD(L, tmp);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end HREAD;
|
||||
|
||||
procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
HREAD(L, tmp, GOOD);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end HREAD;
|
||||
|
||||
procedure HWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
HWRITE(L, STD_ULOGIC_VECTOR(VALUE), JUSTIFIED, FIELD);
|
||||
end HWRITE;
|
||||
|
||||
|
||||
-- Octal Read and Write procedures for STD_ULOGIC_VECTOR
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR;GOOD:out BOOLEAN) is
|
||||
variable tmp: bit_vector(VALUE'length-1 downto 0);
|
||||
begin
|
||||
OREAD(L, tmp, GOOD);
|
||||
VALUE := To_X01(tmp);
|
||||
end OREAD;
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR) is
|
||||
variable tmp: bit_vector(VALUE'length-1 downto 0);
|
||||
begin
|
||||
OREAD(L, tmp);
|
||||
VALUE := To_X01(tmp);
|
||||
end OREAD;
|
||||
|
||||
-- Octal Read and Write procedures for STD_LOGIC_VECTOR
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
OREAD(L, tmp);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end OREAD;
|
||||
|
||||
procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN) is
|
||||
variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
|
||||
begin
|
||||
OREAD(L, tmp, GOOD);
|
||||
VALUE := STD_LOGIC_VECTOR(tmp);
|
||||
end OREAD;
|
||||
|
||||
procedure OWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
|
||||
JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
|
||||
begin
|
||||
OWRITE(L, STD_ULOGIC_VECTOR(VALUE), JUSTIFIED, FIELD);
|
||||
end OWRITE;
|
||||
|
||||
|
||||
--synopsys synthesis_on
|
||||
end STD_LOGIC_TEXTIO;
|
||||
@@ -0,0 +1,329 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc. --
|
||||
-- All rights reserved. --
|
||||
-- --
|
||||
-- This source file may be used and distributed without restriction --
|
||||
-- provided that this copyright statement is not removed from the file --
|
||||
-- and that any derivative work contains this copyright notice. --
|
||||
-- --
|
||||
-- Package name: STD_LOGIC_UNSIGNED --
|
||||
-- --
|
||||
-- --
|
||||
-- Date: 09/11/92 KN --
|
||||
-- 10/08/92 AMT --
|
||||
-- --
|
||||
-- Purpose: --
|
||||
-- A set of unsigned arithemtic, conversion, --
|
||||
-- and comparision functions for STD_LOGIC_VECTOR. --
|
||||
-- --
|
||||
-- Note: comparision of same length discrete arrays is defined --
|
||||
-- by the LRM. This package will "overload" those --
|
||||
-- definitions --
|
||||
-- --
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package STD_LOGIC_UNSIGNED is
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR;
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN;
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER;
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
-- function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR;
|
||||
|
||||
end STD_LOGIC_UNSIGNED;
|
||||
|
||||
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
|
||||
package body STD_LOGIC_UNSIGNED is
|
||||
|
||||
|
||||
function maximum(L, R: INTEGER) return INTEGER is
|
||||
begin
|
||||
if L > R then
|
||||
return L;
|
||||
else
|
||||
return R;
|
||||
end if;
|
||||
end;
|
||||
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR (length-1 downto 0);
|
||||
begin
|
||||
result := UNSIGNED(L) + UNSIGNED(R);-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := UNSIGNED(L) + R;-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L + UNSIGNED(R);-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := UNSIGNED(L) + R;-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to plus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L + UNSIGNED(R);-- pragma label plus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR (length-1 downto 0);
|
||||
begin
|
||||
result := UNSIGNED(L) - UNSIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: INTEGER) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := UNSIGNED(L) - R; -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: INTEGER; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L - UNSIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC_VECTOR; R: STD_LOGIC) return STD_LOGIC_VECTOR is
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := UNSIGNED(L) - R;
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "-"(L: STD_LOGIC; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to minus
|
||||
variable result : STD_LOGIC_VECTOR (R'range);
|
||||
begin
|
||||
result := L - UNSIGNED(R); -- pragma label minus
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "+"(L: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
variable result : STD_LOGIC_VECTOR (L'range);
|
||||
begin
|
||||
result := + UNSIGNED(L);
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "*"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
-- pragma label_applies_to mult
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
variable result : STD_LOGIC_VECTOR ((L'length+R'length-1) downto 0);
|
||||
begin
|
||||
result := UNSIGNED(L) * UNSIGNED(R); -- pragma label mult
|
||||
return std_logic_vector(result);
|
||||
end;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
constant length: INTEGER := maximum(L'length, R'length);
|
||||
begin
|
||||
return UNSIGNED(L) < UNSIGNED(R); -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
begin
|
||||
return UNSIGNED(L) < R; -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to lt
|
||||
begin
|
||||
return L < UNSIGNED(R); -- pragma label lt
|
||||
end;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return UNSIGNED(L) <= UNSIGNED(R); -- pragma label leq
|
||||
end;
|
||||
|
||||
function "<="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return UNSIGNED(L) <= R; -- pragma label leq
|
||||
end;
|
||||
|
||||
function "<="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to leq
|
||||
begin
|
||||
return L <= UNSIGNED(R); -- pragma label leq
|
||||
end;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return UNSIGNED(L) > UNSIGNED(R); -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">"(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return UNSIGNED(L) > R; -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">"(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to gt
|
||||
begin
|
||||
return L > UNSIGNED(R); -- pragma label gt
|
||||
end;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return UNSIGNED(L) >= UNSIGNED(R); -- pragma label geq
|
||||
end;
|
||||
|
||||
function ">="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return UNSIGNED(L) >= R; -- pragma label geq
|
||||
end;
|
||||
|
||||
function ">="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
-- pragma label_applies_to geq
|
||||
begin
|
||||
return L >= UNSIGNED(R); -- pragma label geq
|
||||
end;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return UNSIGNED(L) = UNSIGNED(R);
|
||||
end;
|
||||
|
||||
function "="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
begin
|
||||
return UNSIGNED(L) = R;
|
||||
end;
|
||||
|
||||
function "="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return L = UNSIGNED(R);
|
||||
end;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return UNSIGNED(L) /= UNSIGNED(R);
|
||||
end;
|
||||
|
||||
function "/="(L: STD_LOGIC_VECTOR; R: INTEGER) return BOOLEAN is
|
||||
begin
|
||||
return UNSIGNED(L) /= R;
|
||||
end;
|
||||
|
||||
function "/="(L: INTEGER; R: STD_LOGIC_VECTOR) return BOOLEAN is
|
||||
begin
|
||||
return L /= UNSIGNED(R);
|
||||
end;
|
||||
|
||||
function CONV_INTEGER(ARG: STD_LOGIC_VECTOR) return INTEGER is
|
||||
variable result : UNSIGNED(ARG'range);
|
||||
begin
|
||||
result := UNSIGNED(ARG);
|
||||
return CONV_INTEGER(result);
|
||||
end;
|
||||
function SHL(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
begin
|
||||
return STD_LOGIC_VECTOR(SHL(UNSIGNED(ARG),UNSIGNED(COUNT)));
|
||||
end;
|
||||
|
||||
function SHR(ARG:STD_LOGIC_VECTOR;COUNT: STD_LOGIC_VECTOR) return STD_LOGIC_VECTOR is
|
||||
begin
|
||||
return STD_LOGIC_VECTOR(SHR(UNSIGNED(ARG),UNSIGNED(COUNT)));
|
||||
end;
|
||||
|
||||
|
||||
-- remove this since it is already in std_logic_arith
|
||||
--function CONV_STD_LOGIC_VECTOR(ARG: INTEGER; SIZE: INTEGER) return STD_LOGIC_VECTOR is
|
||||
--variable result1 : UNSIGNED (SIZE-1 downto 0);
|
||||
--variable result2 : STD_LOGIC_VECTOR (SIZE-1 downto 0);
|
||||
--begin
|
||||
--result1 := CONV_UNSIGNED(ARG,SIZE);
|
||||
--return std_logic_vector(result1);
|
||||
--end;
|
||||
|
||||
|
||||
end STD_LOGIC_UNSIGNED;
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user