Skip to content
Discussion options

You must be logged in to vote

Hi @msmftc,
As you rightly point out, this situation isn't well-covered in the docs. I suppose that is because most use cases can make use of the Python operator overloading that allows getting/setting the field value simply by referencing it. The get_val()/set_val() methods are primarily used when creating fields outside a class context:

def test_simple_rand(self):
a = vsc.rand_uint8_t()
b = vsc.rand_uint8_t()
vsc.randomize(a, b)
print("a=" + str(a.get_val()) + " b=" + str(b.get_val()))

In order to call get_val/set_val directly, your code will need to work around the operator …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by msmftc
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants