* SPICE netlist
A1 N010 0 0 0 N016 0 N013 0 AND vhigh 5V trise 1e-6 tfall 1e-6
A6 N009 0 0 0 0 N010 0 0 BUF vhigh 5V trise 1e-6 tfall 1e-6
S2 N025 N007 N023 0 SW
S1 N025 N005 N021 0 SW
S3 N025 N003 N019 0 SW
S4 N025 N001 N013 0 SW
V2 N009 0 PULSE(0 5 0 1e-7 1e-7 1e-2 2e-2)
V3 N007 0 SINE(0 1 4000)
V4 N005 0 SINE(0 1 3000)
V5 N003 0 SINE(0 1 2000)
V6 N001 0 SINE(0 1 1000)
A2 N016 0 0 0 N009 0 N019 0 AND vhigh 5V trise 1e-6 tfall 1e-6
A3 N010 0 0 0 N015 0 N021 0 AND vhigh 5V trise 1e-6 tfall 1e-6
A4 N009 0 0 0 N015 0 N023 0 AND vhigh 5V trise 1e-6 tfall 1e-6
A5 N015 0 0 0 0 N016 0 0 BUF vhigh 5V trise 1e-6 tfall 1e-6
V1 N015 0 PULSE(0 5 0 1e-7 1e-7 2e-2 4e-2)
A7 N011 0 0 0 N017 0 N014 0 AND vhigh 5V trise 1e-6 tfall 1e-6
A8 N012 0 0 0 0 N011 0 0 BUF vhigh 5V trise 1e-6 tfall 1e-6
S5 N025 N008 N024 0 SW
S6 N025 N006 N022 0 SW
S7 N025 N004 N020 0 SW
S8 N025 N002 N014 0 SW
V7 N012 0 PULSE(0 5 0 1e-7 1e-7 1e-2 2e-2)
A9 N017 0 0 0 N012 0 N020 0 AND vhigh 5V trise 1e-6 tfall 1e-6
A10 N011 0 0 0 N018 0 N022 0 AND vhigh 5V trise 1e-6 tfall 1e-6
A11 N012 0 0 0 N018 0 N024 0 AND vhigh 5V trise 1e-6 tfall 1e-6
A12 N018 0 0 0 0 N017 0 0 BUF vhigh 5V trise 1e-6 tfall 1e-6
V12 N018 0 PULSE(0 5 0 1e-7 1e-7 2e-2 4e-2)
R1 N008 0 10k
R2 N006 0 10k
R3 N004 0 10k
R4 N002 0 10k
R5 N025 0 10K
.tran .1

* LTspice schematic (.asc)
Version 4
SHEET 1 2928 768
WIRE -152 -384 -1464 -384
WIRE 1336 -384 104 -384
WIRE 1464 -384 1336 -384
WIRE -280 -352 -1368 -352
WIRE 1256 -352 232 -352
WIRE 1464 -352 1256 -352
WIRE -408 -320 -1272 -320
WIRE 1160 -320 360 -320
WIRE 1464 -320 1160 -320
WIRE -536 -288 -1176 -288
WIRE 1064 -288 488 -288
WIRE 1464 -288 1064 -288
WIRE -872 -240 -1000 -240
WIRE -792 -240 -808 -240
WIRE -696 -240 -792 -240
WIRE -152 -240 -152 -384
WIRE 104 -240 104 -384
WIRE 744 -240 648 -240
WIRE 760 -240 744 -240
WIRE 952 -240 824 -240
WIRE -200 -224 -632 -224
WIRE 584 -224 152 -224
WIRE -872 -176 -904 -176
WIRE -760 -176 -808 -176
WIRE -696 -176 -760 -176
WIRE 712 -176 648 -176
WIRE 760 -176 712 -176
WIRE 856 -176 824 -176
WIRE -760 -144 -760 -176
WIRE -696 -144 -760 -144
WIRE -280 -144 -280 -352
WIRE 232 -144 232 -352
WIRE 712 -144 712 -176
WIRE 712 -144 648 -144
WIRE -328 -128 -632 -128
WIRE 584 -128 280 -128
WIRE -1000 -80 -1000 -240
WIRE -696 -80 -1000 -80
WIRE 952 -80 952 -240
WIRE 952 -80 648 -80
WIRE -792 -48 -792 -240
WIRE -696 -48 -792 -48
WIRE -408 -48 -408 -320
WIRE 360 -48 360 -320
WIRE 744 -48 744 -240
WIRE 744 -48 648 -48
WIRE -456 -32 -632 -32
WIRE 584 -32 408 -32
WIRE -904 16 -904 -176
WIRE -696 16 -904 16
WIRE 856 16 856 -176
WIRE 856 16 648 16
WIRE -1000 48 -1000 -80
WIRE -696 48 -1000 48
WIRE -536 48 -536 -288
WIRE 488 48 488 -288
WIRE 952 48 952 -80
WIRE 952 48 648 48
WIRE -584 64 -632 64
WIRE 584 64 536 64
WIRE -904 112 -904 16
WIRE -696 112 -904 112
WIRE 856 112 856 16
WIRE 856 112 648 112
WIRE -536 144 -536 128
WIRE -408 144 -408 32
WIRE -408 144 -536 144
WIRE -280 144 -280 -64
WIRE -280 144 -408 144
WIRE -152 144 -152 -160
WIRE -152 144 -280 144
WIRE -120 144 -152 144
WIRE 104 144 104 -160
WIRE 104 144 -120 144
WIRE 232 144 232 -64
WIRE 232 144 104 144
WIRE 360 144 360 32
WIRE 360 144 232 144
WIRE 488 144 488 128
WIRE 488 144 360 144
WIRE -1464 160 -1464 -384
WIRE -1368 160 -1368 -352
WIRE -1272 160 -1272 -320
WIRE -1176 160 -1176 -288
WIRE -1000 160 -1000 48
WIRE -904 160 -904 112
WIRE 856 160 856 112
WIRE 952 160 952 48
WIRE 1064 160 1064 -288
WIRE 1160 160 1160 -320
WIRE 1256 160 1256 -352
WIRE 1336 160 1336 -384
WIRE -120 176 -120 144
WIRE -1464 288 -1464 240
WIRE -1368 288 -1368 240
WIRE -1368 288 -1464 288
WIRE -1272 288 -1272 240
WIRE -1272 288 -1368 288
WIRE -1176 288 -1176 240
WIRE -1176 288 -1272 288
WIRE -1000 288 -1000 240
WIRE -1000 288 -1176 288
WIRE -904 288 -904 240
WIRE -904 288 -1000 288
WIRE -584 288 -584 112
WIRE -584 288 -904 288
WIRE -456 288 -456 16
WIRE -456 288 -584 288
WIRE -328 288 -328 -80
WIRE -328 288 -456 288
WIRE -200 288 -200 -176
WIRE -200 288 -328 288
WIRE -120 288 -120 256
WIRE -120 288 -200 288
WIRE 152 288 152 -176
WIRE 152 288 -120 288
WIRE 280 288 280 -80
WIRE 280 288 152 288
WIRE 408 288 408 16
WIRE 408 288 280 288
WIRE 536 288 536 112
WIRE 536 288 408 288
WIRE 856 288 856 240
WIRE 856 288 536 288
WIRE 952 288 952 240
WIRE 952 288 856 288
WIRE 1064 288 1064 240
WIRE 1064 288 952 288
WIRE 1160 288 1160 240
WIRE 1160 288 1064 288
WIRE 1256 288 1256 240
WIRE 1256 288 1160 288
WIRE 1336 288 1336 240
WIRE 1336 288 1256 288
WIRE -1464 384 -1464 288
FLAG -1464 384 0
SYMBOL Digital\\and -664 -272 R0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A1
SYMBOL Digital\\inv -872 -304 R0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A6
SYMBOL sw -536 144 M180
SYMATTR InstName S2
SYMBOL sw -408 48 M180
SYMATTR InstName S1
SYMBOL sw -280 -48 M180
SYMATTR InstName S3
SYMBOL sw -152 -144 M180
SYMATTR InstName S4
SYMBOL voltage -1000 144 R0
SYMATTR Value PULSE(0 5 0 1e-7 1e-7 1e-2 2e-2)
SYMATTR InstName V2
SYMBOL voltage -1176 144 R0
SYMATTR Value SINE(0 1 4000)
SYMATTR InstName V3
SYMBOL voltage -1272 144 R0
SYMATTR Value SINE(0 1 3000)
SYMATTR InstName V4
SYMBOL voltage -1368 144 R0
SYMATTR Value SINE(0 1 2000)
SYMATTR InstName V5
SYMBOL voltage -1464 144 R0
SYMATTR Value SINE(0 1 1000)
SYMATTR InstName V6
SYMBOL Digital\\and -664 -176 R0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A2
SYMBOL Digital\\and -664 -80 R0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A3
SYMBOL Digital\\and -664 16 R0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A4
SYMBOL Digital\\inv -872 -240 R0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A5
SYMBOL voltage -904 144 R0
SYMATTR Value PULSE(0 5 0 1e-7 1e-7 2e-2 4e-2)
SYMATTR InstName V1
SYMBOL Digital\\and 616 -272 M0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A7
SYMBOL Digital\\inv 824 -304 M0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A8
SYMBOL sw 488 144 R180
SYMATTR InstName S5
SYMBOL sw 360 48 R180
SYMATTR InstName S6
SYMBOL sw 232 -48 R180
SYMATTR InstName S7
SYMBOL sw 104 -144 R180
SYMATTR InstName S8
SYMBOL voltage 952 144 M0
SYMATTR Value PULSE(0 5 0 1e-7 1e-7 1e-2 2e-2)
SYMATTR InstName V7
SYMBOL Digital\\and 616 -176 M0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A9
SYMBOL Digital\\and 616 -80 M0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A10
SYMBOL Digital\\and 616 16 M0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A11
SYMBOL Digital\\inv 824 -240 M0
SYMATTR Value vhigh 5V trise 1e-6 tfall 1e-6
SYMATTR InstName A12
SYMBOL voltage 856 144 M0
SYMATTR Value PULSE(0 5 0 1e-7 1e-7 2e-2 4e-2)
SYMATTR InstName V12
SYMBOL res 1048 144 R0
SYMATTR InstName R1
SYMATTR Value 10k
SYMBOL res 1144 144 R0
SYMATTR InstName R2
SYMATTR Value 10k
SYMBOL res 1240 144 R0
SYMATTR InstName R3
SYMATTR Value 10k
SYMBOL res 1320 144 R0
SYMATTR InstName R4
SYMATTR Value 10k
SYMBOL res -136 160 R0
SYMATTR InstName R5
SYMATTR Value 10K