OpenCores
URL https://opencores.org/ocsvn/myblaze/myblaze/trunk

Subversion Repositories myblaze

[/] [myblaze/] [trunk/] [rtl/] [debug.py] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rockee
# -*- coding: utf-8 -*-
2
"""
3
    debug.py
4
    ========
5
 
6
    Debug functions
7
 
8
    :copyright: Copyright (c) 2010 Jian Luo.
9 5 rockee
    :author-email: jian.luo.cn(at_)gmail.com.
10
    :license: LGPL, see LICENSE for details.
11 2 rockee
    :revision: $Id: debug.py 6 2010-11-21 23:18:44Z rockee $
12
"""
13
 
14
import re
15
 
16
__re_dis=re.compile(r' *(?P<addr>[0-9a-f]+):\s+(?P<opcode>[0-9a-f]{8})\s+.*')
17
__dissembly = open('rom.dump').readlines()
18
__code = {}
19
for line in __dissembly:
20
    if line.find('debug')>0:
21
        break
22
    c = __re_dis.match(line)
23
    if c:
24
        __code[int(c.group('addr'), 16)] = line.strip()
25
 
26
def dissembly(address, opcode, rd=None, ra=None, rb=None,
27
                               dat_d=None, dat_a=None, dat_b=None,
28
                               alu_result=None, showreg=False):
29
    source = __code.get(int(address), '0'*8)
30
    if source.find('%08x' % opcode) >= 0:
31
        print '<match>: %s' % source
32
    else:
33
        print ''
34
        print '\tFATAL: NOT MATCH'
35
        print '\topcode:=%08x; expected:=%s' % (int(opcode), source)
36
    if not showreg:
37
        return
38
    print '\tRd: R%d=%d(%x) Ra: R%d=%d(%x) Rb: R%d=%d(%x) ALU: %d(%x)' % (
39
            rd, dat_d, dat_d, ra, dat_a, dat_a,
40
            rb, dat_b, dat_b, alu_result, alu_result)
41
 
42
 
43
 
44
### EOF ###
45
# vim:smarttab:sts=4:ts=4:sw=4:et:ai:tw=80:
46
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.