> We discovered another minor difficulty in DPI.
> The crux of the matter involves the "small" packed 2-state type
> modeled with svBitVec32. When a 2-state vector is <= 32 bits,
> it is no longer passed by reference, but rather by value.
> This makes it impossible for a DPI user to create a single
> imported function that accepts an arbitrary width 2-state
> vector as an argument.
Doug,
I believe that open arrays were intended exactly for what you want to achieve,
i.e. to "make it possible for a DPI user to create a single imported function
that accepts an arbitrary width 2-state vector as an argument."
LRM 27.1.2: "Formal arguments of an imported function can be specified as open arrays.
A formal argument is an open array when a range of one or more of its dimensions, packed
or unpacked, is unspecified. [...] An actual argument shall match the formal one regardless
of the range(s) for its cor-responding dimension(s), which facilitates writing generalized
code that can handle SystemVerilog arrays of different sizes."
So in my opinion we have both; generality and efficiency for "typical" cases.
Pls. also note, that passing small values 'by value' rather than by a reference is consistent
with C. If small values, like int, were not passed by value, then it will be impossible
to call standard C library functions from SV.
Thanks,
Andrzej
> Details are located at
> http://www.eda.org/svdb/bug_view_page.php?bug_id=0000274
>
> Charles,
>
> Can you please assign me to be the owner of this item?
> I will upload a proposal that basically simplifies DPI by
> eliminating the exception for bit vectors <= 32 bits in width.
>
> Thanks and regards,
> Doug
>
>
Received on Wed Oct 27 07:18:32 2004
This archive was generated by hypermail 2.1.8 : Wed Oct 27 2004 - 07:18:45 PDT