diff options
Diffstat (limited to 'translate/grt/grt-signals.ads')
-rw-r--r-- | translate/grt/grt-signals.ads | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/translate/grt/grt-signals.ads b/translate/grt/grt-signals.ads index 4d24639..d61dee3 100644 --- a/translate/grt/grt-signals.ads +++ b/translate/grt/grt-signals.ads @@ -126,10 +126,38 @@ package Grt.Signals is end case; end record; + -- Resolution function. + -- There is a wrapper around resolution functions to simplify the call + -- from GRT. + -- INSTANCE is the opaque parameter given when the resolver is + -- registers (RESOLV_INST). + -- VAL is the signal (which may be composite). + -- BOOL_VEC is an array of NBR_DRV booleans (bytes) and indicates + -- non-null drivers. There are VEC_LEN non-null drivers. So the number + -- of values is VEC_LEN + NBR_PORTS. This number of values is the length + -- of the array for the resolution function. + type Resolver_Acc is access procedure + (Instance : System.Address; + Val : System.Address; + Bool_Vec : System.Address; + Vec_Len : Ghdl_Index_Type; + Nbr_Drv : Ghdl_Index_Type; + Nbr_Ports : Ghdl_Index_Type); + + -- On some platforms, GNAT use a descriptor (instead of a trampoline) for + -- nested subprograms. This descriptor contains the address of the + -- subprogram and the address of the chain. An unaligned pointer to this + -- descriptor (address + 1) is then used for 'Access, and every indirect + -- call check for unaligned address. + -- + -- Disable this feature (as a resolver is never a nested subprogram), so + -- code generated by ghdl is compatible with ghdl runtimes built with + -- gnat. + pragma Convention (C, Resolver_Acc); -- How to compute resolved signal. type Resolved_Signal_Type is record - Resolv_Proc : System.Address; + Resolv_Proc : Resolver_Acc; Resolv_Inst : System.Address; Resolv_Ptr : System.Address; Sig_Range : Sig_Table_Range; @@ -494,7 +522,7 @@ package Grt.Signals is function Ghdl_Signal_Driving (Sig : Ghdl_Signal_Ptr) return Ghdl_B2; function Ghdl_Create_Signal_B2 (Init_Val : Ghdl_B2; - Resolv_Func : System.Address; + Resolv_Func : Resolver_Acc; Resolv_Inst : System.Address) return Ghdl_Signal_Ptr; procedure Ghdl_Signal_Init_B2 (Sig : Ghdl_Signal_Ptr; Init_Val : Ghdl_B2); @@ -512,7 +540,7 @@ package Grt.Signals is return Ghdl_B2; function Ghdl_Create_Signal_E8 (Init_Val : Ghdl_E8; - Resolv_Func : System.Address; + Resolv_Func : Resolver_Acc; Resolv_Inst : System.Address) return Ghdl_Signal_Ptr; procedure Ghdl_Signal_Init_E8 (Sig : Ghdl_Signal_Ptr; Init_Val : Ghdl_E8); @@ -530,7 +558,7 @@ package Grt.Signals is return Ghdl_E8; function Ghdl_Create_Signal_E32 (Init_Val : Ghdl_E32; - Resolv_Func : System.Address; + Resolv_Func : Resolver_Acc; Resolv_Inst : System.Address) return Ghdl_Signal_Ptr; procedure Ghdl_Signal_Init_E32 (Sig : Ghdl_Signal_Ptr; Init_Val : Ghdl_E32); @@ -548,7 +576,7 @@ package Grt.Signals is return Ghdl_E32; function Ghdl_Create_Signal_I32 (Init_Val : Ghdl_I32; - Resolv_Func : System.Address; + Resolv_Func : Resolver_Acc; Resolv_Inst : System.Address) return Ghdl_Signal_Ptr; procedure Ghdl_Signal_Init_I32 (Sig : Ghdl_Signal_Ptr; Init_Val : Ghdl_I32); @@ -566,7 +594,7 @@ package Grt.Signals is return Ghdl_I32; function Ghdl_Create_Signal_I64 (Init_Val : Ghdl_I64; - Resolv_Func : System.Address; + Resolv_Func : Resolver_Acc; Resolv_Inst : System.Address) return Ghdl_Signal_Ptr; procedure Ghdl_Signal_Init_I64 (Sig : Ghdl_Signal_Ptr; Init_Val : Ghdl_I64); @@ -584,7 +612,7 @@ package Grt.Signals is return Ghdl_I64; function Ghdl_Create_Signal_F64 (Init_Val : Ghdl_F64; - Resolv_Func : System.Address; + Resolv_Func : Resolver_Acc; Resolv_Inst : System.Address) return Ghdl_Signal_Ptr; procedure Ghdl_Signal_Init_F64 (Sig : Ghdl_Signal_Ptr; Init_Val : Ghdl_F64); @@ -627,8 +655,8 @@ package Grt.Signals is Dst : Ghdl_Signal_Ptr; Dst_Len : Ghdl_Index_Type); - -- Mark the next signals as resolved. - procedure Ghdl_Signal_Create_Resolution (Proc : System.Address; + -- Mark the next (and not yet created) NBR_SIG signals as resolved. + procedure Ghdl_Signal_Create_Resolution (Proc : Resolver_Acc; Instance : System.Address; Sig : System.Address; Nbr_Sig : Ghdl_Index_Type); @@ -667,6 +695,8 @@ package Grt.Signals is function Ghdl_Signal_Get_Nbr_Drivers (Sig : Ghdl_Signal_Ptr) return Ghdl_Index_Type; + -- Read a source (port or driver) from a signal. This is used by + -- resolution functions. function Ghdl_Signal_Read_Port (Sig : Ghdl_Signal_Ptr; Index : Ghdl_Index_Type) return Ghdl_Value_Ptr; |