> Hello,
> I'd like to change a VHDL shared variable's value from C code.
> So far I can reuse the trick used for the framebuffer system
> (see http://ygdes.com/GHDL/fb/fb_ghdl.vhdl :
> 
> package fb_ghdl is
>    ...
> 
>    type screen_type is
>      array(integer range 0 to fby1,
>            integer range 0 to fbxv1) of integer;
> 
>    type screen_p is access screen_type;
> 
>    -- alias :
>    function get_fbp(f : integer) return screen_p;
>      attribute foreign of get_fbp :
>        function is "VHPIDIRECT get_fb";
> 
>    -- init the screen address
>    shared variable pixel : screen_p := get_fbp(0);
> 
> ...
> 
> So with this system, I can sort-of alias a VHDL shared variable
> to a C variable. This is for a dynamic flag that will be changed
> by a POSIX signal for timing purposes.
> 
> the question is : how to do the reverse ?
> What about getting the address of a GHDL variable
> (in a package) and letting the C code change it ?
> 
> As far as I know : the only things that are transmitted
> by address are arrays, but here I have a scalar.
> 
> I'd like to avoid having to objdump the compiled VHDL code
> because I've only found confusing names, like
> work__fb_ghdl__pixel and work__fb_ghdl__pixel__RTISTR
> both as initialised and uninitialised data...
> 
> Is it safe to create the scalar, then a Access to it,
> and provide the access to a C function ?

What about:
  function set_fbp (adde : screen_p) return boolean;
  attribute foreign of set_fbp : function is "VHPIDIRECT set_fb";

  constant dummy : boolean := set_fbp (pixel);

Tristan.

_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to