]> git.nickg.me.uk Git - nvc.git/commit
vhpi: Fix vhpi_get_value with EnumVecVal format
authorSean Anderson <seanga2@gmail.com>
Mon, 29 May 2023 21:49:14 +0000 (17:49 -0400)
committerNick Gasson <nick@nickg.me.uk>
Sun, 4 Jun 2023 22:00:34 +0000 (22:00 +0000)
commited304b8e5666ae8e3a7868d7787ca2cb8f1c643c
tree400a47ecc0393d564414b32969858def1137f0fa
parentf1c19a46bc99e64526ddb423d08e80a9ccd38733
vhpi: Fix vhpi_get_value with EnumVecVal format

The Logic, SmallEnum, and Enum formats were not treated consistently.
Sometimes the wrong value type was used to store signals, and the
variable signal size of Enum was not handled properly. The correct
relationships for these types may be seen in the following table:

Format           Value type     Signal size
================ ============== ===========
vhpiLogicVal     vhpiEnumT      8
vhpiSmallEnumVal vhpiSmallEnumT 8
vhpiEnumVal      vhpiEnumT      variable

In order to handle the variable size of Enum, we need to use FOR_ALL_SIZES
from model.c. Move it to util.h, and rename a conflicting macro with a
similar purpose. This also adds support for getting SmallEnumVecs.

This adds a test for the Vec versions of these formats; the non-vec
versions will be tested when indexedName get/put support is added.
src/jit/jit-optim.c
src/rt/model.c
src/rt/model.h
src/util.h
src/vhpi/vhpi-model.c
test/regress/testlist.txt
test/regress/vhpi8.vhd [new file with mode: 0644]
test/vhpi/Makemodule.am
test/vhpi/vhpi8.c [new file with mode: 0644]
test/vhpi/vhpi_test.c
test/vhpi/vhpi_test.h