-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdisplayResults.py
108 lines (83 loc) · 3.99 KB
/
displayResults.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
###########################################################################
#
# StatOpt Simulator
# by Jeremy Cosson-Martin, Jhoan Salinas of
# Ali Sheikholeslami's group
# Ported to Python 3 by Savo Bajic
# Department of Electrical and Computer Engineering
# University of Toronto
# Copyright Material
# For personal use only
#
###########################################################################
# This function displays the final simulation results. It displays the
# data level and eye dimension results to the command window.
#
# Inputs:
# simSettings: structure containing simulation settings
# simResults: structure containing simulation results
#
# Outputs:
# Data levels, ideal sampling locations and eye dimension results to
# command window
#
###########################################################################
from userSettingsObjects import simulationSettings
from initializeSimulation import simulationStatus
def displayResults(simSettings: simulationSettings,simResults: simulationStatus):
if simSettings.general.plotting.results and simResults.results.successful:
# Display data levels
displayDLevs(simResults)
# Display sampler locations
displaySamplerLocs(simResults)
# Display eye opening
displayEyeOpening(simSettings, simResults)
# Display channel operating margin
displayCOM(simResults)
###########################################################################
# This function displays data levels
###########################################################################
def displayDLevs(simResults: simulationStatus):
# Import variables
dLevs = simResults.results.dLevs
# Display data levels
print('\n----------Data Level Results----------')
for index in range(len(dLevs)-1, -1, -1):
print('Data level {0:d}: {1: 3.3f}V'.format(index, dLevs[index]))
###########################################################################
# This function displays ideal sampler locations
###########################################################################
def displaySamplerLocs(simResults: simulationStatus):
# Import variables
eyeLocs = simResults.results.eyeLocs
# Display eye locations
print('\n----------Sampler Location Results----------')
if type(eyeLocs.level) == int or type(eyeLocs.level) == float:
print('Sampler {0:d}: level: {1: .3f}V, phase: {2: 3.1f}deg'.format(0, eyeLocs.level, eyeLocs.phase)) # Case for single eye
else:
for index in range(len(eyeLocs.level)-1, -1, -1):
print('Sampler {0:d}: level: {1: .3f}V, phase: {2: 3.1f}deg'.format(index, eyeLocs.level[index], eyeLocs.phase))
###########################################################################
# This function displays the eye size results.
###########################################################################
def displayEyeOpening(simSettings: simulationSettings, simResults: simulationStatus):
# Import variables
target = simSettings.general.targetBER.value
eyeDims = simResults.results.eyeDimensions
bestBER = simResults.results.BER
# Display eye quality
print('\n----------Opening Results----------')
if bestBER > target:
print('WARNING: Target BER not met!')
for index, eye in enumerate(eyeDims.__dict__):
print('Eye {0:d} height: {1:.3f}V, width: {2:.2f}UI for BER: {3:.1e}'.format(index, eyeDims.__dict__[eye].height, eyeDims.__dict__[eye].widthUI, bestBER))
###########################################################################
# This function displays the channel operating margin
###########################################################################
def displayCOM(simResults: simulationStatus):
# Import variables
com = simResults.results.com
ber = simResults.results.BER
# Display eye locations
print('\n----------Channel Operating Margin----------')
print('COM: {0:.1f}dB for BER: {1:.1e}'.format(com, ber))