summaryrefslogtreecommitdiff
path: root/src/hal/components/mux4.comp
blob: bf75d9c2ad942c7f52911600f86e436cccdfbf22 (plain)
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
component mux4 "Select from one of four input values";
pin in bit sel0;
pin in bit sel1 """\
Together, these determine which \\fBin\\fIN\\fR value is copied to \\fBout\\fR.
""";
pin out float out """\
Follows the value of one of the \\fBin\\fIN\\fR values according to the two \\fBsel\\fR values
.RS
.TP
\\fBsel1=FALSE\\fR, \\fBsel0=FALSE\\fR
\\fBout\\fR follows \\fBin0\\fR
.TP
\\fBsel1=FALSE\\fR, \\fBsel0=TRUE\\fR
\\fBout\\fR follows \\fBin1\\fR
.TP
\\fBsel1=TRUE\\fR, \\fBsel0=FALSE\\fR
\\fBout\\fR follows \\fBin2\\fR
.TP
\\fBsel1=TRUE\\fR, \\fBsel0=TRUE\\fR
\\fBout\\fR follows \\fBin3\\fR
.RE
""";
pin in float in0;
pin in float in1;
pin in float in2;
pin in float in3;
function _;
license "GPL";
;;
FUNCTION(_) {
    if(sel1) {
        if(sel0) out = in3;
        else out = in2;
    } else {
        if(sel0) out = in1;
        else out = in0;
    }
}