Created
April 13, 2018 20:10
-
-
Save 9ary/37aef15af84b2af736482c3265e6aead to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
with open("spd.bin", "rb") as f: | |
spd = f.read() | |
for profile in range(2): | |
print(f"XMP profile {profile + 1}:") | |
if profile == 0: | |
mtb = int((spd[180] << 8) / spd[181]) | |
elif profile == 1: | |
mtb = int((spd[182] << 8) / spd[183]) | |
print(f"MTB: {mtb}") | |
if profile == 0: | |
xmp = spd[185:219] | |
elif profile == 1: | |
xmp = spd[220:254] | |
cas_lats = (xmp[4] << 8) | xmp[3] | |
print(bin(cas_lats)) | |
def timing(name, offset): | |
t = xmp[offset] * mtb / 256 | |
print(f"{name}: {t} {t/tCK}") | |
tCK = xmp[1] * mtb / 256 | |
print(f"tCK: {tCK}") | |
Hz = int(2000 / tCK) | |
print(f"fMin: {Hz}") | |
timing("tAA", 2) | |
timing("tWR", 8) | |
timing("tRCD", 7) | |
timing("tRRD", 17) | |
timing("tRP", 6) | |
tRAS = (((xmp[9] & 0xf) << 8) + xmp[10]) * mtb / 256 | |
print(f"tRAS: {tRAS}") | |
tRC = (((xmp[9] & 0xf0) << 4) + xmp[11]) * mtb / 256 | |
print(f"tRC: {tRC}") | |
tRFC = ((xmp[15] << 8) + xmp[14]) * mtb / 256 | |
print(f"tRFC: {tRFC}") | |
timing("tWTR", 20) | |
timing("tRTP", 16) | |
tFAW = (((xmp[18] & 0xf) << 8) + xmp[19]) * mtb / 256 | |
print(f"tFAW: {tFAW}") | |
timing("tCWL", 5) | |
timing("tCMD", 23) | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment