Skip to content
Snippets Groups Projects
Commit 54748268 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "lrdp-v2: set up register.py for doctest"

parents cfaa2643 87538b00
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ class Register(object): ...@@ -43,7 +43,7 @@ class Register(object):
You can also overlay fields on top of each other without problems: You can also overlay fields on top of each other without problems:
>>> abc.add_field("another_other", (8, 0)) >>> abc.add_field("another_other", (8, 0))
abc.another_other = 0x5 >>> abc.another_other = 0x5
>>> hex(abc.value) >>> hex(abc.value)
'0x5' '0x5'
...@@ -116,3 +116,7 @@ class Register(object): ...@@ -116,3 +116,7 @@ class Register(object):
val = bitops.bvalsel(msb, lsb, self.value) val = bitops.bvalsel(msb, lsb, self.value)
ret.append('%s[%d:%d]=>0x%0x' % (r, msb, lsb, val)) ret.append('%s[%d:%d]=>0x%0x' % (r, msb, lsb, val))
return 'value: 0x%x {%s}' % (self.value, ', '.join(ret)) return 'value: 0x%x {%s}' % (self.value, ', '.join(ret))
if __name__ == "__main__":
import doctest
doctest.testmod()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment