aboutsummaryrefslogtreecommitdiffstats
path: root/survey.py
diff options
context:
space:
mode:
Diffstat (limited to 'survey.py')
-rwxr-xr-xsurvey.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/survey.py b/survey.py
index 55a8ab0..bfd9313 100755
--- a/survey.py
+++ b/survey.py
@@ -58,22 +58,22 @@ def observe(part, rel_addr, map):
>>> observe((3, '3'), 0, {})
(3, '3')
- >>> observe(('label[31:0]', 'imm32'), 0, {'label': 1234})
- (1234, 32)
- >>> observe(('label-2[31:0]', 'imm32'), 0, {'label': 1234})
- (1232, 32)
- >>> observe(('label[1:0]', 'imm32'), 0, {'label': 1234})
- (2, 2)
- >>> observe(('label[31:0]', 'off32'), 1000, {'label': 1234})
- (234, 32)
- >>> observe(('label[31:12]', 'off32'), 1000, {'label': 0x10fff})
- (16, 20)
- >>> observe(('label[31:0]', 'off32'), 2000, {'label': 1000})
- (4294966296, 32)
+ >>> observe(('label[31:0]', 'imm32'), 0, {'label': 0x1234})
+ Bitfield(0x1234, 32)
+ >>> observe(('label-2[31:0]', 'imm32'), 0, {'label': 0x1234})
+ Bitfield(0x1232, 32)
+ >>> observe(('label[1:0]', 'imm32'), 0, {'label': 0x1236})
+ Bitfield(0x2, 2)
+ >>> observe(('label[31:0]', 'off32'), 0x1000, {'label': 0x1234})
+ Bitfield(0x234, 32)
+ >>> observe(('label[31:12]', 'off32'), 0x1000, {'label': 0x10fff})
+ Bitfield(0xf, 20)
+ >>> observe(('label[31:0]', 'off32'), 0x2000, {'label': 0x1000})
+ Bitfield(0xfffff000, 32)
>>> observe(('label+4[7:0]', 'off32'), 0x1000, {'label': 0x1234})
- (56, 8)
+ Bitfield(0x38, 8)
>>> observe(('label+4[15:8]', 'off32'), 0x1000, {'label': 0x1234})
- (2, 8)
+ Bitfield(0x2, 8)
>>> observe(('label[32:0]', 'imm32'), 0, {})
Traceback (most recent call last):
@@ -97,7 +97,7 @@ def observe(part, rel_addr, map):
else:
addr = bits.i(addr - rel_addr, 32)
- return bits.slice(addr, ref['hi'], ref['lo'])
+ return addr[ref['hi']:ref['lo']]
@subv.with_parsed_lines
def survey(iter):