1-- --------------------------------------------------------------------
2--
3-- Copyright 1995 by IEEE. All rights reserved.
4--
5-- This source file is considered by the IEEE to be an essential part of the use
6-- of the standard 1076.3 and as such may be distributed without change, except
7-- as permitted by the standard. This source file may not be sold or distributed
8-- for profit. This package may be modified to include additional data required
9-- by tools, but must in no way change the external interfaces or simulation
10-- behaviour of the description. It is permissible to add comments and/or
11-- attributes to the package declarations, but not to change or delete any
12-- original lines of the approved package declaration. The package body may be
13-- changed only in accordance with the terms of clauses 7.1 and 7.2 of the
14-- standard.
15--
16-- Title      : Standard VHDL Synthesis Package (1076.3, NUMERIC_STD)
17--
18-- Library    : This package shall be compiled into a library symbolically
19--            : named IEEE.
20--
21-- Developers : IEEE DASC Synthesis Working Group, PAR 1076.3
22--
23-- Purpose    : This package defines numeric types and arithmetic functions
24--            : for use with synthesis tools. Two numeric types are defined:
25--            : -- > UNSIGNED: represents UNSIGNED number in vector form
26--            : -- > SIGNED: represents a SIGNED number in vector form
27--            : The base element type is type STD_LOGIC.
28--            : The leftmost bit is treated as the most significant bit.
29--            : Signed vectors are represented in two's complement form.
30--            : This package contains overloaded arithmetic operators on
31--            : the SIGNED and UNSIGNED types. The package also contains
32--            : useful type conversions functions.
33--            :
34--            : If any argument to a function is a null array, a null array is
35--            : returned (exceptions, if any, are noted individually).
36--
37-- Limitation :
38--
39-- Note       : No declarations or definitions shall be included in,
40--            : or excluded from this package. The "package declaration"
41--            : defines the types, subtypes and declarations of
42--            : NUMERIC_STD. The NUMERIC_STD package body shall be
43--            : considered the formal definition of the semantics of
44--            : this package. Tool developers may choose to implement
45--            : the package body in the most efficient manner available
46--            : to them.
47--
48-- --------------------------------------------------------------------
49--   modification history :
50-- --------------------------------------------------------------------
51--   Version:  2.4
52--   Date   :  12 April 1995
53-- -----------------------------------------------------------------------------
54library IEEE;
55use IEEE.STD_LOGIC_1164.all;
56
57package NUMERIC_STD is
58  constant CopyRightNotice: STRING
59      := "Copyright 1995 IEEE. All rights reserved.";
60
61  --============================================================================
62  -- Numeric array type definitions
63  --============================================================================
64
65  type UNSIGNED is array (NATURAL range <>) of STD_LOGIC;
66  type SIGNED is array (NATURAL range <>) of STD_LOGIC;
67
68  --============================================================================
69  -- Arithmetic Operators:
70  --===========================================================================
71
72  -- Id: A.1
73  function "abs" (ARG: SIGNED) return SIGNED;
74  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
75  -- Result: Returns the absolute value of a SIGNED vector ARG.
76
77  -- Id: A.2
78  function "-" (ARG: SIGNED) return SIGNED;
79  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0).
80  -- Result: Returns the value of the unary minus operation on a
81  --         SIGNED vector ARG.
82
83  --============================================================================
84
85  -- Id: A.3
86  function "+" (L, R: UNSIGNED) return UNSIGNED;
87  -- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
88  -- Result: Adds two UNSIGNED vectors that may be of different lengths.
89
90  -- Id: A.4
91  function "+" (L, R: SIGNED) return SIGNED;
92  -- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
93  -- Result: Adds two SIGNED vectors that may be of different lengths.
94
95  -- Id: A.5
96  function "+" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
97  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
98  -- Result: Adds an UNSIGNED vector, L, with a non-negative INTEGER, R.
99
100  -- Id: A.6
101  function "+" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
102  -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
103  -- Result: Adds a non-negative INTEGER, L, with an UNSIGNED vector, R.
104
105  -- Id: A.7
106  function "+" (L: INTEGER; R: SIGNED) return SIGNED;
107  -- Result subtype: SIGNED(R'LENGTH-1 downto 0).
108  -- Result: Adds an INTEGER, L(may be positive or negative), to a SIGNED
109  --         vector, R.
110
111  -- Id: A.8
112  function "+" (L: SIGNED; R: INTEGER) return SIGNED;
113  -- Result subtype: SIGNED(L'LENGTH-1 downto 0).
114  -- Result: Adds a SIGNED vector, L, to an INTEGER, R.
115
116  --============================================================================
117
118  -- Id: A.9
119  function "-" (L, R: UNSIGNED) return UNSIGNED;
120  -- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
121  -- Result: Subtracts two UNSIGNED vectors that may be of different lengths.
122
123  -- Id: A.10
124  function "-" (L, R: SIGNED) return SIGNED;
125  -- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
126  -- Result: Subtracts a SIGNED vector, R, from another SIGNED vector, L,
127  --         that may possibly be of different lengths.
128
129  -- Id: A.11
130  function "-" (L: UNSIGNED;R: NATURAL) return UNSIGNED;
131  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
132  -- Result: Subtracts a non-negative INTEGER, R, from an UNSIGNED vector, L.
133
134  -- Id: A.12
135  function "-" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
136  -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
137  -- Result: Subtracts an UNSIGNED vector, R, from a non-negative INTEGER, L.
138
139  -- Id: A.13
140  function "-" (L: SIGNED; R: INTEGER) return SIGNED;
141  -- Result subtype: SIGNED(L'LENGTH-1 downto 0).
142  -- Result: Subtracts an INTEGER, R, from a SIGNED vector, L.
143
144  -- Id: A.14
145  function "-" (L: INTEGER; R: SIGNED) return SIGNED;
146  -- Result subtype: SIGNED(R'LENGTH-1 downto 0).
147  -- Result: Subtracts a SIGNED vector, R, from an INTEGER, L.
148
149  --============================================================================
150
151  -- Id: A.15
152  function "*" (L, R: UNSIGNED) return UNSIGNED;
153  -- Result subtype: UNSIGNED((L'LENGTH+R'LENGTH-1) downto 0).
154  -- Result: Performs the multiplication operation on two UNSIGNED vectors
155  --         that may possibly be of different lengths.
156
157  -- Id: A.16
158  function "*" (L, R: SIGNED) return SIGNED;
159  -- Result subtype: SIGNED((L'LENGTH+R'LENGTH-1) downto 0)
160  -- Result: Multiplies two SIGNED vectors that may possibly be of
161  --         different lengths.
162
163  -- Id: A.17
164  function "*" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
165  -- Result subtype: UNSIGNED((L'LENGTH+L'LENGTH-1) downto 0).
166  -- Result: Multiplies an UNSIGNED vector, L, with a non-negative
167  --         INTEGER, R. R is converted to an UNSIGNED vector of
168  --         SIZE L'LENGTH before multiplication.
169
170  -- Id: A.18
171  function "*" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
172  -- Result subtype: UNSIGNED((R'LENGTH+R'LENGTH-1) downto 0).
173  -- Result: Multiplies an UNSIGNED vector, R, with a non-negative
174  --         INTEGER, L. L is converted to an UNSIGNED vector of
175  --         SIZE R'LENGTH before multiplication.
176
177  -- Id: A.19
178  function "*" (L: SIGNED; R: INTEGER) return SIGNED;
179  -- Result subtype: SIGNED((L'LENGTH+L'LENGTH-1) downto 0)
180  -- Result: Multiplies a SIGNED vector, L, with an INTEGER, R. R is
181  --         converted to a SIGNED vector of SIZE L'LENGTH before
182  --         multiplication.
183
184  -- Id: A.20
185  function "*" (L: INTEGER; R: SIGNED) return SIGNED;
186  -- Result subtype: SIGNED((R'LENGTH+R'LENGTH-1) downto 0)
187  -- Result: Multiplies a SIGNED vector, R, with an INTEGER, L. L is
188  --         converted to a SIGNED vector of SIZE R'LENGTH before
189  --         multiplication.
190
191  --============================================================================
192  --
193  -- NOTE: If second argument is zero for "/" operator, a severity level
194  --       of ERROR is issued.
195
196  -- Id: A.21
197  function "/" (L, R: UNSIGNED) return UNSIGNED;
198  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
199  -- Result: Divides an UNSIGNED vector, L, by another UNSIGNED vector, R.
200
201  -- Id: A.22
202  function "/" (L, R: SIGNED) return SIGNED;
203  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
204  -- Result: Divides an SIGNED vector, L, by another SIGNED vector, R.
205
206  -- Id: A.23
207  function "/" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
208  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
209  -- Result: Divides an UNSIGNED vector, L, by a non-negative INTEGER, R.
210  --         If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
211
212  -- Id: A.24
213  function "/" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
214  -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
215  -- Result: Divides a non-negative INTEGER, L, by an UNSIGNED vector, R.
216  --         If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
217
218  -- Id: A.25
219  function "/" (L: SIGNED; R: INTEGER) return SIGNED;
220  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
221  -- Result: Divides a SIGNED vector, L, by an INTEGER, R.
222  --         If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
223
224  -- Id: A.26
225  function "/" (L: INTEGER; R: SIGNED) return SIGNED;
226  -- Result subtype: SIGNED(R'LENGTH-1 downto 0)
227  -- Result: Divides an INTEGER, L, by a SIGNED vector, R.
228  --         If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
229
230  --============================================================================
231  --
232  -- NOTE: If second argument is zero for "rem" operator, a severity level
233  --       of ERROR is issued.
234
235  -- Id: A.27
236  function "rem" (L, R: UNSIGNED) return UNSIGNED;
237  -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
238  -- Result: Computes "L rem R" where L and R are UNSIGNED vectors.
239
240  -- Id: A.28
241  function "rem" (L, R: SIGNED) return SIGNED;
242  -- Result subtype: SIGNED(R'LENGTH-1 downto 0)
243  -- Result: Computes "L rem R" where L and R are SIGNED vectors.
244
245  -- Id: A.29
246  function "rem" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
247  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
248  -- Result: Computes "L rem R" where L is an UNSIGNED vector and R is a
249  --         non-negative INTEGER.
250  --         If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
251
252  -- Id: A.30
253  function "rem" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
254  -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
255  -- Result: Computes "L rem R" where R is an UNSIGNED vector and L is a
256  --         non-negative INTEGER.
257  --         If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
258
259  -- Id: A.31
260  function "rem" (L: SIGNED; R: INTEGER) return SIGNED;
261  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
262  -- Result: Computes "L rem R" where L is SIGNED vector and R is an INTEGER.
263  --         If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
264
265  -- Id: A.32
266  function "rem" (L: INTEGER; R: SIGNED) return SIGNED;
267  -- Result subtype: SIGNED(R'LENGTH-1 downto 0)
268  -- Result: Computes "L rem R" where R is SIGNED vector and L is an INTEGER.
269  --         If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
270
271  --============================================================================
272  --
273  -- NOTE: If second argument is zero for "mod" operator, a severity level
274  --       of ERROR is issued.
275
276  -- Id: A.33
277  function "mod" (L, R: UNSIGNED) return UNSIGNED;
278  -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
279  -- Result: Computes "L mod R" where L and R are UNSIGNED vectors.
280
281  -- Id: A.34
282  function "mod" (L, R: SIGNED) return SIGNED;
283  -- Result subtype: SIGNED(R'LENGTH-1 downto 0)
284  -- Result: Computes "L mod R" where L and R are SIGNED vectors.
285
286  -- Id: A.35
287  function "mod" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
288  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
289  -- Result: Computes "L mod R" where L is an UNSIGNED vector and R
290  --         is a non-negative INTEGER.
291  --         If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
292
293  -- Id: A.36
294  function "mod" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
295  -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0)
296  -- Result: Computes "L mod R" where R is an UNSIGNED vector and L
297  --         is a non-negative INTEGER.
298  --         If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
299
300  -- Id: A.37
301  function "mod" (L: SIGNED; R: INTEGER) return SIGNED;
302  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
303  -- Result: Computes "L mod R" where L is a SIGNED vector and
304  --         R is an INTEGER.
305  --         If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH.
306
307  -- Id: A.38
308  function "mod" (L: INTEGER; R: SIGNED) return SIGNED;
309  -- Result subtype: SIGNED(R'LENGTH-1 downto 0)
310  -- Result: Computes "L mod R" where L is an INTEGER and
311  --         R is a SIGNED vector.
312  --         If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH.
313
314  --============================================================================
315  -- Comparison Operators
316  --============================================================================
317
318  -- Id: C.1
319  function ">" (L, R: UNSIGNED) return BOOLEAN;
320  -- Result subtype: BOOLEAN
321  -- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly
322  --         of different lengths.
323
324  -- Id: C.2
325  function ">" (L, R: SIGNED) return BOOLEAN;
326  -- Result subtype: BOOLEAN
327  -- Result: Computes "L > R" where L and R are SIGNED vectors possibly
328  --         of different lengths.
329
330  -- Id: C.3
331  function ">" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
332  -- Result subtype: BOOLEAN
333  -- Result: Computes "L > R" where L is a non-negative INTEGER and
334  --         R is an UNSIGNED vector.
335
336  -- Id: C.4
337  function ">" (L: INTEGER; R: SIGNED) return BOOLEAN;
338  -- Result subtype: BOOLEAN
339  -- Result: Computes "L > R" where L is a INTEGER and
340  --         R is a SIGNED vector.
341
342  -- Id: C.5
343  function ">" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
344  -- Result subtype: BOOLEAN
345  -- Result: Computes "L > R" where L is an UNSIGNED vector and
346  --         R is a non-negative INTEGER.
347
348  -- Id: C.6
349  function ">" (L: SIGNED; R: INTEGER) return BOOLEAN;
350  -- Result subtype: BOOLEAN
351  -- Result: Computes "L > R" where L is a SIGNED vector and
352  --         R is a INTEGER.
353
354  --============================================================================
355
356  -- Id: C.7
357  function "<" (L, R: UNSIGNED) return BOOLEAN;
358  -- Result subtype: BOOLEAN
359  -- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly
360  --         of different lengths.
361
362  -- Id: C.8
363  function "<" (L, R: SIGNED) return BOOLEAN;
364  -- Result subtype: BOOLEAN
365  -- Result: Computes "L < R" where L and R are SIGNED vectors possibly
366  --         of different lengths.
367
368  -- Id: C.9
369  function "<" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
370  -- Result subtype: BOOLEAN
371  -- Result: Computes "L < R" where L is a non-negative INTEGER and
372  --         R is an UNSIGNED vector.
373
374  -- Id: C.10
375  function "<" (L: INTEGER; R: SIGNED) return BOOLEAN;
376  -- Result subtype: BOOLEAN
377  -- Result: Computes "L < R" where L is an INTEGER and
378  --         R is a SIGNED vector.
379
380  -- Id: C.11
381  function "<" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
382  -- Result subtype: BOOLEAN
383  -- Result: Computes "L < R" where L is an UNSIGNED vector and
384  --         R is a non-negative INTEGER.
385
386  -- Id: C.12
387  function "<" (L: SIGNED; R: INTEGER) return BOOLEAN;
388  -- Result subtype: BOOLEAN
389  -- Result: Computes "L < R" where L is a SIGNED vector and
390  --         R is an INTEGER.
391
392  --============================================================================
393
394  -- Id: C.13
395  function "<=" (L, R: UNSIGNED) return BOOLEAN;
396  -- Result subtype: BOOLEAN
397  -- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly
398  --         of different lengths.
399
400  -- Id: C.14
401  function "<=" (L, R: SIGNED) return BOOLEAN;
402  -- Result subtype: BOOLEAN
403  -- Result: Computes "L <= R" where L and R are SIGNED vectors possibly
404  --         of different lengths.
405
406  -- Id: C.15
407  function "<=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
408  -- Result subtype: BOOLEAN
409  -- Result: Computes "L <= R" where L is a non-negative INTEGER and
410  --         R is an UNSIGNED vector.
411
412  -- Id: C.16
413  function "<=" (L: INTEGER; R: SIGNED) return BOOLEAN;
414  -- Result subtype: BOOLEAN
415  -- Result: Computes "L <= R" where L is an INTEGER and
416  --         R is a SIGNED vector.
417
418  -- Id: C.17
419  function "<=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
420  -- Result subtype: BOOLEAN
421  -- Result: Computes "L <= R" where L is an UNSIGNED vector and
422  --         R is a non-negative INTEGER.
423
424  -- Id: C.18
425  function "<=" (L: SIGNED; R: INTEGER) return BOOLEAN;
426  -- Result subtype: BOOLEAN
427  -- Result: Computes "L <= R" where L is a SIGNED vector and
428  --         R is an INTEGER.
429
430  --============================================================================
431
432  -- Id: C.19
433  function ">=" (L, R: UNSIGNED) return BOOLEAN;
434  -- Result subtype: BOOLEAN
435  -- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly
436  --         of different lengths.
437
438  -- Id: C.20
439  function ">=" (L, R: SIGNED) return BOOLEAN;
440  -- Result subtype: BOOLEAN
441  -- Result: Computes "L >= R" where L and R are SIGNED vectors possibly
442  --         of different lengths.
443
444  -- Id: C.21
445  function ">=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
446  -- Result subtype: BOOLEAN
447  -- Result: Computes "L >= R" where L is a non-negative INTEGER and
448  --         R is an UNSIGNED vector.
449
450  -- Id: C.22
451  function ">=" (L: INTEGER; R: SIGNED) return BOOLEAN;
452  -- Result subtype: BOOLEAN
453  -- Result: Computes "L >= R" where L is an INTEGER and
454  --         R is a SIGNED vector.
455
456  -- Id: C.23
457  function ">=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
458  -- Result subtype: BOOLEAN
459  -- Result: Computes "L >= R" where L is an UNSIGNED vector and
460  --         R is a non-negative INTEGER.
461
462  -- Id: C.24
463  function ">=" (L: SIGNED; R: INTEGER) return BOOLEAN;
464  -- Result subtype: BOOLEAN
465  -- Result: Computes "L >= R" where L is a SIGNED vector and
466  --         R is an INTEGER.
467
468  --============================================================================
469
470  -- Id: C.25
471  function "=" (L, R: UNSIGNED) return BOOLEAN;
472  -- Result subtype: BOOLEAN
473  -- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly
474  --         of different lengths.
475
476  -- Id: C.26
477  function "=" (L, R: SIGNED) return BOOLEAN;
478  -- Result subtype: BOOLEAN
479  -- Result: Computes "L = R" where L and R are SIGNED vectors possibly
480  --         of different lengths.
481
482  -- Id: C.27
483  function "=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
484  -- Result subtype: BOOLEAN
485  -- Result: Computes "L = R" where L is a non-negative INTEGER and
486  --         R is an UNSIGNED vector.
487
488  -- Id: C.28
489  function "=" (L: INTEGER; R: SIGNED) return BOOLEAN;
490  -- Result subtype: BOOLEAN
491  -- Result: Computes "L = R" where L is an INTEGER and
492  --         R is a SIGNED vector.
493
494  -- Id: C.29
495  function "=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
496  -- Result subtype: BOOLEAN
497  -- Result: Computes "L = R" where L is an UNSIGNED vector and
498  --         R is a non-negative INTEGER.
499
500  -- Id: C.30
501  function "=" (L: SIGNED; R: INTEGER) return BOOLEAN;
502  -- Result subtype: BOOLEAN
503  -- Result: Computes "L = R" where L is a SIGNED vector and
504  --         R is an INTEGER.
505
506  --============================================================================
507
508  -- Id: C.31
509  function "/=" (L, R: UNSIGNED) return BOOLEAN;
510  -- Result subtype: BOOLEAN
511  -- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly
512  --         of different lengths.
513
514  -- Id: C.32
515  function "/=" (L, R: SIGNED) return BOOLEAN;
516  -- Result subtype: BOOLEAN
517  -- Result: Computes "L /= R" where L and R are SIGNED vectors possibly
518  --         of different lengths.
519
520  -- Id: C.33
521  function "/=" (L: NATURAL; R: UNSIGNED) return BOOLEAN;
522  -- Result subtype: BOOLEAN
523  -- Result: Computes "L /= R" where L is a non-negative INTEGER and
524  --         R is an UNSIGNED vector.
525
526  -- Id: C.34
527  function "/=" (L: INTEGER; R: SIGNED) return BOOLEAN;
528  -- Result subtype: BOOLEAN
529  -- Result: Computes "L /= R" where L is an INTEGER and
530  --         R is a SIGNED vector.
531
532  -- Id: C.35
533  function "/=" (L: UNSIGNED; R: NATURAL) return BOOLEAN;
534  -- Result subtype: BOOLEAN
535  -- Result: Computes "L /= R" where L is an UNSIGNED vector and
536  --         R is a non-negative INTEGER.
537
538  -- Id: C.36
539  function "/=" (L: SIGNED; R: INTEGER) return BOOLEAN;
540  -- Result subtype: BOOLEAN
541  -- Result: Computes "L /= R" where L is a SIGNED vector and
542  --         R is an INTEGER.
543
544  --============================================================================
545  -- Shift and Rotate Functions
546  --============================================================================
547
548  -- Id: S.1
549  function SHIFT_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
550  -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
551  -- Result: Performs a shift-left on an UNSIGNED vector COUNT times.
552  --         The vacated positions are filled with '0'.
553  --         The COUNT leftmost elements are lost.
554
555  -- Id: S.2
556  function SHIFT_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
557  -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
558  -- Result: Performs a shift-right on an UNSIGNED vector COUNT times.
559  --         The vacated positions are filled with '0'.
560  --         The COUNT rightmost elements are lost.
561
562  -- Id: S.3
563  function SHIFT_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
564  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
565  -- Result: Performs a shift-left on a SIGNED vector COUNT times.
566  --         The vacated positions are filled with '0'.
567  --         The COUNT leftmost elements are lost.
568
569  -- Id: S.4
570  function SHIFT_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
571  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
572  -- Result: Performs a shift-right on a SIGNED vector COUNT times.
573  --         The vacated positions are filled with the leftmost
574  --         element, ARG'LEFT. The COUNT rightmost elements are lost.
575
576  --============================================================================
577
578  -- Id: S.5
579  function ROTATE_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
580  -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
581  -- Result: Performs a rotate-left of an UNSIGNED vector COUNT times.
582
583  -- Id: S.6
584  function ROTATE_RIGHT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
585  -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
586  -- Result: Performs a rotate-right of an UNSIGNED vector COUNT times.
587
588  -- Id: S.7
589  function ROTATE_LEFT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
590  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
591  -- Result: Performs a logical rotate-left of a SIGNED
592  --         vector COUNT times.
593
594  -- Id: S.8
595  function ROTATE_RIGHT (ARG: SIGNED; COUNT: NATURAL) return SIGNED;
596  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
597  -- Result: Performs a logical rotate-right of a SIGNED
598  --         vector COUNT times.
599
600  --============================================================================
601
602  --============================================================================
603
604  ------------------------------------------------------------------------------
605  --   Note : Function S.9 is not compatible with VHDL 1076-1987. Comment
606  --   out the function (declaration and body) for VHDL 1076-1987 compatibility.
607  ------------------------------------------------------------------------------
608  -- Id: S.9
609  function "sll" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED; --!V87
610  -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
611  -- Result: SHIFT_LEFT(ARG, COUNT)
612
613  ------------------------------------------------------------------------------
614  -- Note : Function S.10 is not compatible with VHDL 1076-1987. Comment
615  --   out the function (declaration and body) for VHDL 1076-1987 compatibility.
616  ------------------------------------------------------------------------------
617  -- Id: S.10
618  function "sll" (ARG: SIGNED; COUNT: INTEGER) return SIGNED; --!V87
619  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
620  -- Result: SHIFT_LEFT(ARG, COUNT)
621
622  ------------------------------------------------------------------------------
623  --   Note : Function S.11 is not compatible with VHDL 1076-1987. Comment
624  --   out the function (declaration and body) for VHDL 1076-1987 compatibility.
625  ------------------------------------------------------------------------------
626  -- Id: S.11
627  function "srl" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED; --!V87
628  -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
629  -- Result: SHIFT_RIGHT(ARG, COUNT)
630
631  ------------------------------------------------------------------------------
632  --   Note : Function S.12 is not compatible with VHDL 1076-1987. Comment
633  --   out the function (declaration and body) for VHDL 1076-1987 compatibility.
634  ------------------------------------------------------------------------------
635  -- Id: S.12
636  function "srl" (ARG: SIGNED; COUNT: INTEGER) return SIGNED; --!V87
637  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
638  -- Result: SIGNED(SHIFT_RIGHT(UNSIGNED(ARG), COUNT))
639
640  ------------------------------------------------------------------------------
641  --   Note : Function S.13 is not compatible with VHDL 1076-1987. Comment
642  -- out the function (declaration and body) for VHDL 1076-1987 compatibility.
643  ------------------------------------------------------------------------------
644  -- Id: S.13
645  function "rol" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED; --!V87
646  -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
647  -- Result: ROTATE_LEFT(ARG, COUNT)
648
649  ------------------------------------------------------------------------------
650  --   Note : Function S.14 is not compatible with VHDL 1076-1987. Comment
651  --   out the function (declaration and body) for VHDL 1076-1987 compatibility.
652  ------------------------------------------------------------------------------
653  -- Id: S.14
654  function "rol" (ARG: SIGNED; COUNT: INTEGER) return SIGNED; --!V87
655  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
656  -- Result: ROTATE_LEFT(ARG, COUNT)
657
658  ------------------------------------------------------------------------------
659  -- Note : Function S.15 is not compatible with VHDL 1076-1987. Comment
660  --   out the function (declaration and body) for VHDL 1076-1987 compatibility.
661  ------------------------------------------------------------------------------
662  -- Id: S.15
663  function "ror" (ARG: UNSIGNED; COUNT: INTEGER) return UNSIGNED; --!V87
664  -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0)
665  -- Result: ROTATE_RIGHT(ARG, COUNT)
666
667  ------------------------------------------------------------------------------
668  --   Note : Function S.16 is not compatible with VHDL 1076-1987. Comment
669  --   out the function (declaration and body) for VHDL 1076-1987 compatibility.
670  ------------------------------------------------------------------------------
671  -- Id: S.16
672  function "ror" (ARG: SIGNED; COUNT: INTEGER) return SIGNED; --!V87
673  -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0)
674  -- Result: ROTATE_RIGHT(ARG, COUNT)
675
676  --============================================================================
677  --   RESIZE Functions
678  --============================================================================
679
680  -- Id: R.1
681  function RESIZE (ARG: SIGNED; NEW_SIZE: NATURAL) return SIGNED;
682  -- Result subtype: SIGNED(NEW_SIZE-1 downto 0)
683  -- Result: Resizes the SIGNED vector ARG to the specified size.
684  --         To create a larger vector, the new [leftmost] bit positions
685  --         are filled with the sign bit (ARG'LEFT). When truncating,
686  --         the sign bit is retained along with the rightmost part.
687
688  -- Id: R.2
689  function RESIZE (ARG: UNSIGNED; NEW_SIZE: NATURAL) return UNSIGNED;
690  -- Result subtype: UNSIGNED(NEW_SIZE-1 downto 0)
691  -- Result: Resizes the SIGNED vector ARG to the specified size.
692  --         To create a larger vector, the new [leftmost] bit positions
693  --         are filled with '0'. When truncating, the leftmost bits
694  --         are dropped.
695
696  --============================================================================
697  -- Conversion Functions
698  --============================================================================
699
700  -- Id: D.1
701  function TO_INTEGER (ARG: UNSIGNED) return NATURAL;
702  -- Result subtype: NATURAL. Value cannot be negative since parameter is an
703  --             UNSIGNED vector.
704  -- Result: Converts the UNSIGNED vector to an INTEGER.
705
706  -- Id: D.2
707  function TO_INTEGER (ARG: SIGNED) return INTEGER;
708  -- Result subtype: INTEGER
709  -- Result: Converts a SIGNED vector to an INTEGER.
710
711  -- Id: D.3
712  function TO_UNSIGNED (ARG, SIZE: NATURAL) return UNSIGNED;
713  -- Result subtype: UNSIGNED(SIZE-1 downto 0)
714  -- Result: Converts a non-negative INTEGER to an UNSIGNED vector with
715  --         the specified SIZE.
716
717  -- Id: D.4
718  function TO_SIGNED (ARG: INTEGER; SIZE: NATURAL) return SIGNED;
719  -- Result subtype: SIGNED(SIZE-1 downto 0)
720  -- Result: Converts an INTEGER to a SIGNED vector of the specified SIZE.
721
722  --============================================================================
723  -- Logical Operators
724  --============================================================================
725
726  -- Id: L.1
727  function "not" (L: UNSIGNED) return UNSIGNED;
728  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
729  -- Result: Termwise inversion
730
731  -- Id: L.2
732  function "and" (L, R: UNSIGNED) return UNSIGNED;
733  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
734  -- Result: Vector AND operation
735
736  -- Id: L.3
737  function "or" (L, R: UNSIGNED) return UNSIGNED;
738  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
739  -- Result: Vector OR operation
740
741  -- Id: L.4
742  function "nand" (L, R: UNSIGNED) return UNSIGNED;
743  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
744  -- Result: Vector NAND operation
745
746  -- Id: L.5
747  function "nor" (L, R: UNSIGNED) return UNSIGNED;
748  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
749  -- Result: Vector NOR operation
750
751  -- Id: L.6
752  function "xor" (L, R: UNSIGNED) return UNSIGNED;
753  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
754  -- Result: Vector XOR operation
755
756  -- ---------------------------------------------------------------------------
757  -- Note : Function L.7 is not compatible with VHDL 1076-1987. Comment
758  -- out the function (declaration and body) for VHDL 1076-1987 compatibility.
759  -- ---------------------------------------------------------------------------
760  -- Id: L.7
761  function "xnor" (L, R: UNSIGNED) return UNSIGNED; --!V87
762  -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0)
763  -- Result: Vector XNOR operation
764
765  -- Id: L.8
766  function "not" (L: SIGNED) return SIGNED;
767  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
768  -- Result: Termwise inversion
769
770  -- Id: L.9
771  function "and" (L, R: SIGNED) return SIGNED;
772  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
773  -- Result: Vector AND operation
774
775  -- Id: L.10
776  function "or" (L, R: SIGNED) return SIGNED;
777  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
778  -- Result: Vector OR operation
779
780  -- Id: L.11
781  function "nand" (L, R: SIGNED) return SIGNED;
782  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
783  -- Result: Vector NAND operation
784
785  -- Id: L.12
786  function "nor" (L, R: SIGNED) return SIGNED;
787  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
788  -- Result: Vector NOR operation
789
790  -- Id: L.13
791  function "xor" (L, R: SIGNED) return SIGNED;
792  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
793  -- Result: Vector XOR operation
794
795  -- ---------------------------------------------------------------------------
796  -- Note : Function L.14 is not compatible with VHDL 1076-1987. Comment
797  -- out the function (declaration and body) for VHDL 1076-1987 compatibility.
798  -- ---------------------------------------------------------------------------
799  -- Id: L.14
800  function "xnor" (L, R: SIGNED) return SIGNED; --!V87
801  -- Result subtype: SIGNED(L'LENGTH-1 downto 0)
802  -- Result: Vector XNOR operation
803
804  --============================================================================
805  -- Match Functions
806  --============================================================================
807
808  -- Id: M.1
809  function STD_MATCH (L, R: STD_ULOGIC) return BOOLEAN;
810  -- Result subtype: BOOLEAN
811  -- Result: terms compared per STD_LOGIC_1164 intent
812
813  -- Id: M.2
814  function STD_MATCH (L, R: UNSIGNED) return BOOLEAN;
815  -- Result subtype: BOOLEAN
816  -- Result: terms compared per STD_LOGIC_1164 intent
817
818  -- Id: M.3
819  function STD_MATCH (L, R: SIGNED) return BOOLEAN;
820  -- Result subtype: BOOLEAN
821  -- Result: terms compared per STD_LOGIC_1164 intent
822
823  -- Id: M.4
824  function STD_MATCH (L, R: STD_LOGIC_VECTOR) return BOOLEAN;
825  -- Result subtype: BOOLEAN
826  -- Result: terms compared per STD_LOGIC_1164 intent
827
828  -- Id: M.5
829  function STD_MATCH (L, R: STD_ULOGIC_VECTOR) return BOOLEAN;
830  -- Result subtype: BOOLEAN
831  -- Result: terms compared per STD_LOGIC_1164 intent
832
833  --============================================================================
834  -- Translation Functions
835  --============================================================================
836
837  -- Id: T.1
838  function TO_01 (S: UNSIGNED; XMAP: STD_LOGIC := '0') return UNSIGNED;
839  -- Result subtype: UNSIGNED(S'RANGE)
840  -- Result: Termwise, 'H' is translated to '1', and 'L' is translated
841  --         to '0'. If a value other than '0'|'1'|'H'|'L' is found,
842  --         the array is set to (others => XMAP), and a warning is
843  --         issued.
844
845  -- Id: T.2
846  function TO_01 (S: SIGNED; XMAP: STD_LOGIC := '0') return SIGNED;
847  -- Result subtype: SIGNED(S'RANGE)
848  -- Result: Termwise, 'H' is translated to '1', and 'L' is translated
849  --         to '0'. If a value other than '0'|'1'|'H'|'L' is found,
850  --         the array is set to (others => XMAP), and a warning is
851  --         issued.
852
853end NUMERIC_STD;
854