Ternary logic gates implemented in CMOS