-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Header file for VHPIDIRECT/C and demo #3
Labels
Comments
@RocketRoss, can you rebase/rework umarcor/ghdl#1 on top of https://github.com/umarcor/ghdl-cosim/tree/header? |
This was referenced Apr 13, 2020
Im on it |
Is that clean enough? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: