minmax.comp
1 component minmax "Track the minimum and maximum values of the input to the outputs"; 2 pin in float in; 3 pin in bit reset "When reset is asserted, 'in' is copied to the outputs"; 4 pin out float max_; 5 pin out float min_; 6 function _; 7 license "GPL"; 8 ;; 9 FUNCTION(_) { 10 if(reset) { max_ = min_ = in; } 11 else { 12 if(in > max_) max_ = in; 13 if(in < min_) min_ = in; 14 } 15 }