blob: 6bfca915dab3cacaab648f7e95b81e0d67126d82 [file] [log] [blame]
Nico Huber5e9b1b52016-10-08 22:09:33 +02001--
2-- Copyright (C) 2015 secunet Security Networks AG
3--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
6-- the Free Software Foundation; version 2 of the License.
7--
8-- This program is distributed in the hope that it will be useful,
9-- but WITHOUT ANY WARRANTY; without even the implied warranty of
10-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11-- GNU General Public License for more details.
12--
13
14with Interfaces;
15
16package HW is
17
18 type Bit is mod 2 ** 1;
19
20 subtype Byte is Interfaces.Unsigned_8;
21 subtype Word8 is Byte;
22 function Shift_Left (Value : Word8; Amount : Natural) return Word8
23 renames Interfaces.Shift_Left;
24 function Shift_Right (Value : Word8; Amount : Natural) return Word8
25 renames Interfaces.Shift_Right;
26
27 subtype Word16 is Interfaces.Unsigned_16;
28 function Shift_Left (Value : Word16; Amount : Natural) return Word16
29 renames Interfaces.Shift_Left;
30 function Shift_Right (Value : Word16; Amount : Natural) return Word16
31 renames Interfaces.Shift_Right;
32
33 subtype Word32 is Interfaces.Unsigned_32;
34 function Shift_Left (Value : Word32; Amount : Natural) return Word32
35 renames Interfaces.Shift_Left;
36 function Shift_Right (Value : Word32; Amount : Natural) return Word32
37 renames Interfaces.Shift_Right;
38
39 subtype Word64 is Interfaces.Unsigned_64;
40 function Shift_Left (Value : Word64; Amount : Natural) return Word64
41 renames Interfaces.Shift_Left;
42 function Shift_Right (Value : Word64; Amount : Natural) return Word64
43 renames Interfaces.Shift_Right;
44
45 subtype Int8 is Interfaces.Integer_8;
46 subtype Int16 is Interfaces.Integer_16;
47 subtype Int32 is Interfaces.Integer_32;
48 subtype Int64 is Interfaces.Integer_64;
49
50 subtype Pos8 is Interfaces.Integer_8 range 1 .. Interfaces.Integer_8'Last;
51 subtype Pos16 is Interfaces.Integer_16 range 1 .. Interfaces.Integer_16'Last;
52 subtype Pos32 is Interfaces.Integer_32 range 1 .. Interfaces.Integer_32'Last;
53 subtype Pos64 is Interfaces.Integer_64 range 1 .. Interfaces.Integer_64'Last;
54
55 subtype Buffer_Range is Natural range 0 .. Natural'Last - 1;
56 type Buffer is array (Buffer_Range range <>) of Byte;
57
58end HW;