annotate analyze.py @ 6:b231162c8fdd

Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
author Mike Pavone <pavone@retrodev.com>
date Tue, 06 Nov 2012 01:57:36 -0800
parents
children 006008a3f370
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #!/usr/bin/env python
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3 #0 - !SE
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #1 - !CAS
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 #2 - A0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 #3 - A1
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 #------
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 #4 - A2
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 #5 - A3
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10 #6 - A7
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 #7 - EDCLK
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 #------
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 #8 - !HSYNC
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 #9 - A4
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 #A - A5
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 #B - A6
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17 #------
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 #C - !RAS
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 #D - !WB/!WE
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 #E - !DT/!OE
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21 #F - SC
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 #VRAM swizzling
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 #A0 = V0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 #A1 = V1
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
27 #A8 = V2
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
28 #A9 = V3
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
29 #A10 = V4
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
30 #A11 = V5
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
31 #A12 = V6
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
32 #A13 = V7
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
33 #A14 = V8
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
34 #A15 = V9
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
35 #--guesses follow--
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
36 #A2 = V10
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
37 #A3 = V11
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
38 #A4 = V12
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
39 #A5 = V13
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
40 #A6 = V14
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
41 #A7 = V15
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
42
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
43
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
44 def get_addr(sample):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
45 return ((sample >> 2) & 0xF) | ((sample >> 5) & 0x70) | ((sample << 1) & 0x80)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
46
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
47 def swizzle_addr(addr):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
48 return (addr & 0x0003) | ((addr >> 6) & 0x03FC) | ((addr << 8) & 0xFC00)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
49
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
50 def print_addr_op(addr, addr_format, mode, samplenum, triggerpos, rate):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
51 print '{0:{1}} ({2:{1}}) {3}@{4} ns'.format(swizzle_addr(addr), addr_format, addr, mode, (samplenum - triggerpos)*rate)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
52
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
53 def detect_rise(last, sample, bit):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
54 mask = 1 << bit
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
55 return (not last & mask) and (sample & mask)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
56
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
57 def detect_fall(last, sample, bit):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
58 mask = 1 << bit
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
59 return (last & mask) and (not sample & mask)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
60
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
61 def detect_high(sample, bit):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
62 mask = 1 << bit
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
63 return sample & mask
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
64
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
65
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
66 cas = 0x1
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
67 ras = 0xC
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
68 edclk = 0x7
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
69 hsync = 0x8
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
70 wewb = 0xD
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
71 oedt = 0xE
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
72 sc = 0xF
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
73
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
74 last = False
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
75 state = 'begin'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
76 triggerpos = 0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
77 readcounter = 0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
78 sillyread = 0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
79 lastaddr = -1
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
80 edclk_ticks = 0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
81 sc_ticks = 0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
82 tick_start = False
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
83 #f = open('street_fighter_vram_100mhz_hsync_trig_2.ols')
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
84 #f = open('street_fighter_vram_50mhz_hsync_trig.ols')
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
85 from sys import argv,exit
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
86 if len(argv) < 2:
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
87 print 'usage: analyze.py filename'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
88 exit(1)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
89 if '-b' in argv:
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
90 addr_format = '016b'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
91 else:
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
92 addr_format = '04X'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
93 f = open(argv[1])
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
94 for line in f:
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
95 if line.startswith(';TriggerPosition'):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
96 _,_,triggerpos = line.partition(':')
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
97 triggerpos = int(triggerpos.strip())
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
98 elif line.startswith(';Rate'):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
99 _,_,rate = line.partition(':')
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
100 #convert to nanoseconds between samples
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
101 rate = (1.0/float(rate.strip())) * 1000000000.0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
102 elif not line.startswith(';'):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
103 sample,_,samplenum = line.partition('@')
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
104 samplenum = int(samplenum.strip())
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
105 sample = int(sample, 16)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
106 if detect_rise(last, sample, edclk):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
107 edclk_ticks += 1
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
108 if detect_rise(last, sample, sc):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
109 sc_ticks += 1
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
110 if not (last is False):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
111 #detect falling edge of !HSYNC
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
112 if detect_fall(last, sample, hsync):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
113 if readcounter:
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
114 print readcounter, 'reads,', sillyread, 'redundant reads'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
115 readcounter = sillyread = 0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
116 if not tick_start is False:
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
117 float(edclk_ticks)/((rate * (samplenum-tick_start)) / 1000.0)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
118 print 'EDCLK:', edclk_ticks, ' ticks, {0}MHz'.format(float(edclk_ticks)/((rate * (samplenum-tick_start)) / 1000.0))
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
119 print 'SC:', sc_ticks, ' ticks, {0}MHz'.format(float(sc_ticks)/((rate * (samplenum-tick_start)) / 1000.0))
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
120 tick_start = samplenum
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
121 edclk_ticks = sc_ticks = 0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
122 print 'HSYNC Start'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
123 #detect rising edge of !HSYNC
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
124 elif detect_rise(last, sample, hsync):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
125 if not tick_start is False:
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
126 float(edclk_ticks)/((rate * (samplenum-tick_start)) / 1000.0)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
127 print 'EDCLK:', edclk_ticks, ' ticks, {0}MHz'.format(float(edclk_ticks)/((rate * (samplenum-tick_start)) / 1000.0))
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
128 print 'SC:', sc_ticks, ' ticks, {0}MHz'.format(float(sc_ticks)/((rate * (samplenum-tick_start)) / 1000.0))
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
129 tick_start = samplenum
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
130 edclk_ticks = sc_ticks = 0
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
131 print 'HSYNC End'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
132 if state == 'begin':
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
133 #detect falling edge of !RAS
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
134 if detect_fall(last, sample, ras):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
135 state = 'ras'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
136 row = get_addr(sample)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
137 mode = 'ram' if detect_high(sample, oedt) else 'read transfer'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
138 elif detect_fall(last, sample, cas):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
139 state = 'cas'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
140 elif state == 'ras':
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
141 if detect_fall(last, sample, cas):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
142 state = 'begin'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
143 col = get_addr(sample)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
144 addr = (row << 8) | col
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
145 if mode == 'ram':
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
146 state = 'ras_cas'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
147 else:
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
148 print_addr_op(addr, addr_format, mode, samplenum, triggerpos, rate)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
149 lastaddr = addr
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
150 #print '{0:04X} {1} - {2:02X}:{3:02X} - {0:016b}'.format(addr, mode, row, col)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
151 elif state == 'cas':
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
152 if detect_fall(last, sample, ras):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
153 state = 'begin'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
154 print 'refresh@{0} ns'.format((samplenum - triggerpos)*rate)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
155 elif state == 'ras_cas':
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
156 if detect_fall(last, sample, oedt):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
157 readcounter += 1
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
158 if addr == lastaddr:
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
159 sillyread += 1
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
160 print_addr_op(addr, addr_format, 'read', samplenum, triggerpos, rate)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
161 state = 'begin'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
162 elif detect_fall(last, sample, wewb):
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
163 print_addr_op(addr, addr_format, 'write', samplenum, triggerpos, rate)
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
164 state = 'begin'
b231162c8fdd Add some logic analyzer captures, a Python script for analyzing said captures and a higher level analysis of the output
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
165 last = sample