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

Subversion Repositories myblaze

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

Go to most recent revision | 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 5 2010-11-21 10:59:30Z rockee $
12
"""
13
 
14
import re
15
DEBUG_VERBOSE = 0
16
 
17
__re_dis=re.compile(r' *(?P<addr>[0-9a-f]+):\s+(?P<opcode>[0-9a-f]{8})\s+.*')
18
__dissembly = open('rom.dump').readlines()
19
__code = {}
20
for line in __dissembly:
21
    if line.find('debug')>0:
22
        break
23
    c = __re_dis.match(line)
24
    if c:
25
        __code[int(c.group('addr'), 16)] = line.strip()
26
 
27
def dissembly(address, opcode, rd=None, ra=None, rb=None,
28
                               dat_d=None, dat_a=None, dat_b=None,
29
                               alu_result=None, showreg=False):
30
    source = __code.get(int(address), '0'*8)
31
    if source.find('%08x' % opcode) >= 0:
32
        print '<match>: %s' % source
33
    else:
34
        print ''
35
        print '\tFATAL: NOT MATCH'
36
        print '\topcode:=%08x; expected:=%s' % (int(opcode), source)
37
    if not showreg:
38
        return
39
    print '\tRd: R%d=%d(%x) Ra: R%d=%d(%x) Rb: R%d=%d(%x) ALU: %d(%x)' % (
40
            rd, dat_d, dat_d, ra, dat_a, dat_a,
41
            rb, dat_b, dat_b, alu_result, alu_result)
42
 
43
 
44
 
45
### EOF ###
46
# vim:smarttab:sts=4:ts=4:sw=4:et:ai:tw=80:
47
 

powered by: WebSVN 2.1.0

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