/* ----- mux: Illustrates the use of macros ----- */ Define MyMux i[3..0] c[1..0] | out; Not 1b c[0] not-c0; Not 2b c[1] not-c1; And 1c i[0] not-c1 not-c0 out-1; And 2c i[1] not-c1 c[0] out-2; And 3c i[2] c[1] not-c0 out-3; And 4c i[3] c[1] c[0] out-4; Or 3d out-1 out-2 out-3 out-4 out; Endef; /* ----- Set up circuit that uses "MyMux" ----- */ /* The inputs */ Switch 1a sw0 ZERO; Switch 2a sw1 ZERO; Switch 3a sw2 ZERO; Switch 4a sw3 ZERO; /* The controls */ Switch 6a sw4 ZERO; Switch 8a sw5 ZERO; MyMux 1b-4d sw3 sw2 sw1 sw0 sw4 sw5 | out; Probe 3e out;