ifwlev_rslt[2]>wlev_max_bad:# should be 0 - otherwise wlev did not work (CMDA?)
ifwlev_rslt[2]>wlev_max_bad:# should be 0 - otherwise wlev did not work (CMDA?)
raiseException("Write levelling gave unexpected data, aborting (may be wrong command/address delay, incorrectly initialized")
# raise Exception("Write levelling gave unexpected data, aborting (may be wrong command/address delay, incorrectly initialized")
#disabling check 04.09.2016
print("raise Exception Write levelling gave unexpected data, aborting (may be wrong command/address delay, incorrectly initialized. Phase: %d, cmda_odly_lin=%d"%(phase,cmda_odly_lin))
dqso_cache[dly]=wlev_rslt
dqso_cache[dly]=wlev_rslt
ifquiet<1:
ifquiet<1:
print('measure_dqso(%d) - new measurement'%(dly))
print('measure_dqso(%d) - new measurement'%(dly))
...
@@ -3242,13 +3244,13 @@ class X393McntrlAdjust(object):
...
@@ -3242,13 +3244,13 @@ class X393McntrlAdjust(object):
dqsi_safe_phase=dqsi_safe_phase,
dqsi_safe_phase=dqsi_safe_phase,
ra=ra,# 0,
ra=ra,# 0,
ba=ba,# 0,
ba=ba,# 0,
quiet=quiet+1,#1,
quiet=quiet,#+1, #1,
single=True)# single=False)
single=True)# single=False)
pass2=self.measure_addr_odelay(safe_phase=safe_phase,#0.25, # 0 strictly follow cmda_odelay, >0 -program with this fraction of clk period from the margin
pass2=self.measure_addr_odelay(safe_phase=safe_phase,#0.25, # 0 strictly follow cmda_odelay, >0 -program with this fraction of clk period from the margin
dqsi_safe_phase=dqsi_safe_phase,
dqsi_safe_phase=dqsi_safe_phase,
ra=ra^((1<<vrlg.ADDRESS_NUMBER)-1),# 0,
ra=ra^((1<<vrlg.ADDRESS_NUMBER)-1),# 0,
ba=ba^((1<<num_ba)-1),# 0,
ba=ba^((1<<num_ba)-1),# 0,
quiet=quiet+1,#1,
quiet=quiet,#+1, #1,
single=True)# single=False)
single=True)# single=False)
self.adjustment_state['addr_meas']=[pass1,pass2]
self.adjustment_state['addr_meas']=[pass1,pass2]
if(quiet<4):
if(quiet<4):
...
@@ -3279,6 +3281,9 @@ class X393McntrlAdjust(object):
...
@@ -3279,6 +3281,9 @@ class X393McntrlAdjust(object):
print("?",end=" ")
print("?",end=" ")
print()
print()
return[pass1,pass2]
return[pass1,pass2]
ifquiet<3:
print("Writing good data to ra=0x%x, ba = 0x%x"%(ra,ba))
#prepare and write all alternative blocks (different by one address/bank
#prepare and write all alternative blocks (different by one address/bank
self.x393_mcntrl_buffers.write_block_buf_chn(0,0,wdata32_bad,quiet)# fill block memory (channel, page, number)
self.x393_mcntrl_buffers.write_block_buf_chn(0,0,wdata32_bad,quiet)# fill block memory (channel, page, number)
raba_bits=[]
raba_bits=[]
...
@@ -3393,12 +3417,15 @@ class X393McntrlAdjust(object):
...
@@ -3393,12 +3417,15 @@ class X393McntrlAdjust(object):
foraddr_bitinrange(vrlg.ADDRESS_NUMBER):
foraddr_bitinrange(vrlg.ADDRESS_NUMBER):
raba_bits.append((addr_bit,None))
raba_bits.append((addr_bit,None))
ra_alt=ra^(1<<addr_bit)
ra_alt=ra^(1<<addr_bit)
self.x393_pio_sequences.set_write_block(ba,ra_alt,ca,nbursts+3,extraTgl,sel_wr,(0,1)[quiet<2])# set sequence to write alternative (by one address bit) block
# self.x393_pio_sequences.set_write_block(ba,ra_alt,ca,nbursts+3,extraTgl,sel_wr,(0,1)[quiet<2]) # set sequence to write alternative (by one address bit) block
self.x393_pio_sequences.set_write_block(ba,ra_alt,ca,nbursts+7,extraTgl,sel_wr,(0,1)[quiet<2])# set sequence to write alternative (by one address bit) block
self.x393_pio_sequences.write_block()#page= 0, wait_complete=1) # write alternative block
self.x393_pio_sequences.write_block()#page= 0, wait_complete=1) # write alternative block
forbank_bitinrange(num_ba):
forbank_bitinrange(num_ba):
raba_bits.append((None,bank_bit))
raba_bits.append((None,bank_bit))
ba_alt=ra^(1<<bank_bit)
# ba_alt=ra ^ (1<<bank_bit) # Bug? 04.10.2016
self.x393_pio_sequences.set_write_block(ba_alt,ra,ca,nbursts+3,extraTgl,sel_wr,(0,1)[quiet<2])# set sequence to write alternative (by one address bit) block
ba_alt=ba^(1<<bank_bit)
# self.x393_pio_sequences.set_write_block(ba_alt,ra,ca,nbursts+3,extraTgl,sel_wr,(0,1)[quiet<2]) # set sequence to write alternative (by one address bit) block
self.x393_pio_sequences.set_write_block(ba_alt,ra,ca,nbursts+7,extraTgl,sel_wr,(0,1)[quiet<2])# set sequence to write alternative (by one address bit) block
self.x393_pio_sequences.write_block()#page= 0, wait_complete=1) # write alternative block
self.x393_pio_sequences.write_block()#page= 0, wait_complete=1) # write alternative block
# For each valid phase, set valid delays, then find marginal delay for one bit (start with the longest available delay?
# For each valid phase, set valid delays, then find marginal delay for one bit (start with the longest available delay?
# if got for one bit - try other bits in vicinity
# if got for one bit - try other bits in vicinity
...
@@ -3431,14 +3458,12 @@ class X393McntrlAdjust(object):
...
@@ -3431,14 +3458,12 @@ class X393McntrlAdjust(object):
elifbuf==comp32_bad:
elifbuf==comp32_bad:
meas=False
meas=False
else:
else:
print("Inconclusive result for comparing read data for phase=%d, addr_bit=%s, bank_bit=%s dly=%d"%(phase,str(addr_bit),str(bank_bit),dly))
print("Inconclusive result for comparing read data for phase=%d, addr_bit=%s, bank_bit=%s dly=%d"%(phase,str(addr_bit),str(bank_bit),dly),end=" ")
# print ("Data read from memory=",buf, "(",convert_w32_to_mem16(buf),")")
# print ("Data read from memory=",buf, "(",convert_w32_to_mem16(buf),")")
print("Data read from memory=%s(%s)"%(self.hex_list(buf),self.hex_list(convert_w32_to_mem16(buf))))
print("Data read from memory=%s(%s)"%(self.hex_list(buf),self.hex_list(convert_w32_to_mem16(buf))))