SHOW:
|
|
- or go back to the newest paste.
| 1 | component comp "Two input digital comparator"; | |
| 2 | pin in s_32 in0 "Inverting input to the comparator"; | |
| 3 | pin in s_32 in1 "Non-inverting input to the comparator"; | |
| 4 | - | pin out bit out "Normal output. True when \\fBin1\\fR > \\fBin0\\fR (see parameter \\fBhyst\\fR for details)"; |
| 4 | + | pin out bit out "Normal output. True when \\fBin1\\fR > \\fBin0\\fR"; |
| 5 | - | pin out bit equal "Match output. True when difference between \\fBin1\\fR and \\fBin0\\fR is less than \\fBhyst\\fR/2"; |
| 5 | + | pin out bit equal "Match output. True when difference between \\fBin1\\fR and \\fBin0\\fR is 0"; |
| 6 | ||
| 7 | function _ fp "Update the comparator"; | |
| 8 | license "GPL"; | |
| 9 | ;; | |
| 10 | FUNCTION(_) {
| |
| 11 | s_32 tmp = in1 - in0; | |
| 12 | ||
| 13 | if(tmp < 0) {
| |
| 14 | out = 0; | |
| 15 | equal = 0; | |
| 16 | } else if(tmp > 0){
| |
| 17 | out = 1; | |
| 18 | equal = 0; | |
| 19 | } else {
| |
| 20 | equal = 1; | |
| 21 | } | |
| 22 | } |