forked from nerdralph/strapread
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gendump.py
executable file
·46 lines (41 loc) · 2.57 KB
/
gendump.py
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
40
41
42
43
44
45
#!/usr/bin/python
# swap bytes in little-endian hex string to big endian
def swapb(hex8):
return hex8[6:8] + hex8[4:6] + hex8[2:4] + hex8[0:2]
# generate dump function
def gendump(reg, data):
name = reg.pop()
print ' ' + name, name + '_d = {0x' + swapb(data) + '};'
print ' printf("' + name + '\\n");'
for i in reg:
i = i[0:-2]
print ' printf("' + i + ':%d ",' + name + '_d.fields.' + i + ');'
print ' printf("\\n");'
# Rx470 Samsung 1500
#strap = '555000000000000022CC1C00AD515A3EC0570E142D4A64080048C700030114207A8900A003000000150E2A3186272E16'
# Rx470 Samsung 1625
#strap = '555000000000000022CC1C00CE596B44D0570F1531CB2409004AE7000B0314207A8900A003000000170F2E36922A3217'
# Rx470 Samsung 1750
#strap = '777000000000000022CC1C0010626C49D0571016B50BD509004AE700140514207A8900A003000000191131399D2C3617'
# Rx470 Samsung 1900
#strap = '777000000000000022CC1C00106A7D4FE0571117B98CA50A004C07011C0714207A8900A0030000001B11353FAA2F3A18'
# custom 1625 w RRD=5, RC=3E, FAW&32AW=0, 555->777, OK@2000
#strap = '777000000000000022CC1C00CE595B3ED0570F1531CB2409004007000B0314207A8900A003000000170F2E36922A3217'
# custom 1750 w RRD=5, FAW&32AW=0
#strap = '777000000000000022CC1C0010625C49D0571016B50BD50900400700140514207A8900A003000000191131399D2C3617'
#laik2 + RAS2RAS 150, ACTRD=16
#strap = '777000000000000022CC1C00CE615C45C0571016B30CD50900400700140514207A8900A00300000010103139962C3617'
# Rx470 Hynix 1500
strap = '777000000000000022339D00CE516A3D9055111230CB4409004AE600740114206A8900A002003120150F292F94273116'
# H1500C
strap = '777000000000000022339D00CE515A3D9055111230CB440900400600740114206A8900A002003120100F292F94273116'
# H1625C - MISC from 1500
strap = '999000000000000022559D0010DE5B4480551312B74C450A00400600750414206A8900A00200312010112D34A42A3816'
# laik2 custom Hynix 1500
#strap = '777000000000000022339D00CE515A398055111230CB440900408400740114206A8900A002003120150F292F94273116'
#gendump(['tCKSRE:4', 'tCKSRX:4', 'tCKE_PULSE:4', 'tCKE:6', 'SEQ_IDLE:5', 'tCKE_PULSE_MSB:1', 'SEQ_IDLE_SS:8', 'SEQ_PMG_TIMING'], strap[16:24])
gendump(['tRCDW:5', 'tRCDWA:5', 'tRCDR:5', 'tRCDRA:5', 'tRRD:4', 'tRC:7', 'SEQ_RAS_TIMING'], strap[24:32])
gendump(['tNOPW:2', 'tNOPR:2', 'tR2W:5', 'tCCDL:3', 'tR2R:4', 'tW2R:8', 'tCL:8', 'SEQ_CAS_TIMING'], strap[32:40])
gendump(['tRP_WRA:7', 'tRP_RDA:7', 'tRP:6', 'tRFC:9', 'SEQ_MISC_TIMING'], strap[40:48])
gendump(['PA2RDATA:4', 'PA2WDATA:4', 'FAW:5', 'tREDC:3', 'tWEDC:5', 't32AW:7', 'tWDATATR:4', 'SEQ_MISC_TIMING2'], strap[48:56])
gendump(['RAS2RAS:8', 'RP:8', 'WRPLUSRP:8', 'BUS_TURN:8', 'ARB_DRAM_TIMING2'], strap[88:96])