ngscopeclient v0.1
EyePattern.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopeprotocols *
4* *
5* Copyright (c) 2012-2025 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
36#ifndef EyePattern_h
37#define EyePattern_h
38
39#include "EyeMask.h"
40#include "../scopehal/EyeWaveform.h"
41
42class EyePattern : public Filter
43{
44public:
45 EyePattern(const std::string& color);
46
47 virtual void Refresh(vk::raii::CommandBuffer& cmdBuf, std::shared_ptr<QueueHandle> queue) override;
48
49 static std::string GetProtocolName();
50
51 virtual bool ValidateChannel(size_t i, StreamDescriptor stream) override;
52
53 virtual float GetVoltageRange(size_t stream) override;
54 virtual float GetOffset(size_t stream) override;
55
56 virtual void ClearSweeps() override;
57
58 EyeWaveform* ReallocateWaveform();
59
60 void SetWidth(size_t width)
61 {
62 if(m_width != width)
63 {
64 SetData(NULL, 0);
65 m_width = width;
66 }
67 }
68
69 void SetHeight(size_t height)
70 {
71 if(m_height != height)
72 {
73 SetData(NULL, 0);
74 m_height = height;
75 }
76 }
77
78 int64_t GetXOffset()
79 { return m_xoff; }
80
81 float GetXScale()
82 { return m_xscale; }
83
84 size_t GetWidth() const
85 { return m_width; }
86
87 size_t GetHeight() const
88 { return m_height; }
89
90 EyeMask& GetMask()
91 { return m_mask; }
92
93 enum ClockPolarity
94 {
95 CLOCK_RISING = 1,
96 CLOCK_FALLING = 2,
97 CLOCK_BOTH = 3 //CLOCK_RISING | CLOCK_FALLING
98 };
99
100 enum RangeMode
101 {
102 RANGE_AUTO = 0,
103 RANGE_FIXED = 1
104 };
105
106 enum ClockAlignment
107 {
108 ALIGN_CENTER,
109 ALIGN_EDGE
110 };
111
112 enum UIMode
113 {
114 MODE_AUTO,
115 MODE_FIXED
116 };
117
118 PROTOCOL_DECODER_INITPROC(EyePattern)
119
120protected:
121 void DoMaskTest(EyeWaveform* cap);
122
123 void RecalculateUIWidth(std::vector<int64_t>& clock_edges, EyeWaveform* cap);
124
125 void SparsePackedInnerLoop(
126 SparseAnalogWaveform* waveform,
127 std::vector<int64_t>& clock_edges,
128 int64_t* data,
129 size_t wend,
130 size_t cend,
131 int32_t xmax,
132 int32_t ymax,
133 float xtimescale,
134 float yscale,
135 float yoff
136 );
137
138 void DensePackedInnerLoop(
139 UniformAnalogWaveform* waveform,
140 std::vector<int64_t>& clock_edges,
141 int64_t* data,
142 size_t wend,
143 size_t cend,
144 int32_t xmax,
145 int32_t ymax,
146 float xtimescale,
147 float yscale,
148 float yoff
149 );
150
151#ifdef __x86_64__
152 void DensePackedInnerLoopAVX2(
153 UniformAnalogWaveform* waveform,
154 std::vector<int64_t>& clock_edges,
155 int64_t* data,
156 size_t wend,
157 size_t cend,
158 int32_t xmax,
159 int32_t ymax,
160 float xtimescale,
161 float yscale,
162 float yoff
163 );
164
165 void DensePackedInnerLoopAVX2FMA(
166 UniformAnalogWaveform* waveform,
167 std::vector<int64_t>& clock_edges,
168 int64_t* data,
169 size_t wend,
170 size_t cend,
171 int32_t xmax,
172 int32_t ymax,
173 float xtimescale,
174 float yscale,
175 float yoff
176 );
177
178 void DensePackedInnerLoopAVX512F(
179 UniformAnalogWaveform* waveform,
180 std::vector<int64_t>& clock_edges,
181 int64_t* data,
182 size_t wend,
183 size_t cend,
184 int32_t xmax,
185 int32_t ymax,
186 float xtimescale,
187 float yscale,
188 float yoff
189 );
190#endif
191
192 size_t m_height;
193 size_t m_width;
194
195 int64_t m_xoff;
196 float m_xscale;
197 ClockAlignment m_lastClockAlign;
198
199 std::string m_saturationName;
200 std::string m_centerName;
201 std::string m_maskName;
202 std::string m_polarityName;
203 std::string m_vmodeName;
204 std::string m_rangeName;
205 std::string m_clockAlignName;
206 std::string m_rateModeName;
207 std::string m_rateName;
208
209 EyeMask m_mask;
210};
211
212#endif
Declaration of EyeMask, EyeMaskPoint, and EyeMaskPolygon.
A mask used for checking eye patterns.
Definition: EyeMask.h:98
Definition: EyePattern.h:43
void DoMaskTest(EyeWaveform *cap)
Checks the current capture against the eye mask.
Definition: EyePattern.cpp:1068
virtual void ClearSweeps() override
Clears any integrated data from past triggers (e.g. eye patterns).
Definition: EyePattern.cpp:148
An eye-pattern waveform.
Definition: EyeWaveform.h:58
Abstract base class for all filter graph blocks which are not physical instrument channels.
Definition: Filter.h:95
virtual void Refresh() override
Evaluates a filter graph node.
Definition: Filter.cpp:823
void SetData(WaveformBase *pNew, size_t stream)
Sets the waveform data for a given stream, replacing any previous waveform.
Definition: InstrumentChannel.cpp:139
A waveform sampled at irregular intervals.
Definition: Waveform.h:481
Descriptor for a single stream coming off a channel.
Definition: StreamDescriptor.h:46
A waveform sampled at uniform intervals.
Definition: Waveform.h:383