Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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