component match8 "8-bit binary match detector";
pin in bit in = true "cascade input - if false, output is false regardless of other inputs";
pin in bit a0;
pin in bit a1;
pin in bit a2;
pin in bit a3;
pin in bit a4;
pin in bit a5;
pin in bit a6;
pin in bit a7;
pin in bit b0;
pin in bit b1;
pin in bit b2;
pin in bit b3;
pin in bit b4;
pin in bit b5;
pin in bit b6;
pin in bit b7;
pin out bit out "true only if in is true and a[m] matches b[m] for m = 0 thru 7";
function _ nofp;
license "GPL";
;;
FUNCTION(_)
{
    hal_bit_t tmp = false;

    if ( !in ) goto nomatch;
    if (( a0 && !b0 ) || ( !a0 && b0 )) goto nomatch;
    if (( a1 && !b1 ) || ( !a1 && b1 )) goto nomatch;
    if (( a2 && !b2 ) || ( !a2 && b2 )) goto nomatch;
    if (( a3 && !b3 ) || ( !a3 && b3 )) goto nomatch;
    if (( a4 && !b4 ) || ( !a4 && b4 )) goto nomatch;
    if (( a5 && !b5 ) || ( !a5 && b5 )) goto nomatch;
    if (( a6 && !b6 ) || ( !a6 && b6 )) goto nomatch;
    if (( a7 && !b7 ) || ( !a7 && b7 )) goto nomatch;
    tmp = true;
nomatch:
    out = tmp;

return 0;
}
