def get_sys_latency(nphases, cas_latency):
return math.ceil(cas_latency/nphases)
+def get_sys_phase(nphases, sys_latency, cas_latency):
+ return sys_latency*nphases - cas_latency
def get_sys_phases(nphases, sys_latency, cas_latency):
dat_phase = sys_latency*nphases - cas_latency
cl, cwl = get_cl_cw("DDR3", tck)
cl_sys_latency = get_sys_latency(nphases, cl)
cwl_sys_latency = get_sys_latency(nphases, cwl)
- rdcmdphase, rdphase = get_sys_phases(nphases, cl_sys_latency, cl)
- wrcmdphase, wrphase = get_sys_phases(nphases, cwl_sys_latency, cwl)
+ rdphase = get_sys_phase(nphases, cl_sys_latency, cl)
+ wrphase = get_sys_phase(nphases, cwl_sys_latency, cwl)
self.settings = PhySettings(
phytype="ECP5DDRPHY",
memtype="DDR3",
nphases=nphases,
rdphase=rdphase,
wrphase=wrphase,
- rdcmdphase=rdcmdphase,
- wrcmdphase=wrcmdphase,
+ rdcmdphase = (rdphase - 1)%nphases,
+ wrcmdphase = (wrphase - 1)%nphases,
cl=cl,
cwl=cwl,
- read_latency=2 + cl_sys_latency + 2 + log2_int(4//nphases) + 4,
+ read_latency = cl_sys_latency + 10,
write_latency=cwl_sys_latency
)