-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo10.jl
77 lines (59 loc) · 2.42 KB
/
demo10.jl
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
#Demo 10: Delay tests
#-------------------------------------------------------------------------------
using CMDimCircuits
CMDimCircuits.@using_CData()
#Get a demo display:
include(CMDimCircuits.demoplotcfgscript)
#Normally use something like:
#CMDimData.@includepkg EasyPlotInspect
#==Constants
===============================================================================#
vvst = cons(:a, labels = set(yaxis="Amplitude (V)", xaxis="Time (s)"))
dpsvst = cons(:a, labels = set(yaxis="Delay (ps)", xaxis="Time (s)"))
dpsvsx = cons(:a, labels = set(yaxis="Delay (ps)", xaxis="Crossing"))
ldelay = cons(:a, line = set(width=3, style=:solid))
gdelay = cons(:a, glyph = set(shape=:x, size=2))
#==Input data
===============================================================================#
tbit = 1e-9 #Bit period
osr = 20 #samples per bit
nsamples = 127
#==Computations
===============================================================================#
seq = 1.0*prbs(reglen=7, seed=1, nsamples=nsamples)
t = DataF1(0:(tbit/osr):(nsamples*tbit))
tmax = maximum(t)
#Generate parameter sweeps:
sweeplist = PSweep[
PSweep("L", [1]) #Add extra level to test more code
PSweep("tau", tbit.*[1/5, 1/2.5, 1/1.5])
]
#Generate data:
Π = fill(DataHR, sweeplist) do EL, tau
return pulse(t, Pole(1/tau,:rad), tpw=tbit)
end
pat = (pattern(seq, Π, tbit=tbit)-0.5)*2 #Center data pattern
refpat = pat.elem[1]
Δ = measdelay(refpat, pat, xing_ref=CrossType(:risefall), xing_main=CrossType(:risefall))
Δxn = measdelay(Event, refpat, pat, xing_ref=CrossType(:risefall), xing_main=CrossType(:risefall))
Δ = DataRS(Δ) #Test support for DataRS objects
#==Generate plot
===============================================================================#
p1 = push!(cons(:plot, vvst, title="Patterns"),
cons(:wfrm, refpat, line=set(width=5, color=:black), label="Ref"),
cons(:wfrm, pat, label="pat"),
)
p2 = push!(cons(:plot, dpsvst, title="Delays"),
cons(:wfrm, Δ/1e-12, ldelay, gdelay, label="D"),
)
p3 = push!(cons(:plot, dpsvsx, title="Delays vs Crossing Number"),
cons(:wfrm, Δxn/1e-12, ldelay, gdelay, label="D"),
)
pcoll = push!(cons(:plotcoll, title="Signal Delay Tests"), p1, p2, p3)
pcoll.ncolumns = 1
#==Display results in pcoll
===============================================================================#
EasyPlot.displaygui(pcoll)
#==Return pcoll to user (call evalfile(...))
===============================================================================#
pcoll