aboutsummaryrefslogtreecommitdiffstats
path: root/src/hal/components/minmax.comp
blob: 98f371a2cdca3e72801ffcbf7e925708f377a004 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
component minmax "Track the minimum and maximum values of the input to the outputs";
pin in float in;
pin in bit reset "When reset is asserted, 'in' is copied to the outputs";
pin out float max_;
pin out float min_;
function _;
license "GPL";
author "Jeff Epler";
;;
FUNCTION(_) {
    if(reset) { max_ = min_ = in; }
    else {
        if(in > max_) max_ = in;
        if(in < min_) min_ = in;
    }
}
bues.ch cgit interface