-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathsection-decodes.tex
More file actions
6060 lines (4643 loc) · 202 KB
/
Copy pathsection-decodes.tex
File metadata and controls
6060 lines (4643 loc) · 202 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\chapter{Filters}
\section{Introduction}
\subsection{Key Concepts}
ngscopeclient and libscopehal are based on a ``filter graph" architecture internally. The filter graph is composed of
nodes (instrument channels, DSP blocks, protocol decodes, file outputs, etc.) connected by edges, which represent
streams of data flowing from source to sink\footnote{Waveform views and the measurements window are internally handled
as nodes in the graph as well, but this is typically not visible to users since they are not drawn in the graph view to
avoid cluttering it.}. Dataflow is strictly unidirectional and loops or cycles are not allowed (there cannot be a path,
directly or through other nodes, from any node's output to one of its inputs)\footnote{In computer science terms, this
is a directed acyclic graph.}. Data streams may be of either waveform (many samples plotted against another quantity)
or scalar (a single measurement with associated unit) type.
A filter is simply a node which does not correspond to a physical instrument input or output. It may generate data in
some way (loading samples from a file or synthesizing a waveform parametrically), write data to a file or pass it to an
outside helper program (e.g. streaming decoded Ethernet frames to Wireshark for higher level analysis), or transform
one or more input streams in some way to create new data streams. There is no architectural distinction between math
functions, measurements, and protocol decodes, and it is possible to chain them arbitrarily - as long as the input and
output data types are compatible, any processing operation can be applied to anything.
For example, a simple BFSK decoder can be made by applying the \hyperref[filter:frequency]{Frequency} filter to an IF
or directly sampled RF waveform, after any necessary preselector filtering to exclude interference from other channels.
This produces an analog waveform plotting the frequency of the signal over time. The
\hyperref[filter:threshold]{Threshold} filter can then be used to recover the original digital data stream, which can
then be fed to an arbitrary serial digital protocol decode block. But it's equally possible to, for example, lock the
\hyperref[filter:cdrpll]{Clock Recovery (PLL)} filter to the frequency waveform and display an
\hyperref[filter:eyepattern]{eye pattern} with Y axis units of frequency.
In this document we use the term ``filter" consistently to avoid ambiguity.
\subsection{Conventions}
A filter can take arbitrarily many inputs (vector or scalar values from the filter graph), arbitrarily many parameters
(static scalar configuration settings), and outputs arbitrarily many vector or scalar outputs.
If the output signal is a multi-field type (as opposed to a single scalar, e.g. voltage, at each sample) the
``Output Signal" section will include a table describing how various types of output data are displayed.
All filters with protocol output use a standardized set of colors to display various types of data fields in a
consistent manner. These colors are configurable under the \menustyle{Appearance / Decodes} preferences category, but
default colors are shown here.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Color name} & \textbf{Use case} & \textbf{Default Color} \\
\thickhline
Address & Memory addresses & \cellcolor{address}\textcolor{black}{\#ffff00} \\
\thinhline
Checksum Bad & Incorrect CRC/checksum & \cellcolor{checksumbad}\textcolor{white}{\#ff0000} \\
\thinhline
Checksum OK & Valid CRC/checksum & \cellcolor{checksumok}\textcolor{black}{\#00ff00} \\
\thinhline
Control & Miscellaneous control data & \cellcolor{control}\textcolor{white}{\#c000a0} \\
\thinhline
Data & User data & \cellcolor{data}\textcolor{white}{\#336699} \\
\thinhline
Error & Malformed/unreadable data & \cellcolor{error}\textcolor{white}{\#ff0000} \\
\thinhline
Idle & Inter-frame gaps & \cellcolor{idle}\textcolor{white}{\#404040} \\
\thinhline
Preamble & Preamble/sync words & \cellcolor{preamble}\textcolor{white}{\#808080} \\
\thickhline
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{1-Wire}
\label{filter:1wire}
Decodes the Dallas Semiconductor 1-wire bus, commonly used for EEPROMs and sensors in cost / area optimized, low speed
applications.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/1wire.png}
\caption{Example 1-wire decode}
\label{filter_1wire}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-1wire.png}
\caption{Example filter graph using decoding a 1-wire signal}
\label{filter_graph_1wire}
\end{figure}
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Digital & Serial data input \\
\thickhline
\end{tabularx}
\subsection{Parameters}
This filter takes no parameters.
\subsection{Output Signal}
This filter outputs a single decoded data stream consisting of 1-wire sample objects.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Stream name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Sparse protocol & Output decode \\
\thickhline
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{128b/130b}
\label{filter:128b130b}
Decodes the 128b/130b line code used by PCIe gen 3/4/5. This filter performs block alignment and descrambling, but no
decoding of block contents.
128b/130b, as a close relative of \hyperref[filter:128b130b]{64b/66b}, is a serial line code which divides transmitted
data into 128-bit blocks and scrambles them with a LFSR, then appends a 2-bit type field (which is not scrambled) to
each block for synchronization. Block synchronization depends on always having an edge in the type field so types 2'b00
and 2'b11 are disallowed.
For PCIe over 128b/130b, block type 2'b01 contains 128 bits of upper layer protocol data while block type 2'b10
contains an ordered set.
Note that this filter only performs block alignment and descrambling. No decoding or parsing is applied to the 128-bit
blocks, other than searching for skip ordered sets (beginning with 0xaa) and using them for scrambler synchronization.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/128b130b.png}
\caption{Example 128b/130b decode}
\label{filter_128b130b}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-pcie-gen3.png}
\caption{Example filter graph using 128b/130b to decode a 2-lane PCIe gen3 link}
\label{filter_graph_128b130b}
\end{figure}
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Sparse digital & Sampled and thresholded 128b/130b data \\
\thickhline
\end{tabularx}
\subsection{Parameters}
This filter takes no parameters.
\subsection{Output Signal}
The 128B/130B filter outputs a time series of 128B/130B sample objects. These consist of a control/data flag and
a 128-bit data block.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Stream name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Sparse protocol & Output decode \\
\thickhline
\end{tabularx}
\begin{tabularx}{16cm}{lllX}
\thickhline
\textbf{Type} & \textbf{Description} & \textbf{Color} & \textbf{Format} \\
\thickhline
Ordered set & Block with type 2'b10 & \cellcolor{control}\textcolor{white}{Control} & \%032x \\
\thinhline
Data & Block with type 2'b01 & \cellcolor{data}\textcolor{white}{Data} & \%032x \\
\thinhline
Error & Block with type 2'b00 or 2'b11 & \cellcolor{error}\textcolor{white}{Error} & \%032x \\
\thickhline
\end{tabularx}
\subsection{Breaking Changes}
This section lists major interface changes that may require projects to be updated.
\begin{itemize}
\item \textbf{v0.2:} This filter no longer needs the clock input that was required in v0.1.
Instead, threshold the sampledData output of the \hyperref[filter:cdrpll]{Clock Recovery (PLL)} and pass this to the
128b/130b decode, as shown in Fig. \ref{filter_graph_128b130b}.
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{2-Port Shunt Through}
\label{filter:2portshuntthrough}
Measures the impedance of a DUT connected to a VNA in a 2-port shunt-through topology (VNA ports 1 and 2 connected,
with DUT attached between the connection point and ground). This is commonly used for measuring very low impedance
networks, such as power distribution networks.
(This filter description is a stub and will be expanded in the future)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{64b/66b}
\label{filter:64b66b}
Decodes the 64/66b line code used by \hyperref[filter:10gbaser]{10Gbase-R}, Aurora, JESD204C, and other serial
protocols, as originally specified in IEEE 802.3 clause 49.2.
64b/66b is a serial line code which divides transmitted data into 64-bit blocks and scrambles them with a LFSR, then
appends a 2-bit type field (which is not scrambled) to each block for synchronization. Block synchronization depends on
always having an edge in the type field so types 2'b00 and 2'b11 are disallowed.
Note that this filter only performs block alignment and descrambling. No decoding is applied to the 64-bit blocks, as
different upper-layer protocols assign different meaning to them. In 10Gbase-R, type 2'b01 denotes ``64 bits of upper
layer data" and type 2'b10 denotes ``8-bit type field and 56 bits of data whose meaning depends on the type", however
this is not universal and some other protocols use these fields for different purposes.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/64b66b.png}
\caption{Example 64b/66b decode}
\label{filter_64b66b}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-10gbe.png}
\caption{Example filter graph using 64b/66b to decode a 10Gbase-R signal}
\label{filter_graph_64b66b}
\end{figure}
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Sparse digital & Serial 64b/66b data line \\
\thickhline
\end{tabularx}
\subsection{Parameters}
This filter takes no parameters.
\subsection{Output Signal}
The 64B/66B filter outputs a time series of 64B/66B sample objects. These consist of a control/data flag and
a 64-bit data block.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Stream name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Sparse protocol & Output decode \\
\thickhline
\end{tabularx}
\begin{tabularx}{16cm}{lllX}
\thickhline
\textbf{Type} & \textbf{Description} & \textbf{Color} & \textbf{Format} \\
\thickhline
Control & Block with type 2'b10 & \cellcolor{control}\textcolor{white}{Control} & \%016x \\
\thinhline
Data & Block with type 2'b01 & \cellcolor{data}\textcolor{white}{Data} & \%016x \\
\thinhline
Error & Block with type 2'b00 or 2'b11 & \cellcolor{error}\textcolor{white}{Error} & \%016x \\
\thickhline
\end{tabularx}
\subsection{Breaking Changes}
This section lists major interface changes that may require projects to be updated.
\begin{itemize}
\item \textbf{v0.2:} This filter no longer needs the clock input that was required in v0.1.
Instead, threshold the sampledData output of the \hyperref[filter:cdrpll]{Clock Recovery (PLL)} and pass this to the
64/66b decode, as shown in Fig. \ref{filter_graph_64b66b}.
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{8B/10B (IBM)}
\label{filter:8b10b}
Decodes the standard 8b/10b line code, originally invented at IBM and now used by \hyperref[filter:sgmii]{SGMII},
\hyperref[filter:1000basex]{1000base-X}, \hyperref[filter:dpmain]{DisplayPort}, JESD204A/B,
\hyperref[filter:pcie2_logical]{PCIe gen 1/2}, SATA, USB 3.0, and many other common serial protocols.
8b/10b is a dictionary based code which converts each byte of message data to a ten-bit code. In order to maintain DC
balance and limit run length to a maximum of five identical bits in a row, all 8-bit input codes have one of:
\begin{itemize}
\item One legal coding, with exactly five zero bits
\item Two legal codings, one with four zero bits and one with six
\end{itemize}
The transmitter maintains a ``running disparity" counter and chooses the appropriate coding for each symbol to ensure
DC balance. There are twelve legal codes which are not needed for encoding data values; these are used to encode
frame boundaries, idle/alignment sequences, and other control information.
\textbf{NOTE} If an 8B/10B signal has its polarity inverted, e.g. by putting a differential probe on backwards or
swapping the pair for routability and correcting in the SERDES, \emph{all Kx.x control characters will be unchanged}
and simply flip disparity, while Dx.x data characters will be completely scrambled. If you are looking at a protocol
decode that appears to be nonsense but has valid framing, try adding an \hyperref[filter:invert]{Invert} block before
the 8B/10B decode.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/8b10b.png}
\caption{Example 8b/10b decode}
\label{filter_8b10b}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-1000basex.png}
\caption{Example filter graph using 8b/10b to decode a differential 1000base-X link}
\label{filter_graph_8b10b}
\end{figure}
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Digital & Serial 8b/10b data line \\
\thickhline
\end{tabularx}
\subsection{Parameters}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Parameter name} & \textbf{Type} & \textbf{Description} \\
\thinhline
Comma Search Window & Integer &
Number of unit intervals to search when performing comma alignment. A larger window increases the probability of a
correct lock if commas are infrequent, but significantly slows down the decode. The default is 20000 UI. \\
\thinhline
Display Format & Enum &
\textbf{Dotted (K28.5 D21.5)}: displays the 3b4b and 5b6b code blocks separately, with K or D prefix, as well as the current running disparity. \newline
\textbf{Hex (K.bc b5)}: displays data as hex byte values and control codes with a K prefix. \\
\thickhline
\end{tabularx}
\subsection{Output Signal}
The 8B/10B filter outputs a time series of 8B/10B sample objects. These consist of a control/data flag, the current
running disparity, and a byte of data.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Stream name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Sparse protocol & Output decode \\
\thickhline
\end{tabularx}
\begin{tabularx}{16cm}{lllX}
\thickhline
\textbf{Type} & \textbf{Description} & \textbf{Color} & \textbf{Format} \\
\thickhline
Control & Control codes & \cellcolor{control}\textcolor{white}{Control} & K\%d.\%d+ or K\%02x\\
\thinhline
Data & Upper layer protocol data & \cellcolor{data}\textcolor{white}{Data} & D\%d.\%d+ or \%02x\\
\thinhline
Error & Malformed data & \cellcolor{error}\textcolor{white}{Error} & ERROR \\
\thickhline
\end{tabularx}
\subsection{Breaking Changes}
This section lists major interface changes that may require projects to be updated.
\begin{itemize}
\item \textbf{v0.2:} This filter no longer needs the clock input that was required in v0.1.
Instead, threshold the sampledData output of the \hyperref[filter:cdrpll]{Clock Recovery (PLL)} and pass this to the
8b/10b decode, as shown in Fig. \ref{filter_graph_8b10b}.
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{8B/10B (TMDS)}
\label{filter:tmds}
Decodes the 8-to-10 Transition Minimized Differential Signalling line code used in \hyperref[filter:dvi]{DVI} and
\hyperref[filter:hdmi]{HDMI}.
Like the \hyperref[filter:8b10b]{8B/10B (IBM)} line code, TMDS is an 8-to-10 bit serial line code. TMDS, however, is
designed to \emph{minimize} the number of toggles in the data stream for EMC reasons, rendering it difficult to
synchronize a CDR PLL to. As a result, HDMI and DVI provide a reference clock at the pixel clock rate (1/10 the serial
data bit rate) along with the data stream to provide synchronization.
However, libscopeprotocols does not currently provide a frequency synthesis PLL which can recover a pixel clock from
the 1/10 rate clock (\issue{scopehal}{221}). As a result, it is currently necessary to perform per-lane CDR on the TMDS
data in order to decode it. This is sufficient for protocol decoding, but is not suitable for high-fidelity eye pattern
measurements since skew/jitter between the TMDS lane and the clock lane will not be accounted for.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/tmds.png}
\caption{Example TMDS decode}
\label{filter_tmds}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-tmds.png}
\caption{Example filter graph decoding TMDS from a single-ended input. Note that this example recovers the clock from
the input signal rather than multiplying up the reference clock.}
\label{filter_graph_tmds}
\end{figure}
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Digital & Serial TMDS data line \\
\thickhline
\end{tabularx}
\subsection{Parameters}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Parameter name} & \textbf{Type} & \textbf{Description} \\
\thinhline
Lane Number & Integer & Lane number within the link (0-3)\\
\thickhline
\end{tabularx}
\subsection{Output Signal}
The TMDS filter outputs a time series of TMDS sample objects. These consist of a type field and a byte of data.
The output of the TMDS decode is commonly fed to the \hyperref[filter:dvi]{DVI} or \hyperref[filter:hdmi]{HDMI}
protocol decoders.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Stream name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Sparse protocol & Output decode \\
\thickhline
\end{tabularx}
\begin{tabularx}{16cm}{lllX}
\thickhline
\textbf{Type} & \textbf{Description} & \textbf{Color} & \textbf{Format} \\
\thickhline
Control & Control codes (H/V sync) & \cellcolor{control}\textcolor{white}{Control} & CTL\%d \\
\thinhline
Data & Pixel/island data & \cellcolor{data}\textcolor{white}{Data} & \%02x \\
\thinhline
Error & Malformed data & \cellcolor{error}\textcolor{white}{Error} & ERROR \\
\thinhline
Guard band & HDMI data/video guard band & \cellcolor{preamble}\textcolor{white}{Preamble} & GB \\
\thickhline
\end{tabularx}
\subsection{Breaking Changes}
This section lists major interface changes that may require projects to be updated.
\begin{itemize}
\item \textbf{v0.2:} This filter no longer needs the clock input that was required in v0.1.
Instead, threshold the sampledData output of the \hyperref[filter:cdrpll]{Clock Recovery (PLL)} and pass this to the
TMDS decode, as shown in Fig. \ref{filter_graph_tmds}.
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{AC Couple}
\label{filter:accouple}
Automatically removes a DC offset from an analog waveform by subtracting the average of all samples from each sample.
This filter should only be used in postprocessing already acquired data, or other situations in which AC coupling in
the hardware (via an AC coupled probe, or coaxial DC block) is not possible.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/accouple.png}
\caption{Example input and output of the AC Couple filter}
\label{filter_accouple}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-accouple.png}
\caption{Example filter graph AC coupling an input waveform}
\label{filter_graph_accouple}
\end{figure}
\FloatBarrier
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
din & Analog & Input waveform \\
\thickhline
\end{tabularx}
\subsection{Parameters}
This filter takes no parameters.
\subsection{Output Signal}
This filter outputs an analog waveform with identical configuration (sparse or uniform) and sample rate to the input,
vertically shifted to center the signal at zero volts.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Stream name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Analog & Output decode \\
\thickhline
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{AC RMS}
\label{filter:acrms}
Measures the Root Mean Square amplitude of the waveform after removing any DC offset. The DC offset is calculated by
averaging all samples in the waveform.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/acrms.png}
\caption{Example usage of the AC RMS filter on a QAM modulated signal}
\label{filter_acrms}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-acrms.png}
\caption{Example filter graph measuring RMS value of a waveform}
\label{filter_graph_acrms}
\end{figure}
\FloatBarrier
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
din & Analog & Input waveform \\
\thickhline
\end{tabularx}
\subsection{Parameters}
This filter takes no parameters.
\subsection{Output Signal}
This filter has two output streams.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Stream name} & \textbf{Type} & \textbf{Description} \\
\thickhline
trend & Sparse analog & One sample per cycle of the input waveform containing the RMS value across that cycle \\
\thinhline
avg & Scalar & RMS value across the entire waveform \\
\thickhline
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{Add}
\label{filter:add}
This filter adds two inputs. Either input may be a vector (waveform) or scalar.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/add.png}
\caption{Example usage of adding two analog waveforms}
\label{filter_add}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-add.png}
\caption{Example filter graph adding two analog waveforms}
\label{filter_graph_add}
\end{figure}
\FloatBarrier
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
a & Analog waveform or scalar & First input waveform\\
\thinhline
b & Analog waveform or scalar & Second input waveform\\
\thickhline
\end{tabularx}
\subsection{Parameters}
This filter takes no parameters.
\subsection{Output Signal}
If both inputs are vectors, this filter outputs a waveform containing the pairwise sum; i.e. sample $i$ of the output
is $a[i] + b[i]$. No resampling is performed on the inputs so incorrect or unexpected results may occur if they do not
share the same timebase. Both inputs must be the same type (both sparse or both uniform), mixing sparse and uniform
(even if the sample timestamps are the same) is not allowed.
If both inputs are scalars, this filter outputs their sum.
If one input is a vector and the other is a scalar, this filter outputs the sum of the scalar and each element of the
waveform, i.e. sample $i$ of the output is $a + b[i]$ for the scalar + vector case and $a[i] + b$ for the vector +
scalar.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Stream name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Analog & One sample per cycle of the input waveform containing the sum of the a and b inputs at that time \\
\thickhline
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{ADL5205}
\label{filter:adl5205}
Decodes SPI data traffic to one half of an ADL5205 variable gain amplifier.
TODO: Screenshot
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
spi & SPI bus & The SPI data bus \\
\thickhline
\end{tabularx}
\subsection{Parameters}
This filter takes no parameters.
\subsection{Output Signal}
This filter outputs one ADL5205 sample object for each write transaction, formatted as ``write: FA=2 dB, gain=8 dB".
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{APB}
\label{filter:apb}
Decodes the AMBA APB bus, commonly used for connecting low-speed peripherals such as timers and serial ports to CPU
cores in microcontrollers and SoCs. APB is a parallel bus typically only used in on-chip applications, so this filter
is normally used with an internal logic analyzer core recording on-die signals to RAM and then reading out via JTAG or
other debug protocol, or for analyzing VCD dumps from RTL simulation.
\textbf{NOTE}: The following APBv4/5 features are not yet supported by this decode:
\begin{itemize}
\item Byte write strobes
\item Bus errors
\item Address or data buses larger than 32 bits in size
\item ID / user tag data
\item Wakeup signaling
\end{itemize}
\begin{figure}[h]
\centering
\medimage{ng-images/filters/apb.png}
\caption{Example APB decode}
\label{filter_apb}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-apb.png}
\caption{Example filter graph showing usage of APB decode}
\label{filter_graph_apb}
\end{figure}
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
penable & 1-bit digital & APB enable \\
\thinhline
psel & 1-bit digital & APB select \\
\thinhline
pready & 1-bit digital & APB ready \\
\thinhline
pwrite & 1-bit digital & APB write enable \\
\thinhline
pslverr & 1-bit digital & APB error indication (optional)\\
\thinhline
paddr & 1-32 bit digital & APB address \\
\thinhline
pwdata & 1-32 bit digital & APB write data \\
\thinhline
prdata & 1-32 bit digital & APB read data \\
\thinhline
pstrb & 1-4 bit digital & APB byte strobe (optional)\\
\thickhline
\end{tabularx}
\subsection{Parameters}
This filter takes no parameters.
\subsection{Output Signal}
This filter outputs a time series of APB sample objects, each consisting of a read/write flag, an address, and a data
value. Additional data will be added in the future once decoding of the full APBv5 protocol is implemented.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{Area Under Curve}
\label{filter:AreaUnderCurve}
Measures the area under the curve by integrating the data points. By default, area measured above ground is considered
as positive and area measured below the ground is considered negative (``true area"). The negative area can also be
considered as positive (``absolute area"). The measurement can be performed on the full record or on each
cycle.
The following examples demonstrate usage of the filter on a sinusoid.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/integral-full.png}
\caption{True area full record measurement. In this mode, the filter outputs $\int_{0}^{i} x$ at sample $i$, so we get
$\int sin(x) = cos(x)$.}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/integral-percycle.png}
\caption{True area per cycle measurement. In this mode, the filter outputs $\int_{t1}^{t2} x$ at each zero
crossing bounded interval so we get $\int_{0}^{2\pi} sin(x) = 0$ (plus measurement noise).}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/integral-abs-full.png}
\caption{Absolute area full record measurement. In this mode, the filter outputs $\int_{0}^{i} |x|$ at sample $i$, so
we get a continually increasing signal.}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/integral-abs-percycle.png}
\caption{Absolute area per cycle measurement. In this mode, the filter outputs $\int_{t1}^{t2} |x|$ at each zero
crossing bounded interval, so we get $\int{0}^{2\pi} |sin(x)| = 4$ (plus measurement noise).}
\end{figure}
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
din & Analog & Input waveform \\
\thickhline
\end{tabularx}
\subsection{Parameters}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Parameter name} & \textbf{Type} & \textbf{Description} \\
\thickhline
Measurement Type & Enum &
\textbf{Full Record}: Measure the area of entire waveform \newline
\textbf{Per Cycle}: Measure the area of each cycle in the waveform\\
\thinhline
Area Type & Enum &
\textbf{True Area}: Consider area below ground as negative (integrate X)\newline
\textbf{Absolute Area}: Consider area below ground as positive (integrate $|X|$)\\
\thickhline
\end{tabularx}
\subsection{Output Signal}
For full record measurement, this filter outputs a waveform indicating total area measured till the time on the
waveform (integrating from zero to the current sample).
For per cycle measurement, this filter outputs a waveform representing area of each cycle (integrating between zero
crossings).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\FloatBarrier
\pagebreak
\section{Autocorrelation}
\label{filter:autocorrelation}
This filter calculates the autocorrelation of an analog waveform. Autocorrelation is a measure of self-similarity
calculated by multiplying the signal with a time-shifted copy of itself. In Fig. \ref{filter_autocorrelation}, strong peaks
can be seen at multiples of the 8b/10b symbol rate.
For best performance, it is crucial to keep the maximum offset as low as possible, since filter run time is
proportional to offset range multiplied by waveform length. A GPU implementation of this filter is planned for the
future (\issue{scopehal}{998}) which will significantly increase speed.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/autocorrelation.png}
\caption{Example waveforms showing autocorrelation of an 8b/10b signal}
\label{filter_autocorrelation}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-autocorrelation.png}
\caption{Example filter graph showing usage of autocorrelation filter}
\label{filter_graph_autocorrelation}
\end{figure}
\FloatBarrier
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
din & Uniform analog & Input waveform \\
\thickhline
\end{tabularx}
\subsection{Parameters}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Parameter name} & \textbf{Type} & \textbf{Description} \\
\thickhline
Max offset & Integer & Maximum shift (in samples)\\
\thickhline
\end{tabularx}
\subsection{Output Signal}
This filter outputs an analog waveform with the same timebase as the input, one sample for each correlation offset.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Stream name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Uniform analog & Autocorrelation waveform \\
\thickhline
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{Average}
\label{filter:average}
This filter calculates the average of its input.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/average.png}
\caption{Typical usage of average filter}
\label{filter_average}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-average.png}
\caption{Example filter graph showing usage of average filter}
\label{filter_graph_average}
\end{figure}
\FloatBarrier
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
in & Analog or scalar & Input waveform \\
\thickhline
\end{tabularx}
\subsection{Parameters}
This filter takes no parameters.
\subsection{Output Signal}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
latest & Scalar & Average of the filter's current input \\
\thinhline
cumulative & Scalar & Average of all input since the last clear-sweeps\\
\thinhline
totalSamples & Scalar & Total number of integrated samples \\
\thinhline
totalWaveforms & Scalar & Total number of integrated waveforms \\
\thickhline
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{Bandwidth}
Calculates the -3 dB bandwidth of a network, given the insertion loss magnitude.
The bandwidth is measured relative to a user-specified reference level (typically the insertion loss at DC or the low
end of the passband); for example the bandwidth of a 20 dB attenuator can be measured by setting the reference level to
-20 dB.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/bandwidth.png}
\caption{Measuring the -3 dB bandwidth of a cable}
\label{filter_bandwidth}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-bandwidth.png}
\caption{Example filter graph showing usage of bandwidth filter on an imported Touchstone file}
\label{filter_graph_bandwidth}
\end{figure}
\FloatBarrier
\subsection{Inputs}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
din & Analog & Input waveform (typically S21) \\
\thickhline
\end{tabularx}
\subsection{Parameters}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Parameter name} & \textbf{Type} & \textbf{Description} \\
\thickhline
Reference Level & Float & Nominal (DC / mid band) insertion loss of the network\\
\thickhline
\end{tabularx}
\subsection{Output Signal}
This filter outputs a scalar containing the first frequency in the network which is at least -3 dB below the reference
level. If the input waveform is entirely below this level, the lowest frequency in the input is returned. If the
input waveform is entirely above this level, the highest frequency in the input is returned.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Scalar & Calculated bandwidth \\
\thickhline
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{Base}
\label{filter:base}
Calculates the base (average logical zero level) of a digital waveform.
It is most commonly used as a scalar to view the base of the entire waveform. At times, however, it may be useful to
view the base waveform. For example, in Fig. \ref{filter_base}, the vertical eye closure caused by channel ISI is
readily apparent.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/base.png}
\caption{Example of base measurement on a serial data stream}
\label{filter_base}
\end{figure}
\begin{figure}[h]