Hi guys,

just throwing in a snippet, I think this question has come up before.

For example, a duplex FIFO wrapper on the VHDL side:

subtype fifoflag_t is unsigned(0 to 5);
...
procedure fifo_rxtx(df : inout duplexfifo_t; data : inout unsigned;
flags : inout fifoflag_t)

would map into

void sim_fifo_rxtx(duplexfifo_t_ghdl *fifo,
        struct fat_pointer *data, char *flag)
{
        DuplexFifo *f = (DuplexFifo *) fifo[0];
        fifo_pump(f, data, flag);
}

So the sized unsigned type in VHDL becomes [char *], the unsized a
[struct fat_pointer *]. I believe it is documented how to pull out the
bits, otherwise, have a look at the ghdlex functions in helper.c
(logic_to_bytes, etc.). The reverse conversion is also covered there.

Greetings,

- Martin

_______________________________________________
Ghdl-discuss mailing list
Ghdl-discuss@gna.org
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to