Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component comp "Two input digital comparator";
- pin in s32 in0 "Inverting input to the comparator";
- pin in s32 in1 "Non-inverting input to the comparator";
- pin out bit out "Normal output. True when \\fBin1\\fR > \\fBin0\\fR";
- pin out bit equal "Match output. True when difference between \\fBin1\\fR and \\fBin0\\fR is 0";
- function _ fp "Update the comparator";
- license "GPL";
- ;;
- FUNCTION(_) {
- __s32 tmp = in1 - in0;
- if(tmp < 0) {
- out = 0;
- equal = 0;
- } else if(tmp > 0){
- out = 1;
- equal = 0;
- } else {
- equal = 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement