summaryrefslogtreecommitdiff
path: root/usrp/host/apps/check_order
blob: 56e192710fde339bc7e6add66a8c809511ece60b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# -*- Python -*-

import sys
import fileinput

skip_count = 4096
lineno = 0
last_error = 0

for line in fileinput.input ():
    lineno += 1
    if lineno < skip_count:
        continue
    (offset, dec_val, hex_val) = line.split ()
    if lineno == skip_count:
        expected_val = int (dec_val)
    int_dec_val = int (dec_val)
    int_hex_val = int (hex_val, 16)
    if int_dec_val != expected_val:
        print "line %6d, delta %4d, expected %6d, got %6d" % (lineno,
                                                              lineno - last_error,
                                                              expected_val,
                                                              int_dec_val)
        last_error = lineno
    elif ((int_hex_val >> 12) & 0xf) != (int_hex_val & 0xf):
        print "line %6d, delta %4d, invalid high bits %04x" % (lineno,
                                                               lineno - last_error,
                                                               int_hex_val)
        last_error = lineno
        
    # expected_val = (expected_val + 1) & 0xffff
    expected_val = (expected_val + 1) & 0x0fff