You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is to discuss the implementation of a header file ghdl.h that provides an API to (de)code/convert GHDL's non-trivial data types. Precisely, to update https://ghdl.github.io/ghdl-cosim/vhpidirect/declarations.html by providing an easy-to-use solution for the types that are currently considered too difficult.
This issue is directly related to #2, because the functions provided in ghdl.h need to be accesible to foreign languages that load simulation models dynamically (as in VUnit/vunit#568). Hence, a *.ver script needs to be provided along with ghdl.h.
Arrays with static bounds (note: we have found no issues with these so far)
Unconstrained arrays
Strings
With dimensions of type natural.
Accesses to unconstrained arrays
Strings (i.e. line)
With dimensions of type natural.
Other accesses.
Files
As expected, handling unconstrained arrays is neither straightforward nor intuitive. Hence, the main purpose of the demo is to make it easier for new users to use these. The following helper functions are provided:
char* ghdlToString(ghdl_NaturalDimArr_t* ptr): convert a fat pointer of an unconstrained string, to a (null terminated) C string
void ghdlToArray(ghdl_NaturalDimArr_t* ptr, void** vec, int* len, int num): convert a fat pointer of an uncontrained array with (up to 3) dimensions of type 'natural', to C types
ghdl_NaturalDimArr_t ghdlFromString(char *string): convert a (null terminated) C string, to a fat pointer of an unconstrained string
ghdl_NaturalDimArr_t ghdlFromArray(void* vec, int* len, int num): convert C types representing an unconstrained array with a dimension of type 'natural', to a fat pointer (not complete yet
char* ghdlAccToString(ghdl_AccNaturalDimArr_t *line): convert an access to an unconstrained string, to a (null terminated) C string
void ghdlAccToArray(ghdl_AccNaturalDimArr_t* ptr, void** vec, int* len, int num): convert an access to an unconstrained array with a dimension of type 'natural', to C types (not implemented yet)
ghdl_AccNaturalDimArr_t* ghdlAccFromArray(uint32_t length, size_t bytes): convert C types representing an unconstrained array with a dimension of type 'natural', to an access
ghdl_AccNaturalDimArr_t* ghdlAccFromString(char *string): convert a (null terminated) C string, to an access to an unconstrained string
The text was updated successfully, but these errors were encountered:
This issue is to discuss the implementation of a header file
ghdl.h
that provides an API to (de)code/convert GHDL's non-trivial data types. Precisely, to update https://ghdl.github.io/ghdl-cosim/vhpidirect/declarations.html by providing an easy-to-use solution for the types that are currently considered too difficult.WIP: https://github.com/umarcor/ghdl-cosim/blob/header/vhpidirect/ghdl.h
Refs:
This issue is directly related to #2, because the functions provided in
ghdl.h
need to be accesible to foreign languages that load simulation models dynamically (as in VUnit/vunit#568). Hence, a*.ver
script needs to be provided along withghdl.h
./cc @RocketRoss @bradleyharden
character
/char
,integer
/int32_t
,natural
/uint32_t
,positive
/uint32_t
,real
/double
,boolean
/bool
,bit
/bool
,time
/int64_t
, shortenum
/uint8_t
)line
)As expected, handling unconstrained arrays is neither straightforward nor intuitive. Hence, the main purpose of the demo is to make it easier for new users to use these. The following helper functions are provided:
char* ghdlToString(ghdl_NaturalDimArr_t* ptr)
: convert a fat pointer of an unconstrained string, to a (null terminated) C stringvoid ghdlToArray(ghdl_NaturalDimArr_t* ptr, void** vec, int* len, int num)
: convert a fat pointer of an uncontrained array with (up to 3) dimensions of type 'natural', to C typesghdl_NaturalDimArr_t ghdlFromString(char *string)
: convert a (null terminated) C string, to a fat pointer of an unconstrained stringghdl_NaturalDimArr_t ghdlFromArray(void* vec, int* len, int num)
: convert C types representing an unconstrained array with a dimension of type 'natural', to a fat pointer (not complete yetchar* ghdlAccToString(ghdl_AccNaturalDimArr_t *line)
: convert an access to an unconstrained string, to a (null terminated) C stringvoid ghdlAccToArray(ghdl_AccNaturalDimArr_t* ptr, void** vec, int* len, int num)
: convert an access to an unconstrained array with a dimension of type 'natural', to C types (not implemented yet)ghdl_AccNaturalDimArr_t* ghdlAccFromArray(uint32_t length, size_t bytes)
: convert C types representing an unconstrained array with a dimension of type 'natural', to an accessghdl_AccNaturalDimArr_t* ghdlAccFromString(char *string)
: convert a (null terminated) C string, to an access to an unconstrained stringThe text was updated successfully, but these errors were encountered: