-
Notifications
You must be signed in to change notification settings - Fork 263
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
[2/3] Add external modes to string_ptr and integer_vector_ptr (through VHPIDIRECT) #476
Conversation
3176f13
to
9b78114
Compare
7a87834
to
3ab1f43
Compare
40fbe06
to
4cc4cd9
Compare
@kraigher, I am having problems to automatically load the data types when the user does not do it neither explicitly ( Currently, only the first call to I tried to add Where should I add |
fc6d8b4
to
2db197b
Compare
2db197b
to
8bea441
Compare
I solved it by saving and checking This PR is now based on #482. |
9a9b74b
to
b93d64b
Compare
6ae075b
to
eb9c94d
Compare
88441e4
to
a5ef2cb
Compare
de9113e
to
abc4b53
Compare
464afc7
to
f8f2351
Compare
Now that #507 is merged, I moved all the content related to VUnitCoSim to #568, so this PR is just a follow-up:
Note that |
f8f2351
to
bec5fe9
Compare
bec5fe9
to
4e9b786
Compare
* add sigabrt.md
4e9b786
to
2b002fc
Compare
Based on #482 and #507.
Refs #462, #465, #470.
In this PR, external modes are added to
integer_vector_ptr.vhd
, following the same approach as in #507.In order to support using
*_ptr
with or without VHPI, two different implementations of the external resources are provided. One of them,external_*_pkg-vhpi.vhd
, declares the functions/procedures as external; therefore, C implementations must be provided. The other one,external_*_pkg-novhpi.vhd
does not declare the functions/procedures as external; C implementations are not required, but it is not possible to create vectors withid/=0
(an assertion of level error is raised).The list of objects is added through
set_sim_option("ghdl.elab_flags", ["-Wl," + " ".join(files)])
.An example is added,
external_buffer
, to test accessing the same external buffer/array using two methods. The external C application allocates a buffer of length 15 and writes to the first 5 positions. In the VHDL testbench, twointeger_vector_ptr
are created. The first one is used to copy the first five elements to positions 5-9. And the second one is used to copy data from positions 5-9, to positions 10-14. The C application prints all the positions before and after the execution of the simulation.deallocate
,reallocate
andresize
are not implemented for external models. For the caseid>0
, it would be easy to implement it. Since the 'connection' is a pointer, it is possible to usemalloc
ormmap
in the C implementation. Coherently, it would be possible to update the length in the VHDL model according to the actual size in the C app.However, when
extfnc
, it can be complex or not possible. Sinceread_byte
/write_byte
can be used to interact with external services/processes through pipes, sockets, packets, messages, etc., the implementation is likely to be very specific. Nonetheless, in this example the implementation can be the same for both 'access' modes.ghdl/ghdl#797