Skip to content
Snippets Groups Projects
Commit abd9e13b authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Added to_uword().

parent 20c23763
No related branches found
No related tags found
No related merge requests found
......@@ -453,6 +453,20 @@ def rotate_list(in_list, n):
"""
return in_list[n:] + in_list[:n]
def to_uword(arg):
"""
Represent 32 bit value as unsigned word. Note that:
common.to_signed(common.to_uword(-1), 32) = -1
"""
vRet = []
vList = listify(arg)
for value in vList:
v = int(value) & c_word_mask # mask the 32 bits, also accept float value by converting to int
vRet.append(v)
return unlistify(vRet)
def to_unsigned(arg, width):
"""
Interpret value[width-1:0] as unsigned
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment