Rev 1965 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1965 | Rev 1968 | ||
---|---|---|---|
1 | #!/usr/bin/env python |
1 | #!/usr/bin/env python |
2 | """ |
2 | """ |
3 | Decode 64-bit address into components |
3 | Decode 64-bit address into components |
4 | """ |
4 | """ |
5 | import sys |
5 | import sys |
6 | 6 | ||
7 | def main(): |
7 | def main(): |
8 | if len(sys.argv) != 2 or not sys.argv[1].startswith('0x'): |
8 | if len(sys.argv) != 2 or not sys.argv[1].startswith('0x'): |
9 | print "%s 0x..." % sys.argv[0] |
9 | print "%s 0x..." % sys.argv[0] |
10 | sys.exit(1) |
10 | sys.exit(1) |
11 | 11 | ||
12 | address = int(sys.argv[1],16) |
12 | address = int(sys.argv[1],16) |
13 | offset = address & 0xfff |
13 | offset = address & 0xfff |
14 | ptl3 = (address >> 12) & 0x1ff |
14 | ptl3 = (address >> 12) & 0x1ff |
15 | ptl2 = (address >> 21) & 0x1ff |
15 | ptl2 = (address >> 21) & 0x1ff |
16 | ptl1 = (address >> 30) & 0x1ff |
16 | ptl1 = (address >> 30) & 0x1ff |
17 | ptl0 = (address >> 39) & 0x1ff |
17 | ptl0 = (address >> 39) & 0x1ff |
18 | print "Ptl0: %3d" % ptl0 |
18 | print "Ptl0: %3d" % ptl0 |
19 | print "Ptl1: %3d" % ptl1 |
19 | print "Ptl1: %3d" % ptl1 |
20 | print "Ptl2: %3d" % ptl2 |
20 | print "Ptl2: %3d" % ptl2 |
21 | print "Ptl3: %3d" % ptl3 |
21 | print "Ptl3: %3d" % ptl3 |
22 | print "Offset: 0x%x" % offset |
22 | print "Offset: 0x%x" % offset |
23 | 23 | ||
24 | if __name__ == '__main__': |
24 | if __name__ == '__main__': |
25 | main() |
25 | main() |
26 | 26 |