| Nico Huber | 5e9b1b5 | 2016-10-08 22:09:33 +0200 | [diff] [blame] | 1 | -- |
| 2 | -- Copyright (C) 2015-2016 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 |
| Nico Huber | aab715f | 2016-10-18 00:22:25 +0200 | [diff] [blame] | 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| Nico Huber | 5e9b1b5 | 2016-10-08 22:09:33 +0200 | [diff] [blame] | 8 | -- |
| 9 | -- This program is distributed in the hope that it will be useful, |
| 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | -- GNU General Public License for more details. |
| 13 | -- |
| 14 | |
| 15 | package HW.Time |
| 16 | with Abstract_State => (State with External => Async_Writers) |
| 17 | is |
| 18 | |
| 19 | type T is private; |
| 20 | |
| Adrian-Ken Rueegsegger | 9f87a10 | 2017-10-18 14:53:35 +0200 | [diff] [blame^] | 21 | T_First : constant T; |
| 22 | |
| Nico Huber | 5e9b1b5 | 2016-10-08 22:09:33 +0200 | [diff] [blame] | 23 | function Now return T |
| 24 | with |
| 25 | Volatile_Function, |
| 26 | Global => (Input => State); |
| 27 | |
| 28 | function US_From_Now (US : Natural) return T |
| 29 | with |
| 30 | Volatile_Function, |
| 31 | Global => (Input => State); |
| 32 | |
| 33 | function MS_From_Now (MS : Natural) return T |
| 34 | with |
| 35 | Volatile_Function, |
| 36 | Global => (Input => State); |
| 37 | |
| 38 | function Now_US return Int64 |
| 39 | with |
| 40 | Volatile_Function, |
| 41 | Global => (Input => State); |
| 42 | |
| 43 | ---------------------------------------------------------------------------- |
| 44 | |
| 45 | pragma Warnings |
| 46 | (GNATprove, Off, "subprogram ""*Delay*"" has no effect", |
| 47 | Reason => "No effect on dataflow but time always passes."); |
| 48 | |
| 49 | -- Delay execution until Deadline has been reached. |
| 50 | procedure Delay_Until (Deadline : T) |
| 51 | with |
| 52 | Global => (Input => State); |
| 53 | |
| 54 | procedure U_Delay (US : Natural) |
| 55 | with |
| 56 | Global => (Input => State); |
| 57 | |
| 58 | procedure M_Delay (MS : Natural) |
| 59 | with |
| 60 | Global => (Input => State); |
| 61 | |
| 62 | pragma Warnings |
| 63 | (GNATprove, On, "subprogram ""*Delay*"" has no effect"); |
| 64 | |
| 65 | ---------------------------------------------------------------------------- |
| 66 | |
| 67 | function Timed_Out (Deadline : T) return Boolean |
| 68 | with |
| 69 | Volatile_Function, |
| 70 | Global => (Input => State); |
| 71 | |
| 72 | private |
| 73 | |
| 74 | type T is new Word64; |
| 75 | |
| Adrian-Ken Rueegsegger | 9f87a10 | 2017-10-18 14:53:35 +0200 | [diff] [blame^] | 76 | T_First : constant T := T'First; |
| 77 | |
| Nico Huber | 5e9b1b5 | 2016-10-08 22:09:33 +0200 | [diff] [blame] | 78 | end HW.Time; |
| 79 | |
| 80 | -- vim: set ts=8 sts=3 sw=3 et: |