Skip to content

ValueInt class needs something like $signed method in SV #248

@Amirk97

Description

@Amirk97

So im using the value stored in an ValueInt object in python and the stored binary value which works correctly with dut interface always gets misinterpreted in Python world because python infers the given numbers as unsigend. I think having a $signed helper method in ValueInt class can be helpful to prevent such problems. I have currently implemented a $signed function in this way:

def signed(numb, width):
if (numb >> (width-1)):
return(-((2 ** width) - numb))
else:
return numb

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions