"""Is the UMC SMN window really decoding, or are we reading an artifact? Tests: cross-instance variation, neighbour variation, bogus-address control, and interleaved reads (to catch a stale-latch alias).""" import sys sys.path.insert(0,"/Users/user/src/tinygrad"); sys.path.insert(0,"/Users/user/dev/amd-psp-re/psp_out") from tinygrad import Device d=Device["AMD"]; adev=d.iface.dev_impl IDX,DAT=14,15 def rd(a): adev.wreg(IDX,a&0xffffffff); return adev.rreg(DAT) print("=== 1. same offset across all 6 UMC instances (should DIFFER if decoding per-channel) ===") for inst,b in enumerate((0xc004000,0xc804000,0xd004000,0xd804000,0xe004000,0xe804000)): print(" inst%d %#011x : %s"%(inst,b," ".join("%08x"%rd(b+4*i) for i in range(6)))) print("\n=== 2. fine sweep inside instance 0 (0xc004000 + 0..0x80) ===") for off in range(0,0x84,4): v=rd(0xc004000+off) if v: print(" +%#04x = %08x"%(off,v)) print("\n=== 3. control: addresses that should NOT decode ===") for a in (0xc003000, 0xc005000, 0xc00fff0, 0x0badf000, 0xdeadf000, 0xc404000): print(" %#011x = %08x"%(a,rd(a))) print("\n=== 4. interleave test (stale-latch detector) ===") a1,a2=0xc004000,0xc004010 seq=[rd(a1),rd(a2),rd(a1),rd(0x0badf000),rd(a1),rd(a2)] print(" rd(a1),rd(a2),rd(a1),rd(bogus),rd(a1),rd(a2) = %s"%[hex(x) for x in seq]) print(" a1 stable across interleave: %s"%(seq[0]==seq[2]==seq[4])) print("\n=== 5. is 0x00016000 just an echo of something? compare to MP0 base read ===") print(" rd(0x16000) = %08x rd(0xc004000) = %08x"%(rd(0x16000), rd(0xc004000))) print("\nMEMSIZE=%s sos_alive=%s"%(hex(adev.rreg(0xde3)),adev.psp.is_sos_alive()))