-
Notifications
You must be signed in to change notification settings - Fork 42
/
section-decodes.tex
3583 lines (2732 loc) · 127 KB
/
section-decodes.tex
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 a directed
acyclic graph with a set of source nodes (waveforms captured from hardware, loaded from a saved session, or generated
numerically) and sink nodes (waveform views, protocol analyzer views, and statistics) connected by edges representing
data flow.
A filter is simply an intermediate node in the graph, which takes input from zero or more waveform nodes and outputs a
waveform which may be displayed, used as input to other filters, or both. A waveform is a series of data points which
may represent voltages, digital samples, or arbitrarily complex protocol data structures.
As a result, there is no internal distinction between math functions, measurements, and protocol decodes, and it is
possible to chain them arbitrarily. Consider the following example:
\begin{itemize}
\item Two analog waveforms representing serial data and clock are acquired
\item Each analog waveform is thresholded, producing a digital waveform
\item The two digital waveforms are decoded as $I^2C$, producing a series of packets
\item The $I^2C$ packets are decoded as writes to a serial DAC, producing an analog waveform
\item A moving average filter is applied to the analog waveform
\item A measurement filter finds the instantaneous frequency of each cycle of the DAC output
\end{itemize}
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 complex 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.
\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{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 & Digital & Serial 128b/130b data line \\
\thinhline
clk & Digital & DDR bit clock, typically generated by use of the \hyperref[filter:cdrpll]{Clock Recovery
(PLL)} filter on the input 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}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{64b/66b}
\label{filter:64b66b}
Decodes the 64/66b line code used by \hyperref[filter:10gbaser]{10Gbase-R} 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 & Digital & Serial 64b/66b data line \\
\thinhline
clk & Digital & DDR bit clock, typically generated by use of the \hyperref[filter:cdrpll]{Clock Recovery
(PLL)} filter on the input data.\\
\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}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{8B/10B (IBM)}
\label{filter:8b10b}
Decodes the standard 8b/10b line code used by \hyperref[filter:sgmii]{SGMII}, \hyperref[filter:1000basex]{1000base-X},
DisplayPort, JESD204, \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.
\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 \\
\thinhline
clk & Digital & DDR bit clock, typically generated by use of the \hyperref[filter:cdrpll]{Clock Recovery
(PLL)} filter on the input data.\\
\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, but significantly slows down the decode. \\
\thinhline
Display Format & Enum &
\textbf{Dotted (K28.5 D21.5)}: displays the 3b4b and 5b6b code blocks separately, with K or D prefix. \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}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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.
\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 \\
\thinhline
clk & Digital & DDR \emph{bit} clock, typically generated by use of the \hyperref[filter:cdrpll]{Clock Recovery
(PLL)} filter on the input data. Note that this is 5x the rate of the pixel clock signal. \\
\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}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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 value 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{Area Under Curve}
\label{filter:AreaUnderCurve}
TODO: needs to be updated when we port to scalar interface
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. The negative area can also be considered as positive
by changing a filter parameter. The measurement can be performed on the full record or on each cycle.
\begin{figure}[h]
\centering
\bigimage{images/filters/true-area.png}
\caption{Example of true area under the curve measurement (Integral)}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{images/filters/absolute-area.png}
\caption{Example of absolute area under the curve measurement}
\end{figure}
\pagebreak
\begin{figure}[h]
\centering
\bigimage{images/filters/per-cycle-absolute-area.png}
\caption{Example of per-cycle absolute area under the curve measurement}
\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\newline
\textbf{Absolute Area}: Consider area below ground as positive\\
\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.
For per cycle measurement, this filter outputs waveform representing area of each cycle.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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{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 grows linearly
with offset range.
\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; 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}
TODO: needs to be updated when we port to scalar interface
Calculates the base (logical zero level) of each cycle in a digital waveform.
It is most commonly used as an input to statistics, to view the average 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{images/filters/base.png}
\caption{Example of base measurement on a serial data stream}
\label{filter_base}
\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}
This filter takes no parameters.
\subsection{Output Signal}
This filter outputs an analog waveform with one sample for each group of logical zeroes in the input signal, containing
the average value of the zero level for the middle 50\% of the low period.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{BIN Import}
Loads an Agilent / Keysight / Rigol binary waveform file.
%\begin{figure}[h]
%\centering
%\bigimage{images/filters/autocorrelation.png}
%\caption{Example of autocorrelation on a serial data stream}
%\label{filter_accouple}
%\end{figure}
\subsection{Inputs}
This filter takes no inputs.
\subsection{Parameters}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Parameter name} & \textbf{Type} & \textbf{Description} \\
\thickhline
BIN File & Filename & Path to the file being imported\\
\thickhline
\end{tabularx}
\subsection{Output Signal}
This filter outputs a uniformly sampled analog waveform for each channel in the file. The number of output streams is
variable based on how many channels are present in the file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{Burst Width}
Measures the burst width of each burst in a waveform. A Burst is a sequence of adjacent crossings of the mid level reference
of the waveform. Burst width is the duration of this sequence. Bursts are separated by a user-defined idle time that can be
provided as a parameter to this filter. The measurement is made on each burst in the waveform.
\begin{figure}[h]
\centering
\bigimage{images/filters/burst-width.png}
\caption{Example of burst width measurement}
\label{filter_burstwidth}
\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
Idle Time & Integer & Minimum idle time with no toggles, before declaring start of a new burst\\
\thickhline
\end{tabularx}
\subsection{Output Signal}
This filter outputs an analog waveform with one sample for each burst in the input signal.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{Bus Heatmap}
Computes a ``spectrogram" visualization of bus activity with address on the Y axis and time on the X axis, in order to
identify patterns in memory or bus activity.
The current version only supports CAN bus however other common memory interfaces will be added in the future.
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/bus-heatmap.png}
\caption{CAN bus activity on a car's OBD port showing the vehicle being started, running for 50 seconds, then shutting down}
\label{filter_busheatmap}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-bus-heatmap.png}
\caption{Example filter graph showing usage of bus heatmap filter on an imported CAN bus capture}
\label{filter_graph_busheatmap}
\end{figure}
\FloatBarrier
\subsection{Parameters}
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Parameter name} & \textbf{Type} & \textbf{Description} \\
\thickhline
Max Address & Integer & Maximum address to display in the plot \\
\thinhline
X Bin Size & Integer & Width of each pixel in the X axis (timebase units) \\
\thinhline
Y Bin Size & Integer & Number of addresses to merge into each pixel in the Y axis \\
\thickhline
\end{tabularx}
\subsection{Output Signal}
This filter outputs a 2D density plot that is (max address) / (y bin size) pixels high and (memory depth) / (x bin
size) pixels wide, spanning the entire duration of the input and the full address range requested.
All packets within the input waveform have the start time and address rounded to the closest bin in X and Y. The
corresponding pixel in the integration buffer is incremented, then the final waveform is normalized to cover the full
range of the selected color ramp.
\begin{tabularx}{16cm}{llX}
\thickhline
\textbf{Signal name} & \textbf{Type} & \textbf{Description} \\
\thickhline
data & Density map & Calculated heatmap \\
\thickhline
\end{tabularx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{CAN}
\label{filter:can}
Decodes the Control Area Network (CAN) bus, commonly used in vehicle control systems. Both standard (11 bit) and
extended (29 bit) IDs are supported.
CAN-FD frames are detected and flagged as such, but the current decode cannot parse them fully. Full support is planned
(\issue{scopehal}{334}).
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/can.png}
\caption{Example of decoding a single extended-format frame with 3 bytes of data}
\label{filter_can}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/graph-can.png}
\caption{Example filter graph showing usage of CAN bus decode}
\label{filter_graph_can}
\end{figure}
\begin{figure}[h]
\centering
\bigimage{ng-images/filters/packet-can.png}