Initial upstream commit
The history contained unlicensed code so everything got squashed, sorry.
Change-Id: Ie1335ecfcee7f740bb6de2e9887606be30a2deff
Signed-off-by: Nico Huber <nico.huber@secunet.com>
diff --git a/common/hw.ads b/common/hw.ads
new file mode 100644
index 0000000..6bfca91
--- /dev/null
+++ b/common/hw.ads
@@ -0,0 +1,58 @@
+--
+-- Copyright (C) 2015 secunet Security Networks AG
+--
+-- This program 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; version 2 of the License.
+--
+-- This program 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.
+--
+
+with Interfaces;
+
+package HW is
+
+ type Bit is mod 2 ** 1;
+
+ subtype Byte is Interfaces.Unsigned_8;
+ subtype Word8 is Byte;
+ function Shift_Left (Value : Word8; Amount : Natural) return Word8
+ renames Interfaces.Shift_Left;
+ function Shift_Right (Value : Word8; Amount : Natural) return Word8
+ renames Interfaces.Shift_Right;
+
+ subtype Word16 is Interfaces.Unsigned_16;
+ function Shift_Left (Value : Word16; Amount : Natural) return Word16
+ renames Interfaces.Shift_Left;
+ function Shift_Right (Value : Word16; Amount : Natural) return Word16
+ renames Interfaces.Shift_Right;
+
+ subtype Word32 is Interfaces.Unsigned_32;
+ function Shift_Left (Value : Word32; Amount : Natural) return Word32
+ renames Interfaces.Shift_Left;
+ function Shift_Right (Value : Word32; Amount : Natural) return Word32
+ renames Interfaces.Shift_Right;
+
+ subtype Word64 is Interfaces.Unsigned_64;
+ function Shift_Left (Value : Word64; Amount : Natural) return Word64
+ renames Interfaces.Shift_Left;
+ function Shift_Right (Value : Word64; Amount : Natural) return Word64
+ renames Interfaces.Shift_Right;
+
+ subtype Int8 is Interfaces.Integer_8;
+ subtype Int16 is Interfaces.Integer_16;
+ subtype Int32 is Interfaces.Integer_32;
+ subtype Int64 is Interfaces.Integer_64;
+
+ subtype Pos8 is Interfaces.Integer_8 range 1 .. Interfaces.Integer_8'Last;
+ subtype Pos16 is Interfaces.Integer_16 range 1 .. Interfaces.Integer_16'Last;
+ subtype Pos32 is Interfaces.Integer_32 range 1 .. Interfaces.Integer_32'Last;
+ subtype Pos64 is Interfaces.Integer_64 range 1 .. Interfaces.Integer_64'Last;
+
+ subtype Buffer_Range is Natural range 0 .. Natural'Last - 1;
+ type Buffer is array (Buffer_Range range <>) of Byte;
+
+end HW;