The design of switching circuits