Commit 9b43bdd6 authored by Andrey Filippov's avatar Andrey Filippov

Cleaning up the code, adding provisions for multiple solutions for the same...

Cleaning up the code, adding provisions for multiple solutions for the same phase - this will be the case at higher clock frequencies
parent 58881762
......@@ -892,6 +892,59 @@ def get_adjust_cmda_odelay():
'cmda_odly_a':-1.40105743313
}
def get_wlev_dqs_delays(variant=0):
if variant ==0: # large step
return [[(130, None), (125, None)], [(133, 0.09375), (129, -0.75)], [(130, 0.5625), (128, -0.0625)], [(125, None), (125, 0.5)], [(129, -0.28125), (120, None)],
[(126, 0.375), (124, 0.3125)], [(125, 0.875), (121, 0.4375)], [(124, -0.8125), (115, None)], [(123, 0.375), (119, -0.96875)], [(120, 0.125), (119, 0.25)],
[(115, None), (115, 0.0)], [(119, 0.21875), (114, -0.96875)], [(115, -0.1875), (114, -0.5625)], [(115, 0.9375), (113, -0.03125)], [(114, -0.875), (105, None)],
[(112, 0.5625), (109, -0.84375)], [(110, 0.875), (107, 0.0)], [(109, -0.96875), (105, 0.8125)], [(107, 0.0), (104, -0.96875)], [(105, 0.625), (103, -0.5)],
[(100, None), (100, -0.3125)], [(102, -0.15625), (95, None)], [(100, 0.625), (99, 0.0625)], [(95, None), (96, 0.25)], [(99, -0.1875), (90, None)],
[(96, 0.5), (94, -0.90625)], [(95, 0.84375), (92, -0.0625)], [(90, None), (90, -0.125)], [(93, 0.375), (85, None)], [(90, 0.5), (89, -0.5)],
[(85, None), (86, 0.09375)], [(88, -0.3125), (80, None)], [(85, 0.5), (84, -0.78125)], [(80, None), (81, -0.09375)], [(84, -0.875), (80, 0.53125)],
[(80, 0.78125), (79, -0.1875)], [(75, None), (78, -0.1875)], [(75, None), (75, 0.0)], [(77, -0.46875), (70, None)], [(75, 0.75), (74, -0.28125)],
[(70, None), (70, -0.53125)], [(74, -0.6875), (70, 0.9375)], [(73, -0.25), (65, None)], [(70, 0.5), (69, -0.8125)], [(65, None), (68, 0.21875)],
[(69, -0.625), (65, 0.90625)], [(65, 0.0625), (60, None)], [(60, None), (61, 0.09375)], [(60, None), (60, 0.5)], [(55, None), (57, -0.5)],
[(55, None), (55, -0.25)], [(59, 0.28125), (50, None)], [(55, 0.125), (50, None)], [(50, None), (51, -0.28125)], [(50, None), (50, 0.84375)],
[(53, 0.25), (45, None)], [(45, None), (46, 0.0)], [(45, None), (45, 0.3125)], [(47, 0.1875), (40, None)], [(45, 0.78125), (44, -0.1875)],
[(40, None), (40, -0.1875)], [(44, 0.21875), (35, None)], [(41, 0.53125), (35, None)], [(35, None), (36, 0.375)], [(35, None), (35, 0.46875)],
[(38, 0.53125), (30, None)], [(35, 0.65625), (34, -0.96875)], [(30, None), (33, 0.03125)], [(30, None), (30, 0.4375)], [(33, 0.5), (25, None)],
[(25, None), (29, 0.125)], [(25, None), (26, 0.3125)], [(28, 0.5), (20, None)], [(25, 0.5625), (20, None)], [(20, None), (22, 0.03125)],
[(23, 0.5), (15, None)], [(20, 0.5), (15, None)], [(15, None), (17, 0.03125)], [(19, 0.5), (15, 0.0625)], [(16, 0.5), (10, None)],
[(10, None), (14, -0.96875)], [(10, None), (11, 0.03125)], [(13, 0.0625), (10, 0.5625)], [(11, 0.5), (5, None)], [(5, None), (7, -0.21875)],
[(9, -0.375), (5, 0.0)], [(6, 0.5), (0, None)], [(0, None), (2, -0.9375)], None, None, None, None, None, None, None, None, None, None, None, None,
[(150, None), (150, 0.5625)], [(153, -0.9375), (145, None)], [(151, 0.40625), (148, 0.03125)], [(145, None), (145, 0.15625)], [(145, None), (140, None)],
[(145, 0.9375), (140, 0.28125)], [(140, None), (135, None)], [(143, 0.25), (139, -0.4375)], [(140, 0.75), (136, 0.25)], [(135, None), (135, 0.9375)],
[(139, 0.75), (130, None)], [(136, 0.4375), (134, 0.53125)]]
elif variant == 1: #small step
return [[(134, -0.9375), (129, None)], [(133, 0.25), (129, -0.71875)], [(130, 0.46875), (128, 0.0)], [(129, None), (125, 0.6875)], [(129, 0.0), (124, None)],
[(125, -0.03125), (124, 0.125)], [(125, 0.84375), (121, 0.09375)], [(124, -0.53125), (119, None)], [(123, 0.3125), (119, None)], [(120, 0.46875), (119, 0.15625)],
[(119, None), (115, 0.0625)], [(119, 0.46875), (114, None)], [(115, 0.4375), (114, -0.4375)], [(115, 0.84375), (112, 0.1875)], [(114, -0.75), (109, None)],
[(112, 0.5), (109, -0.90625)], [(110, 0.84375), (107, 0.34375)], [(109, None), (105, 0.90625)], [(107, 0.28125), (104, None)], [(105, 0.65625), (103, -0.46875)],
[(104, None), (100, 0.0)], [(102, 0.5), (99, -0.96875)], [(100, 0.65625), (99, 0.09375)], [(99, None), (95, -0.65625)], [(99, 0.375), (94, None)],
[(96, 0.5), (94, -0.96875)], [(95, 0.6875), (93, -0.46875)], [(94, None), (90, -0.25)], [(92, 0.21875), (89, None)], [(90, 0.53125), (89, -0.78125)],
[(89, None), (86, 0.03125)], [(88, 0.09375), (84, None)], [(85, 0.53125), (84, -0.90625)], [(84, None), (81, -0.15625)], [(84, -0.875), (80, 0.40625)],
[(80, 0.8125), (79, -0.8125)], [(79, None), (78, 0.0625)], [(79, -0.875), (75, 0.28125)], [(77, -0.03125), (74, None)], [(75, 0.8125), (74, 0.125)],
[(74, None), (71, 0.34375)], [(74, -0.65625), (69, None)], [(73, 0.5), (69, None)], [(70, 0.21875), (69, None)], [(69, None), (67, 0.375)],
[(69, 0.15625), (65, 0.96875)], [(65, 0.0625), (64, -0.875)], [(64, None), (61, -0.0625)], [(64, None), (60, 0.46875)], [(59, None), (59, 0.5)],
[(59, None), (55, -0.0625)], [(59, 0.21875), (54, None)], [(55, 0.3125), (54, -0.9375)], [(54, None), (51, 0.125)], [(54, None), (49, None)],
[(53, 0.5), (49, None)], [(49, None), (46, -0.09375)], [(49, None), (45, 0.34375)], [(47, 0.1875), (44, None)], [(45, 0.84375), (44, -0.09375)],
[(44, None), (40, -0.375)], [(44, 0.375), (39, None)], [(41, 0.5), (39, None)], [(39, None), (36, 0.40625)], [(39, None), (35, 0.0)], [(37, 0.0), (34, None)],
[(35, 0.53125), (34, None)], [(34, None), (33, 0.0)], [(34, None), (30, 0.28125)], [(33, 0.5), (29, None)], [(30, 0.96875), (29, 0.03125)],
[(29, None), (26, 0.125)], [(28, 0.5), (24, None)], [(25, 0.71875), (24, None)], [(24, None), (22, 0.03125)], [(23, 0.53125), (20, 0.96875)],
[(20, 0.40625), (19, None)], [(19, None), (17, 0.0)], [(19, 0.125), (15, 0.15625)], [(16, 0.5), (14, None)], [(14, None), (14, -0.84375)],
[(14, None), (11, -0.09375)], [(13, 0.03125), (10, 0.78125)], [(11, 0.53125), (9, None)], [(9, None), (8, -0.28125)], [(9, -0.46875), (5, 0.03125)],
[(6, 0.5), (4, None)], [(4, None), (4, 0.125)], None, None, None, None, None, None, None, None, None, None, None, None, [(154, None), (150, 0.21875)],
[(154, -0.875), (149, None)], [(150, -0.6875), (148, -0.15625)], [(149, None), (145, 0.46875)], [(149, None), (144, None)], [(145, 0.96875), (140, 0.40625)],
[(144, None), (139, None)], [(142, -0.375), (139, -0.6875)], [(140, 0.5), (135, -0.3125)], [(139, None), (134, None)], [(139, 0.0), (134, None)],
[(135, -0.5), (134, 0.375)]]
def get_wlev_dqs_steps(variant=0):
if variant == 0:
return 1
elif variant ==1:
return 0
def get_wlev_data():
return {
'wlev_dqs_odly_b':[52.119267926792674, 49.885802580258002],
......@@ -1399,6 +1452,7 @@ def get_addr_meas():
[124, 131, 128, 127, 129, 129, 129, 124, 129, 134, 129, 129, 124, 129, 129, 124, 130, 127]] ,
]
def get_addr_odly():
print("**** OBSOLETE *****")
return {
'dlys': [[46, 49, 48, 47, 48, 49, 48, 45, 49, 50, 48, 48, 45, 48, 48, 46, 49, 48, 50, 49, 49, 48], [45, 48, 46, 45, 46, 48, 45, 44, 47, 49, 45, 46, 44, 46, 45, 45, 48, 46, 49, 48, 48, 46],
[44, 45, 44, 44, 44, 46, 44, 43, 45, 48, 44, 44, 43, 44, 44, 44, 46, 44, 48, 46, 45, 45], [43, 44, 44, 43, 44, 44, 44, 41, 44, 45, 44, 44, 41, 44, 44, 43, 44, 44, 45, 44, 44, 44],
......@@ -1508,4 +1562,141 @@ def get_cmda_parameters():
'tA': [2014.335618035371, 2022.0831903592677, 2025.482966498, 2000.1256204889644, 2017.3513081600333, 2054.856921634421, 1998.5668161398096, 1991.5152458814302, 2013.552541418718,
2035.4497883071335, 2012.5914774537146, 2013.8664966165068, 1995.7738477106127, 2021.1313354266506, 2005.8702139359314, 2014.6518090648067, 2025.5963222621444, 2025.7326063296766,
2030.5864502298764, 2024.5266464332833, 2039.6076080635871, 2018.250230021426]}
\ No newline at end of file
def get_cmda_odelay():
return {
'dlys': [{0: [46, 49, 48, 47, 48, 49, 48, 45, 48, 50, 48, 48, 45, 48, 48, 46, 49, 48, 50, 49, 49, 48]},
{0: [45, 48, 46, 45, 46, 48, 46, 44, 47, 49, 45, 46, 44, 46, 46, 45, 48, 46, 49, 48, 48, 46]},
{0: [44, 45, 44, 44, 44, 45, 44, 43, 45, 48, 44, 45, 43, 44, 44, 44, 46, 44, 48, 45, 45, 45]},
{0: [43, 44, 44, 43, 44, 44, 44, 41, 44, 45, 43, 44, 41, 44, 44, 43, 44, 44, 45, 44, 44, 44]},
{0: [40, 44, 43, 40, 43, 44, 43, 39, 43, 44, 42, 43, 39, 43, 43, 40, 44, 43, 44, 44, 43, 43]},
{0: [39, 43, 40, 39, 40, 43, 40, 39, 40, 43, 40, 40, 39, 40, 40, 39, 43, 40, 44, 42, 42, 40]},
{0: [39, 40, 39, 39, 39, 40, 39, 38, 39, 42, 39, 39, 38, 39, 39, 39, 40, 39, 42, 40, 40, 39]},
{0: [37, 39, 38, 37, 38, 39, 38, 35, 38, 40, 38, 38, 35, 38, 38, 38, 39, 38, 40, 39, 39, 38]},
{0: [35, 38, 37, 35, 37, 38, 36, 34, 37, 39, 36, 37, 34, 37, 36, 35, 38, 37, 39, 38, 38, 37]},
{0: [34, 36, 35, 34, 35, 37, 35, 33, 35, 38, 34, 35, 33, 35, 34, 34, 36, 35, 38, 35, 35, 35]},
{0: [33, 34, 34, 33, 34, 35, 34, 32, 34, 35, 34, 34, 32, 34, 34, 33, 34, 34, 35, 34, 34, 34]},
{0: [32, 34, 33, 31, 33, 34, 33, 30, 33, 34, 33, 33, 30, 33, 33, 32, 34, 33, 34, 34, 34, 33]},
{0: [30, 33, 31, 30, 30, 33, 30, 29, 30, 33, 30, 31, 29, 31, 30, 30, 33, 30, 33, 32, 33, 30]},
{0: [29, 30, 29, 29, 29, 30, 29, 28, 29, 32, 29, 29, 28, 29, 29, 29, 30, 29, 32, 30, 30, 29]},
{0: [28, 29, 29, 28, 29, 29, 28, 26, 29, 30, 28, 29, 26, 29, 28, 28, 29, 29, 30, 29, 29, 29]},
{0: [25, 28, 28, 25, 27, 29, 27, 24, 27, 29, 27, 28, 25, 28, 27, 26, 28, 28, 29, 28, 28, 28]},
{0: [24, 26, 25, 24, 25, 28, 25, 24, 25, 28, 25, 25, 24, 25, 25, 24, 26, 25, 28, 26, 26, 25]},
{0: [24, 25, 24, 23, 24, 25, 24, 23, 24, 25, 24, 24, 23, 24, 24, 24, 25, 24, 25, 24, 25, 24]},
{0: [23, 24, 23, 22, 23, 24, 23, 20, 23, 24, 23, 23, 20, 23, 23, 23, 24, 23, 24, 24, 24, 23]},
{0: [20, 23, 22, 20, 21, 23, 20, 19, 21, 23, 20, 21, 19, 22, 20, 20, 23, 22, 23, 23, 23, 21]},
{0: [19, 20, 20, 19, 19, 22, 19, 18, 19, 22, 19, 20, 19, 20, 19, 19, 20, 20, 22, 20, 20, 20]},
{0: [18, 19, 19, 18, 19, 20, 18, 17, 19, 20, 18, 19, 17, 19, 19, 18, 19, 19, 20, 19, 19, 19]},
{0: [17, 18, 18, 16, 18, 19, 17, 15, 18, 19, 17, 18, 15, 18, 17, 17, 18, 18, 19, 18, 19, 18]},
{0: [15, 17, 16, 14, 15, 18, 15, 14, 15, 18, 15, 15, 14, 15, 15, 15, 17, 15, 18, 16, 17, 15]},
{0: [14, 15, 14, 14, 14, 16, 14, 13, 14, 15, 14, 14, 13, 14, 14, 14, 15, 14, 15, 14, 15, 14]},
{0: [13, 14, 14, 13, 13, 14, 13, 11, 13, 14, 13, 13, 11, 14, 13, 13, 14, 14, 14, 14, 14, 13]},
{0: [11, 13, 13, 10, 12, 14, 10, 9, 11, 13, 11, 12, 10, 12, 11, 11, 13, 12, 13, 13, 13, 12]},
{0: [9, 10, 10, 9, 10, 13, 9, 9, 9, 12, 9, 10, 9, 10, 9, 10, 10, 10, 11, 10, 11, 10]},
{0: [9, 9, 9, 8, 9, 10, 9, 8, 9, 10, 9, 9, 8, 9, 9, 9, 9, 9, 10, 9, 10, 9], -1: [159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159]},
{0: [8, 8, 8, 7, 8, 9, 7, 5, 8, 9, 8, 8, 5, 8, 8, 8, 9, 8, 9, 8, 9, 8], -1: [159, 159, 159, 159, 159, 159, 159, 158, 159, 159, 159, 159, 158, 159, 159, 159, 159, 159, 159, 159, 159, 159]},
{0: [5, 7, 7, 5, 5, 8, 5, 4, 5, 8, 5, 6, 4, 6, 5, 5, 7, 6, 8, 6, 8, 6], -1: [158, 159, 159, 159, 159, 159, 159, 157, 159, 159, 159, 159, 156, 159, 159, 158, 159, 159, 159, 159, 159, 159]},
{0: [4, 5, 5, 4, 4, 7, 4, 3, 4, 5, 4, 4, 4, 5, 4, 4, 5, 5, 5, 5, 5, 4], -1: [155, 159, 159, 158, 159, 159, 159, 155, 159, 159, 159, 159, 154, 159, 159, 155, 159, 159, 159, 159, 159, 159]},
{0: [3, 4, 4, 3, 4, 5, 3, 2, 3, 4, 3, 4, 3, 4, 3, 4, 4, 4, 4, 4, 4, 4], -1: [154, 159, 158, 157, 159, 158, 159, 154, 159, 159, 159, 159, 154, 158, 159, 154, 159, 158, 159, 159, 158, 159]},
{0: [2, 3, 3, 1, 3, 4, 1, 0, 1, 4, 2, 3, 0, 3, 1, 2, 3, 3, 3, 3, 4, 3], -1: [153, 159, 155, 155, 158, 155, 159, 153, 159, 159, 157, 158, 153, 157, 158, 153, 159, 155, 159, 159, 157, 158]},
{0: [0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0], -1: [152, 159, 154, 154, 155, 154, 158, 151, 159, 159, 155, 156, 150, 155, 157, 152, 159, 154, 159, 159, 155, 155]},
{0: [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], -1: [150, 158, 153, 153, 154, 154, 155, 149, 157, 159, 154, 154, 149, 154, 155, 150, 158, 153, 159, 158, 154, 154]},
{0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], -1: [149, 155, 152, 150, 153, 152, 154, 149, 155, 158, 153, 154, 148, 153, 154, 149, 155, 152, 159, 155, 153, 153]},
{0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], -1: [148, 154, 150, 149, 151, 150, 154, 148, 154, 156, 151, 153, 147, 150, 153, 148, 154, 150, 159, 154, 151, 152]},
{0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], -1: [146, 154, 149, 149, 150, 149, 152, 145, 153, 154, 149, 150, 145, 149, 150, 146, 154, 149, 158, 154, 149, 150]},
{0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], -1: [145, 152, 148, 147, 149, 148, 150, 144, 151, 154, 149, 149, 144, 149, 149, 145, 152, 148, 155, 152, 149, 149]},
{0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], -1: [144, 150, 146, 145, 148, 146, 149, 143, 149, 153, 148, 148, 143, 148, 149, 144, 150, 146, 154, 150, 148, 148]},
{0: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], -1: [143, 149, 144, 144, 145, 145, 148, 142, 149, 150, 145, 146, 141, 145, 147, 143, 149, 144, 153, 149, 145, 145]},
{-1: [140, 148, 144, 143, 144, 144, 146, 140, 148, 149, 144, 145, 140, 144, 145, 140, 148, 144, 151, 148, 144, 144]},
{-1: [139, 146, 143, 141, 143, 143, 144, 139, 145, 148, 143, 144, 139, 143, 144, 139, 145, 143, 149, 146, 143, 144]},
{-1: [139, 144, 140, 140, 142, 140, 144, 138, 144, 146, 142, 143, 138, 141, 143, 139, 144, 140, 149, 144, 142, 143]},
{-1: [137, 144, 139, 139, 140, 139, 143, 136, 143, 145, 140, 140, 135, 140, 141, 137, 144, 139, 148, 144, 140, 140]},
{-1: [135, 143, 138, 138, 139, 139, 140, 134, 141, 144, 139, 139, 134, 139, 139, 135, 143, 138, 145, 143, 139, 139]},
{-1: [134, 140, 137, 135, 138, 138, 139, 134, 139, 143, 138, 138, 134, 138, 139, 134, 140, 137, 144, 140, 138, 138]},
{-1: [133, 139, 135, 134, 136, 135, 138, 133, 139, 140, 135, 137, 132, 135, 138, 133, 139, 135, 143, 139, 136, 136]},
{-1: [132, 138, 134, 133, 134, 134, 136, 130, 138, 139, 134, 135, 130, 134, 135, 132, 138, 134, 141, 138, 134, 135]},
{-1: [130, 136, 133, 132, 134, 133, 135, 129, 135, 138, 134, 134, 129, 134, 134, 130, 136, 133, 139, 136, 134, 134]},
{-1: [129, 134, 131, 130, 133, 132, 134, 128, 134, 137, 133, 133, 128, 132, 133, 129, 134, 131, 139, 134, 133, 133]},
{-1: [128, 134, 129, 129, 130, 130, 133, 127, 133, 135, 130, 131, 126, 130, 131, 128, 134, 129, 138, 134, 130, 130]},
{-1: [125, 133, 129, 128, 129, 129, 130, 125, 131, 134, 129, 129, 125, 129, 130, 125, 133, 129, 135, 133, 129, 129]},
{-1: [124, 130, 128, 126, 128, 128, 129, 124, 130, 133, 128, 129, 124, 128, 129, 124, 130, 128, 134, 130, 128, 128]},
{-1: [124, 129, 125, 124, 127, 125, 128, 123, 129, 130, 126, 128, 123, 126, 128, 124, 129, 125, 133, 129, 127, 127]},
{-1: [123, 128, 124, 124, 125, 124, 127, 121, 128, 129, 125, 125, 120, 124, 125, 123, 128, 124, 131, 128, 125, 125]},
{-1: [120, 126, 123, 123, 124, 124, 125, 119, 125, 128, 124, 124, 119, 124, 124, 120, 126, 123, 129, 126, 124, 124]},
{-1: [119, 125, 122, 120, 123, 123, 124, 119, 124, 127, 123, 123, 119, 123, 123, 119, 125, 122, 129, 125, 123, 123]},
{-1: [118, 124, 120, 119, 120, 120, 123, 118, 123, 125, 120, 121, 118, 120, 122, 118, 124, 120, 127, 124, 120, 121]},
{-1: [117, 123, 119, 118, 119, 119, 120, 115, 122, 124, 119, 120, 115, 119, 120, 117, 123, 119, 125, 123, 119, 119]},
{-1: [115, 120, 118, 117, 119, 118, 119, 114, 120, 123, 118, 119, 114, 118, 119, 115, 120, 118, 124, 120, 119, 119]},
{-1: [114, 119, 115, 115, 117, 117, 118, 113, 119, 120, 117, 118, 113, 117, 118, 114, 119, 115, 123, 119, 118, 118]},
{-1: [113, 118, 114, 114, 115, 115, 117, 112, 118, 119, 115, 115, 112, 115, 115, 113, 118, 114, 120, 118, 115, 115]},
{-1: [111, 117, 114, 113, 114, 114, 115, 110, 115, 118, 114, 114, 110, 114, 114, 111, 117, 114, 119, 117, 114, 114]},
{-1: [109, 115, 113, 111, 113, 113, 114, 109, 114, 117, 113, 113, 109, 113, 114, 109, 115, 113, 119, 115, 113, 113]},
{-1: [109, 114, 110, 109, 111, 111, 113, 108, 113, 115, 110, 112, 108, 110, 112, 109, 114, 110, 117, 114, 112, 111]},
{-1: [108, 113, 109, 109, 109, 109, 110, 106, 112, 114, 109, 110, 106, 109, 110, 108, 113, 109, 115, 113, 110, 110]},
{-1: [105, 110, 108, 108, 109, 109, 109, 105, 110, 113, 109, 109, 104, 109, 109, 105, 110, 108, 114, 110, 109, 109]},
{-1: [104, 109, 107, 105, 108, 108, 109, 104, 109, 110, 108, 108, 104, 108, 108, 104, 109, 107, 113, 109, 108, 108]},
{-1: [103, 108, 105, 104, 105, 105, 107, 103, 108, 109, 105, 106, 103, 105, 106, 103, 108, 105, 110, 108, 105, 105]},
{-1: [102, 107, 104, 103, 104, 104, 105, 100, 105, 109, 104, 104, 100, 104, 104, 102, 107, 104, 109, 107, 104, 104]},
{-1: [100, 105, 103, 102, 103, 103, 104, 99, 104, 107, 103, 104, 99, 103, 104, 100, 105, 103, 108, 105, 104, 104]},
{-1: [99, 104, 100, 100, 102, 102, 103, 99, 104, 105, 101, 103, 98, 101, 103, 99, 104, 100, 107, 104, 102, 102]},
{-1: [98, 103, 99, 99, 100, 100, 101, 97, 102, 104, 100, 100, 97, 100, 100, 98, 103, 99, 105, 103, 100, 100]},
{-1: [96, 100, 99, 98, 99, 99, 99, 95, 100, 103, 99, 99, 95, 99, 99, 96, 100, 99, 104, 100, 99, 99]},
{-1: [95, 99, 98, 95, 98, 98, 99, 94, 99, 100, 98, 98, 94, 98, 98, 95, 99, 97, 103, 99, 98, 98]},
{-1: [94, 99, 95, 94, 95, 96, 98, 93, 98, 99, 95, 96, 93, 95, 97, 94, 99, 95, 100, 99, 96, 96]},
{-1: [93, 97, 94, 94, 94, 94, 95, 91, 95, 99, 94, 95, 91, 94, 95, 93, 97, 94, 99, 97, 95, 94]},
{-1: [90, 95, 93, 92, 94, 94, 94, 90, 94, 97, 93, 94, 89, 94, 94, 90, 95, 93, 98, 95, 94, 94]},
{-1: [89, 94, 91, 90, 93, 93, 93, 89, 94, 95, 92, 93, 89, 92, 93, 89, 94, 91, 97, 94, 93, 93]},
{-1: [89, 93, 90, 89, 90, 90, 91, 88, 92, 94, 90, 90, 88, 90, 90, 89, 93, 90, 95, 93, 90, 90]},
{-1: [87, 91, 89, 88, 89, 89, 89, 85, 90, 93, 89, 89, 85, 89, 89, 88, 91, 89, 94, 91, 89, 89]},
{-1: [85, 89, 88, 86, 88, 88, 89, 84, 89, 90, 88, 88, 84, 88, 88, 85, 89, 88, 93, 89, 89, 88]},
{-1: [84, 89, 85, 85, 86, 87, 88, 84, 88, 89, 86, 87, 83, 86, 87, 84, 89, 85, 90, 89, 87, 87]},
{-1: [83, 88, 84, 84, 85, 85, 85, 82, 86, 89, 84, 85, 82, 84, 85, 83, 88, 84, 89, 88, 85, 85]},
{-1: [82, 85, 84, 83, 84, 84, 84, 80, 84, 87, 84, 84, 80, 84, 84, 82, 85, 84, 88, 85, 84, 84]},
{-1: [80, 84, 82, 80, 83, 83, 83, 79, 84, 85, 83, 83, 79, 83, 83, 80, 84, 82, 86, 84, 83, 83]},
{-1: [79, 83, 80, 79, 80, 81, 82, 78, 83, 84, 80, 81, 78, 80, 80, 79, 83, 80, 85, 83, 81, 80]},
{-1: [78, 81, 79, 78, 79, 79, 80, 76, 80, 83, 79, 79, 76, 79, 79, 78, 81, 79, 84, 81, 80, 79]},
{-1: [75, 79, 78, 77, 78, 79, 79, 75, 79, 81, 78, 79, 75, 78, 79, 76, 79, 78, 83, 79, 79, 79]},
{-1: [74, 79, 76, 75, 77, 78, 78, 74, 78, 79, 76, 78, 74, 77, 78, 74, 79, 76, 80, 79, 78, 77]},
{-1: [74, 78, 75, 74, 75, 75, 75, 73, 76, 79, 75, 75, 73, 75, 75, 74, 78, 75, 79, 78, 75, 75]},
{-1: [73, 75, 74, 73, 74, 74, 74, 70, 74, 78, 74, 74, 70, 74, 74, 73, 75, 74, 78, 75, 74, 74]},
{-1: [70, 74, 73, 71, 73, 73, 73, 69, 74, 75, 73, 73, 69, 73, 73, 70, 74, 73, 76, 74, 73, 73]},
{-1: [69, 73, 70, 69, 71, 72, 72, 69, 73, 74, 70, 71, 69, 71, 71, 69, 73, 70, 74, 73, 72, 71]},
{-1: [68, 72, 69, 69, 69, 70, 70, 68, 70, 73, 69, 70, 68, 69, 69, 68, 72, 69, 74, 71, 70, 69]},
{-1: [67, 70, 69, 68, 69, 69, 69, 65, 69, 71, 68, 69, 65, 69, 69, 67, 70, 68, 73, 70, 69, 69]},
{-1: [65, 69, 67, 65, 68, 68, 68, 64, 68, 69, 67, 68, 64, 68, 68, 65, 69, 67, 70, 69, 68, 68]},
{-1: [64, 68, 65, 64, 65, 66, 65, 63, 66, 69, 65, 65, 63, 65, 65, 64, 68, 65, 69, 68, 66, 65]},
{-1: [63, 65, 64, 63, 64, 65, 64, 62, 65, 68, 64, 64, 62, 64, 64, 63, 65, 64, 68, 65, 64, 64]},
{-1: [61, 64, 63, 62, 63, 64, 64, 60, 64, 65, 63, 63, 60, 63, 63, 61, 64, 63, 66, 64, 64, 63]},
{-1: [59, 63, 61, 60, 61, 63, 62, 59, 63, 64, 61, 62, 59, 62, 62, 59, 63, 61, 64, 63, 63, 62]},
{-1: [59, 62, 60, 59, 60, 60, 60, 58, 60, 63, 59, 60, 58, 60, 60, 59, 62, 59, 64, 62, 60, 60]},
{-1: [58, 60, 59, 58, 59, 59, 59, 55, 59, 61, 59, 59, 55, 59, 59, 58, 60, 59, 63, 60, 59, 59]},
{-1: [55, 59, 58, 56, 58, 59, 58, 54, 58, 59, 58, 58, 54, 58, 58, 55, 59, 58, 60, 59, 58, 58]},
{-1: [54, 58, 55, 54, 55, 57, 55, 54, 57, 59, 55, 56, 54, 55, 55, 54, 58, 55, 59, 58, 57, 55]},
{-1: [53, 55, 54, 54, 54, 55, 54, 53, 55, 58, 54, 54, 53, 54, 54, 54, 55, 54, 58, 55, 55, 54]},
{-1: [52, 54, 53, 53, 54, 54, 54, 50, 54, 55, 53, 54, 50, 54, 53, 52, 54, 53, 56, 54, 54, 54]},
{-1: [50, 54, 52, 50, 52, 53, 53, 49, 53, 54, 51, 53, 49, 52, 52, 50, 54, 52, 54, 53, 53, 52]},
{-1: [49, 52, 50, 49, 50, 51, 50, 48, 50, 53, 50, 50, 48, 50, 50, 49, 52, 50, 54, 52, 51, 50]},
{-1: [48, 50, 49, 48, 49, 50, 49, 47, 49, 51, 49, 49, 47, 49, 49, 48, 50, 49, 52, 50, 49, 49]}] ,
'err': [{0: 13.81671034754726}, {0: 13.771469038723755}, {0: 14.340527380809972}, {0: 14.164584645161225}, {0: 14.179870115556541}, {0: 13.432773521664858},
{0: 13.3566833724952}, {0: 14.390664706793272}, {0: 9.709949257904468}, {0: 14.378331292519688}, {0: 13.581005590479135}, {0: 12.284361804967448},
{0: 13.744883867172295}, {0: 13.069265521537245}, {0: 12.948095405025088}, {0: 14.02335676260822}, {0: 12.788901745548783}, {0: 14.356338229244015},
{0: 12.479472180202405}, {0: 13.05966158965421}, {0: 14.447252771454869}, {0: 14.616176623323012}, {0: 13.284252179533341}, {0: 13.320428707512901},
{0: 13.828083387638953}, {0: 13.961453041428879}, {0: 14.434483095270862}, {0: 14.155562014516082}, {0: 13.621773270398254, -1: 193.69710272527527},
{0: 14.135410406801002, -1: 171.37567415384638}, {0: 11.944276842146932, -1: 149.05424558241793}, {0: 14.670265752668596, -1: 126.73281701098949},
{0: 14.235541468098885, -1: 104.41138843956105}, {0: 14.675487230752724, -1: 82.08995986813261}, {0: 29.055624070515652, -1: 59.76853129670371},
{0: 51.37705264194409, -1: 37.44710272527527}, {0: 73.69848121337276, -1: 15.125674153846376}, {0: 96.01990978480143, -1: 12.325458563410393},
{0: 118.34133835622987, -1: 14.236786310874777}, {0: 140.6627669276583, -1: 14.207693683545585}, {0: 162.98419549908698, -1: 13.65984427239664},
{0: 185.30562407051565, -1: 13.560536133667483}, {-1: 14.297620103659483}, {-1: 13.829412301415232}, {-1: 13.710533168281472}, {-1: 13.286347636302253},
{-1: 12.821762281056635}, {-1: 14.004133136291784}, {-1: 9.404038490873972}, {-1: 14.596070048842194}, {-1: 14.546608275830295}, {-1: 13.403412231999482},
{-1: 12.216694920653026}, {-1: 13.382714580810898}, {-1: 13.948656237887462}, {-1: 13.560160527110838}, {-1: 14.296751164508805}, {-1: 13.862925497698143},
{-1: 13.63882881579002}, {-1: 11.889989628702551}, {-1: 13.219880835126332}, {-1: 13.970514707628354}, {-1: 14.09870815509612}, {-1: 11.864068831077475},
{-1: 13.590024300898676}, {-1: 13.75198732304716}, {-1: 12.797367218788622}, {-1: 13.42483346885092}, {-1: 14.382045933133213}, {-1: 13.199714247831253},
{-1: 14.375940766531585}, {-1: 14.219509535919315}, {-1: 14.55629922099888}, {-1: 14.488771143817758}, {-1: 13.845159186347246}, {-1: 12.792416076802965},
{-1: 13.931039565706214}, {-1: 13.444451538081921}, {-1: 13.249330703433316}, {-1: 14.24759723939951}, {-1: 12.788236240655351}, {-1: 13.516253899478215},
{-1: 13.693473701950552}, {-1: 14.232298130985328}, {-1: 14.83706677922919}, {-1: 14.079110967730685}, {-1: 14.136257289816967}, {-1: 11.651025550468603},
{-1: 13.429311988168593}, {-1: 14.569819221850139}, {-1: 14.363411528439883}, {-1: 11.942874143262088}, {-1: 14.445342077758596}, {-1: 12.934262137098358},
{-1: 14.543709933431273}, {-1: 13.440294617312247}, {-1: 13.65979569157389}, {-1: 14.14668606893565}, {-1: 12.577856540548964}, {-1: 10.30006550464168},
{-1: 14.055893653045587}, {-1: 14.073969932251202}, {-1: 14.428825281091122}, {-1: 14.187880101861538}, {-1: 12.25117775834633}, {-1: 13.974271255088752},
{-1: 11.378383135418517}, {-1: 14.504429101537426}, {-1: 14.472180131938785}, {-1: 14.274908290143685}, {-1: 12.941975230024127}, {-1: 12.806753039948944}]
}
\ No newline at end of file
......@@ -29,6 +29,7 @@ __maintainer__ = "Andrey Filippov"
__email__ = "andrey@elphel.com"
__status__ = "Development"
DEFAULTS={}
dqs_dqm_patt=None
def init_vars(d):
global DEFAULTS
if d:
......
......@@ -1625,17 +1625,44 @@ class X393LMA(object):
s=if-ir+of-or
d=ir-if+of-or
"""
def lma_fit_dqsi_phase(self,
def lma_fit_dqs_phase(self,
lane, # byte lane
bin_size_ps,
clk_period,
dqsi_dqi_parameters,
dqs_dq_parameters,
tSDQS, # use if dqs_dq_parameters are not available
data_set,
compare_prim_steps,
scale_w,
numPhaseSteps,
numPhaseSteps,
maxDlyErr=200.0, # ps - trying multiple overlapping branches
fallingPhase=False, # output mode - delays decrease when phase increases
shiftFracPeriod=0.5, # measured data is marginal, shift optimal by half period
quiet=1):
# print("++++++lma_fit_dqsi_phase(), quiet=",quiet)
"""
Calculate linear approximation for DQS-in or DQS-out vs. phase, crossing periods
@param lane byte lane to use (0,1 or 'all')
@param bin_size_ps histogram bin size in ps
@param clk_period clock period, in ps
@param dqs_dq_parameters dq{i,0} vs dqs[i,o} parameters or Null if not yet available (after write levelling)
used to get initial delay scale and fine delay correction
@param tSDQS delay in ps for one finedelay step - used only if dqs_dq_parameters are not available
@param data_set data set number for hard-coded debug data or -1 to use actual just measured results
@param compare_prim_steps if True input data was calibrated with primary delay steps, False - if with fine delay
That means that delay data is on average is either 2.5 or 0.5 lower than unbiased average
@param scale_w weight for samples that have "binary" data with full uncertainty of +/-2.5 or +/-0.5 steps
@param numPhaseSteps Total number of delay steps (currently 5*32 = 160)
@param maxDlyErr Made for testing multiple overlapping branches, maximal error in ps to keep the result branch
@param fallingPhase input data is decreasing with phase increasing (command/addresses, data output), False - increasing
as for DQS in /DQ in
@param shiftFracPeriod When measured data is marginal, not optimal, result needs to be shifted by this fraction of the period
Currently it should be 0.5 for input, 0.0 - for output
@param quiet=1):
"""
# print("++++++lma_fit_dqs_phase(), quiet=",quiet)
phase_sign=(1,-1)[fallingPhase]
phase_add=(0,numPhaseSteps)[fallingPhase]
def show_input_data(filtered):
print(('unfiltered','filtered')[filtered])
for phase,d in enumerate(data_set):
......@@ -1648,7 +1675,7 @@ class X393LMA(object):
dly+=halfStep
# print ("%f %f"%(dly, dly-phase*phase_step/dbg_tSDQS[lane]), end=" ")
# print ("%f %f"%(dly*dbg_tSDQS[lane]/phase_step, dly*dbg_tSDQS[lane]/phase_step-phase), end=" ")
print ("%f %f"%(dly*dbg_tSDQS[lane], dly*dbg_tSDQS[lane]-phase*phase_step), end=" ")
print ("%f %f"%(dly*dbg_tSDQS[lane], dly*dbg_tSDQS[lane]+(phase_add-phase)*phase_step), end=" ")
else:
print ("? ?", end=" ")
print()
......@@ -1660,7 +1687,7 @@ class X393LMA(object):
dly = dl[0]
if dl[1] is None:
dly+=halfStep
diff_ps=dly*tSDQS-phase*phase_step
diff_ps=dly*tSDQS+(phase_add-phase)*phase_step
binArr[int((diff_ps-minVal)/bin_size_ps)]+=1
if quiet < 3:
for i,h in enumerate(binArr):
......@@ -1683,27 +1710,45 @@ class X393LMA(object):
return minVal+bin_size_ps*(SX+0.5) # ps
if not isinstance(lane,(int, long)): # ignore content, process both lanes
rslt_names=("dqsi_optimal_ps","dqsi_phase")
rslt_names=("dqs_optimal_ps","dqs_phase","dqs_phase_multi","dqs_phase_err","dqs_min_max_periods")
rslt= {}
for name in rslt_names:
rslt[name] = []
for lane in range(2):
rslt_lane=self.lma_fit_dqsi_phase(lane, # byte lane
bin_size_ps,
clk_period,
dqsi_dqi_parameters,
data_set,
compare_prim_steps,
scale_w,
numPhaseSteps,
quiet)
rslt_lane=self.lma_fit_dqs_phase(lane= lane, # byte lane
bin_size_ps= bin_size_ps,
clk_period= clk_period,
dqs_dq_parameters= dqs_dq_parameters,
tSDQS= tSDQS,
data_set= data_set,
compare_prim_steps= compare_prim_steps,
scale_w= scale_w,
numPhaseSteps= numPhaseSteps,
maxDlyErr= maxDlyErr,
fallingPhase= fallingPhase,
shiftFracPeriod= shiftFracPeriod,
quiet= quiet)
for name in rslt_names:
rslt[name].append(rslt_lane[name])
if quiet<3:
print ('dqsi_optimal_ps=%s'%(str(rslt['dqsi_optimal_ps'])))
print ('dqsi_phase=[')
for lane in rslt['dqsi_phase']:
print ('dqs_optimal_ps=%s'%(str(rslt['dqs_optimal_ps'])))
print ('dqs_phase=[')
for lane in rslt['dqs_phase']:
print(" [",end=" ")
for i,d in enumerate(lane):
last= i == (len(lane)-1)
print("%s"%(str(d)), end=" ")
if not last:
print(",",end=" ")
if ((i+1) % 16) ==0:
print("\n ",end="")
else:
print('],')
print(']')
print ('dqs_phase_multi=[')
for lane in rslt['dqs_phase_multi']:
print(" [",end=" ")
for i,d in enumerate(lane):
last= i == (len(lane)-1)
......@@ -1715,24 +1760,54 @@ class X393LMA(object):
else:
print('],')
print(']')
# print(rslt)
print ('dqs_phase_err=[')
for lane in rslt['dqs_phase_err']:
print(" [",end=" ")
for i,d in enumerate(lane):
last= i == (len(lane)-1)
print("%s"%(str(d)), end=" ")
if not last:
print(",",end=" ")
if ((i+1) % 16) ==0:
print("\n ",end="")
else:
print('],')
print(']')
# print(rslt)
return rslt
phase_step= clk_period/ numPhaseSteps
tSDQS=dqsi_dqi_parameters[lane]['tSDQS'] # ~16.081739769147354
dbg_tSDQS=(dqsi_dqi_parameters[0]['tSDQS'],dqsi_dqi_parameters[1]['tSDQS'])
phase_step= phase_sign*clk_period/ numPhaseSteps
try:
tSDQS=dqs_dq_parameters[lane]['tSDQS'] # ~16.081739769147354
except:
if quiet < 2:
print("dqs_dq_parameters are not available, using datasheet value for tSDQS=%f ps"%(tSDQS))
try:
dbg_tSDQS=(dqs_dq_parameters[0]['tSDQS'],dqs_dq_parameters[1]['tSDQS'])
except:
dbg_tSDQS=(tSDQS,tSDQS)
halfStep=0.5*(1,compare_prim_steps)[compare_prim_steps]
#phase_step/tSDQS
# print("lma_fit_dqsi_phase(): quiet=",quiet)
# print("lma_fit_dqs_phase(): quiet=",quiet)
if quiet < 2:
print (phase_step,dbg_tSDQS)
for filtered in range(2):
show_input_data(filtered)
# all preliminary teset above
maxVal= DLY_STEPS*tSDQS
minVal= -clk_period
# all preliminary tests above
#phase_add
if fallingPhase:
maxVal= clk_period
minVal= -DLY_STEPS*abs(tSDQS)
else:
maxVal= DLY_STEPS*abs(tSDQS)
minVal= -clk_period
num_bins=int((maxVal-minVal)/bin_size_ps)+1
binArr=[0]*num_bins
if quiet < 2:
......@@ -1751,13 +1826,16 @@ class X393LMA(object):
dly = dl[0]
if dl[1] is None:
dly+=halfStep
periods[phase]=int(round((dly*tSDQS-phase*phase_step)/clk_period))
periods[phase]=int(round((dly*tSDQS+(phase_add-phase)*phase_step)/clk_period)) #############################
w=[0.0]*len(data_set)
if quiet < 2:
for i,p in enumerate(periods):
print ("%d %s"%(i,str(p)))
tFDQS=dqsi_dqi_parameters[lane]['tFDQS'] # [-21.824409224001187, -10.830180678770162, 1.5698858542328959, 11.267851084349177]
tFDQS.append(-tFDQS[0]-tFDQS[1]-tFDQS[2]-tFDQS[3])
try:
tFDQS=dqs_dq_parameters[lane]['tFDQS'] # [-21.824409224001187, -10.830180678770162, 1.5698858542328959, 11.267851084349177]
tFDQS.append(-tFDQS[0]-tFDQS[1]-tFDQS[2]-tFDQS[3])
except:
tFDQS=[0.0]*FINE_STEPS
SY=0.0
S0=0.0
for phase,d in enumerate(data_set):
......@@ -1769,8 +1847,8 @@ class X393LMA(object):
if dl[1] is None:
dly+=halfStep
w[phase]=scale_w
d=dly*tSDQS-periods[phase]*clk_period-tFDQS[dl[0] % FINE_STEPS]
y=d-phase*phase_step
d=dly*tSDQS-periods[phase]*clk_period-tFDQS[dl[0] % FINE_STEPS] ############################
y=d+(phase_add-phase)*phase_step
S0+=w[phase]
SY+=w[phase]*y
if S0 > 0.0:
......@@ -1786,7 +1864,7 @@ class X393LMA(object):
dly = dl[0]
if dl[1] is None:
dly+=halfStep
d=dly*tSDQS-periods[phase]*clk_period-tFDQS[dl[0] % FINE_STEPS]
d=dly*tSDQS-periods[phase]*clk_period-tFDQS[dl[0] % FINE_STEPS] ############################
print ("%f %f"%(d, w[i]), end=" ")
if not dl[1] is None:
print(d,end=" ")
......@@ -1794,30 +1872,90 @@ class X393LMA(object):
print("?",end=" ")
else:
print ("? ?", end=" ")
print("%f"%(SY+phase*phase_step),end=" ")
print("%f"%(SY-(phase_add-phase)*phase_step),end=" ")
print()
# Now shift SY by clk_period/2.0, for each phase find the closest DQSI match (None if does not exist)
dqsi_range=tSDQS*DLY_STEPS# full range of the DQSI delay for this lane
# dqsi_middle_in_ps = SY-clk_period*round(SY/clk_period)-0.5
# dqsi_middle_in_ps = (SY-clk_period/2)-clk_period*round((SY-clk_period/2)/clk_period)
# dqsi_middle_in_ps = (SY-clk_period/2)-clk_period*round(SY/clk_period -0.5)
dqsi_middle_in_ps = SY-clk_period*(round(SY/clk_period -0.5)+0.5)
dqsi_phase=[None]*numPhaseSteps
# Now shift SY by half clk_period for each phase find the closest DQSI match (None if does not exist)
# Shift should only be for DQSI (middle between the errors), for WLEV - no shift
#shiftFracPeriod
dqsi_range=abs(tSDQS)*DLY_STEPS# full range of the DQSI delay for this lane
# dqsi_middle_in_ps = SY-clk_period*(round(SY/clk_period -0.5)+0.5)
dqsi_middle_in_ps = SY-clk_period*(round(SY/clk_period -shiftFracPeriod)+shiftFracPeriod)
if quiet < 3:
print("SY=",SY)
print("dqsi_middle_in_ps=",dqsi_middle_in_ps)
print("phase_add=",phase_add)
print("phase_step=",phase_step)
print("shiftFracPeriod=",shiftFracPeriod)
print("clk_period*shiftFracPeriod=",(clk_period*shiftFracPeriod))
dqs_phase=[None]*numPhaseSteps
for phase in range(numPhaseSteps):
dly_ps=phase_step*phase+dqsi_middle_in_ps
dly_ps=-phase_step*(phase_add-phase)+dqsi_middle_in_ps
dly_ps-=clk_period*round(dly_ps/clk_period - 0.5) # positive, <clk_period
#Using lowest delay branch if multiple are possible
if dly_ps > dqsi_range:
continue # no valid dqs_idelay for this phase
idly = int (round(dly_ps/tSDQS))
idly = int (round(dly_ps/tSDQS)) ###############?
low= max(0,idly-FINE_STEPS)
high=min(DLY_STEPS-1,idly+FINE_STEPS)
idly=low
for i in range(low,high+1):
if abs(i*tSDQS-tFDQS[i % FINE_STEPS]-dly_ps) < abs(idly*tSDQS-tFDQS[idly % FINE_STEPS]-dly_ps):
if abs(i*tSDQS-tFDQS[i % FINE_STEPS]-dly_ps) < abs(idly*tSDQS-tFDQS[idly % FINE_STEPS]-dly_ps): ############################
idly=i
dqsi_phase[phase]=idly
dqs_phase[phase]=idly
if quiet < 3:
for phase,d in enumerate(data_set):
print ("%d"%(phase),end=" ")
if (not d is None) and (not d[lane] is None) and (not d[lane][0] is None):
dly = d[lane][0]
if d[lane][1] is None:
dly+=halfStep
print ("%f"%(dly), end=" ")
else:
print ("?", end=" ")
if not dqs_phase[phase] is None:
print("%f"%(dqs_phase[phase]),end=" ")
else:
print ("?", end=" ")
print()
# maxDlyErr (ps)
dqsi_phase_multi=[None]*numPhaseSteps
dqsi_phase_err= [None]*numPhaseSteps
min_max_periods=None
for phase in range(numPhaseSteps):
dly_ps=phase_step*(phase-phase_add)+dqsi_middle_in_ps
periods=int(round((dly_ps+ +maxDlyErr)/clk_period - 0.5))
dly_ps-=clk_period*periods # positive, <clk_period
#Using lowest delay branch if multiple are possible - now all branches
if dly_ps <= (dqsi_range+maxDlyErr):
dqsi_phase_multi[phase]={}
dqsi_phase_err[phase]={}
while dly_ps <= (dqsi_range+maxDlyErr):
try:
min_max_periods[0]=min(min_max_periods[0],periods)
min_max_periods[1]=max(min_max_periods[1],periods)
except:
min_max_periods=[periods,periods]
idly = int (round(dly_ps/tSDQS)) ##########################################
low= max(0,idly-FINE_STEPS)
# high=min(DLY_STEPS-1,idly+FINE_STEPS)
high=idly+FINE_STEPS
if high >= DLY_STEPS:
high=DLY_STEPS - 1
low= DLY_STEPS - FINE_STEPS
idly=low
for i in range(low,high+1):
if abs(i*tSDQS-tFDQS[i % FINE_STEPS]-dly_ps) < abs(idly*tSDQS-tFDQS[idly % FINE_STEPS]-dly_ps): ###################
idly=i
dqsi_phase_multi[phase][periods]=idly
dqsi_phase_err[phase][periods]=idly*tSDQS-tFDQS[idly % FINE_STEPS]-dly_ps ######################
periods-=1
dly_ps+=clk_period
if quiet < 3:
print ("maxDlyErr=",maxDlyErr)
print ("min_max_periods=",min_max_periods)
print ("dqsi_phase_multi=",dqsi_phase_multi)
print ("dqsi_phase_err=",dqsi_phase_err)
for phase,d in enumerate(data_set):
print ("%d"%(phase),end=" ")
if (not d is None) and (not d[lane] is None) and (not d[lane][0] is None):
......@@ -1827,13 +1965,27 @@ class X393LMA(object):
print ("%f"%(dly), end=" ")
else:
print ("?", end=" ")
if not dqsi_phase[phase] is None:
print("%f"%(dqsi_phase[phase]),end=" ")
if not dqsi_phase_multi[phase] is None:
for periods in range (min_max_periods[0],min_max_periods[1]+1):
try:
print("%f"%(dqsi_phase_multi[phase][periods]),end=" ")
except:
print ("?", end=" ")
for periods in range (min_max_periods[0],min_max_periods[1]+1):
try:
print("%.1f"%(dqsi_phase_err[phase][periods]),end=" ")
except:
print ("?", end=" ")
else:
print ("?", end=" ")
print()
return {"dqsi_optimal_ps":dqsi_middle_in_ps,
"dqsi_phase":dqsi_phase}
return {"dqs_optimal_ps":dqsi_middle_in_ps,
"dqs_phase":dqs_phase,
"dqs_phase_multi":dqsi_phase_multi,
"dqs_phase_err":dqsi_phase_err,
"dqs_min_max_periods":min_max_periods
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -546,11 +546,18 @@ class X393McntrlTiming(object):
if dqm_patt is None:
dqm_patt=vrlg.DFLT_DQM_PATTERN
patt = (dqs_patt & 0xff) | ((dqm_patt & 0xff) << 8)
if quiet <2 :
print("SET DQS+DQM PATTERNS, patt= 0x%08x"%patt)
vrlg.dqs_dqm_patt=patt
if quiet < 2 :
print("axi_set_dqs_dqm_patterns(): SET DQS+DQM PATTERNS, patt= 0x%08x (TODO:reduce quiet threshold)"%patt)
# set patterns for DM (always 0) and DQS - always the same (may try different for write lev.)
self.x393_axi_tasks.write_contol_register(vrlg.MCONTR_PHY_16BIT_ADDR + vrlg.MCONTR_PHY_16BIT_PATTERNS, patt) # 32'h0055);
def get_dqs_dqm_patterns(self):
#print ('vrlg.dqs_dqm_patt=',vrlg.dqs_dqm_patt)
try:
return (vrlg.dqs_dqm_patt & 0xff,(vrlg.dqs_dqm_patt >> 8) & 0xff)
except:
return None
def util_test4(self):
# print("vrlg.globals():")
# print(vrlg.globals())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment