1-- GHDL Run Time (GRT) - misc subprograms. 2-- Copyright (C) 2002 - 2016 Tristan Gingold 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, either version 2 of the License, or 7-- (at your option) any later version. 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-- You should have received a copy of the GNU General Public License 15-- along with this program. If not, see <gnu.org/licenses>. 16-- 17-- As a special exception, if other files instantiate generics from this 18-- unit, or you link this unit with other files to produce an executable, 19-- this unit does not by itself cause the resulting executable to be 20-- covered by the GNU General Public License. This exception does not 21-- however invalidate any other reasons why the executable file might be 22-- covered by the GNU Public License. 23with Grt.Types; use Grt.Types; 24 25package Grt.Lib is 26 procedure Ghdl_Memcpy 27 (Dest : Ghdl_Ptr; Src : Ghdl_Ptr; Size : Ghdl_Index_Type); 28 29 procedure Ghdl_Assert_Failed 30 (Str : Std_String_Ptr; Severity : Integer; Loc : Ghdl_Location_Ptr); 31 procedure Ghdl_Ieee_Assert_Failed 32 (Str : Std_String_Ptr; Severity : Integer; Loc : Ghdl_Location_Ptr); 33 34 procedure Ghdl_Psl_Assert_Failed 35 (Str : Std_String_Ptr; Severity : Integer; Loc : Ghdl_Location_Ptr); 36 37 procedure Ghdl_Psl_Assume_Failed (Loc : Ghdl_Location_Ptr); 38 39 -- Called when a sequence is covered (in a cover directive) 40 procedure Ghdl_Psl_Cover 41 (Str : Std_String_Ptr; Severity : Integer; Loc : Ghdl_Location_Ptr); 42 43 procedure Ghdl_Psl_Cover_Failed 44 (Str : Std_String_Ptr; Severity : Integer; Loc : Ghdl_Location_Ptr); 45 46 procedure Ghdl_Report 47 (Str : Std_String_Ptr; Severity : Integer; Loc : Ghdl_Location_Ptr); 48 49 -- Bound / Direction error. 50 procedure Ghdl_Bound_Check_Failed (Filename : Ghdl_C_String; 51 Line: Ghdl_I32); 52 procedure Ghdl_Direction_Check_Failed (Filename : Ghdl_C_String; 53 Line: Ghdl_I32); 54 55 procedure Ghdl_Integer_Index_Check_Failed 56 (Filename : Ghdl_C_String; 57 Line : Ghdl_I32; 58 Val : Std_Integer; 59 Rng : Std_Integer_Range_Ptr); 60 61 -- Program error has occurred: 62 -- * configuration of an already configured block. 63 procedure Ghdl_Program_Error (Filename : Ghdl_C_String; 64 Line : Ghdl_I32; 65 Code : Ghdl_Index_Type); 66 67 function Ghdl_I32_Exp (V : Ghdl_I32; E : Std_Integer) return Ghdl_I32; 68 function Ghdl_I64_Exp (V : Ghdl_I64; E : Std_Integer) return Ghdl_I64; 69 70 -- Called before allocation of large (complex) objects. 71 procedure Ghdl_Check_Stack_Allocation (Size : Ghdl_Index_Type); 72 73 function Ghdl_Malloc (Size : Ghdl_Index_Type) return Ghdl_Ptr; 74 75 -- Allocate and clear SIZE bytes. 76 function Ghdl_Malloc0 (Size : Ghdl_Index_Type) return Ghdl_Ptr; 77 78 procedure Ghdl_Deallocate (Ptr : Ghdl_Ptr); 79 80 function Ghdl_Real_Exp (X : Ghdl_Real; Exp : Ghdl_I32) 81 return Ghdl_Real; 82 83 type Ghdl_Std_Ulogic_Boolean_Array_Type is array (Ghdl_E8 range 0 .. 8) 84 of Ghdl_B1; 85 86 Ghdl_Std_Ulogic_To_Boolean_Array : 87 constant Ghdl_Std_Ulogic_Boolean_Array_Type := (False, -- U 88 False, -- X 89 False, -- 0 90 True, -- 1 91 False, -- Z 92 False, -- W 93 False, -- L 94 True, -- H 95 False -- - 96 ); 97 98 function Textio_Read_Real (Str : Std_String_Ptr) return Ghdl_F64; 99 100 procedure Textio_Write_Real (Str : Std_String_Ptr; 101 Len : Std_Integer_Acc; 102 V : Ghdl_F64; 103 Ndigits : Std_Integer); 104 105 function Ghdl_Get_Resolution_Limit return Std_Time; 106 107 procedure Ghdl_Control_Simulation 108 (Stop : Ghdl_B1; Has_Status : Ghdl_B1; Status : Std_Integer); 109private 110 pragma Export (C, Ghdl_Memcpy, "__ghdl_memcpy"); 111 112 pragma Export (C, Ghdl_Assert_Failed, "__ghdl_assert_failed"); 113 pragma Export (C, Ghdl_Ieee_Assert_Failed, "__ghdl_ieee_assert_failed"); 114 pragma Export (C, Ghdl_Psl_Assume_Failed, "__ghdl_psl_assume_failed"); 115 pragma Export (C, Ghdl_Psl_Assert_Failed, "__ghdl_psl_assert_failed"); 116 pragma Export (C, Ghdl_Psl_Cover, "__ghdl_psl_cover"); 117 pragma Export (C, Ghdl_Psl_Cover_Failed, "__ghdl_psl_cover_failed"); 118 pragma Export (C, Ghdl_Report, "__ghdl_report"); 119 120 pragma Export (C, Ghdl_Bound_Check_Failed, 121 "__ghdl_bound_check_failed"); 122 pragma Export (C, Ghdl_Direction_Check_Failed, 123 "__ghdl_direction_check_failed"); 124 pragma Export (C, Ghdl_Integer_Index_Check_Failed, 125 "__ghdl_integer_index_check_failed"); 126 127 pragma Export (C, Ghdl_Program_Error, "__ghdl_program_error"); 128 129 pragma Export (C, Ghdl_Check_Stack_Allocation, 130 "__ghdl_check_stack_allocation"); 131 132 pragma Export (C, Ghdl_Malloc, "__ghdl_malloc"); 133 pragma Export (C, Ghdl_Malloc0, "__ghdl_malloc0"); 134 pragma Export (C, Ghdl_Deallocate, "__ghdl_deallocate"); 135 136 pragma Export (C, Ghdl_I32_Exp, "__ghdl_i32_exp"); 137 pragma Export (C, Ghdl_I64_Exp, "__ghdl_i64_exp"); 138 pragma Export (C, Ghdl_Real_Exp, "__ghdl_real_exp"); 139 140 pragma Export (C, Ghdl_Std_Ulogic_To_Boolean_Array, 141 "__ghdl_std_ulogic_to_boolean_array"); 142 143 pragma Export (C, Textio_Read_Real, 144 "std__textio__textio_read_real"); 145 pragma Export (C, Textio_Write_Real, 146 "std__textio__textio_write_real"); 147 148 pragma Export (C, Ghdl_Get_Resolution_Limit, 149 "std__env__get_resolution_limit"); 150 pragma Export (Ada, Ghdl_Control_Simulation, 151 "std__env__control_simulation"); 152end Grt.Lib; 153