forked from SLaks/Silon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
652 lines (579 loc) · 37.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Silon – Adders & Logic Gates in Pure CSS</title>
<meta name="viewport" content="width=device-width" />
<link href="//fonts.googleapis.com/css?family=PT+Sans:400,400italic" rel="stylesheet" type="text/css" />
<link href="styles/layout.css" rel="stylesheet" />
<link href="styles/gate-theme.css" rel="stylesheet" />
<link href="styles/basic-gates.css" rel="stylesheet" />
<link href="styles/chained-adder.css" rel="stylesheet" />
<link href="styles/decimal-adder.css" rel="stylesheet" />
<meta name="theme-color" content="#3F51B5">
<meta name="msapplication-TileColor" content="#3F51B5">
<link rel="apple-touch-icon" sizes="57x57" href="/icons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/icons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/icons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/icons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/icons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/icons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/icons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/icons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/icons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/icons/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="/icons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/icons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="/icons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/icons/manifest.json">
<meta name="msapplication-TileImage" content="/icons/mstile-144x144.png">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3656687-6', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<nav>
<a href="#gates" id="gates" tabindex="1">Logic Gates</a>
<section>
<div class="ShrinkWrap">
<p>
<a href="http://en.wikipedia.org/wiki/Logic_gate">Logic gates</a> are the basis of all of computing. They take two binary inputs (0/1 or true/false), and result in a binary output whose value depends on the inputs. These gates form the building blocks upon which all computers are built.
</p>
<p>
Here are the three basic logic gates: AND (true only when both inputs are true), OR (true when either input is true), and XOR (eXclusive or, true only when exactly one input is true, but not both). Click the inputs (square boxes) to see the outputs reflect the values.
</p>
<ul class="CanvasList">
<li>
<h2>And Gate</h2>
<div class="Canvas" style="width: 9rem; height: 17rem;">
<input type="checkbox" id="simple-and-a" style="top: 0; left: 0;" />
<label for="simple-and-a" style="top: 0; left: 0;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 1.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 5rem; left: 1.5rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 5rem; left: 3.5rem; height: 2rem;"></div>
</div>
<input type="checkbox" id="simple-and-b" style="top: 0; left: 6rem;" />
<label for="simple-and-b" style="top: 0; left: 6rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 7.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 5rem; left: 5.5rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 5rem; left: 5.5rem; height: 2rem;"></div>
</div>
<div id="simple-and-gate" class="Gate AND" style="left: 2.5rem; top: 7rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 12rem; left: 4.5rem; height: 2rem;"></div>
<div class="Result" style="left: 3rem; top: 14rem;"></div>
</div>
</div>
</li>
<li>
<h2>Or Gate</h2>
<div class="Canvas" style="width: 9rem; height: 17rem;">
<input type="checkbox" id="simple-or-a" style="top: 0.5rem; left: 0;" />
<label for="simple-or-a" style="top: 0.5rem; left: 0;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3.5rem; left: 1.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 5.5rem; left: 1.5rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 5.5rem; left: 3.5rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 7.5rem; left: 3.5rem;"></div>
</div>
<input type="checkbox" id="simple-or-b" style="top: 0.5rem; left: 6rem;" />
<label for="simple-or-b" style="top: 0.5rem; left: 6rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3.5rem; left: 7.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 5.5rem; left: 5.5rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 5.5rem; left: 5.5rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 7.5rem; left: 5.5rem;"></div>
</div>
<div id="simple-or-gate" class="Gate OR" style="left: 2.5rem; top: 7.5rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 11.5rem; left: 4.5rem; height: 2rem;"></div>
<div class="Result" style="left: 3rem; top: 13.5rem;"></div>
</div>
</div>
</li>
<li>
<h2>XOR Gate</h2>
<div class="Canvas" style="width: 9rem; height: 17rem;">
<input type="checkbox" id="simple-xor-a" style="top: 0; left: 0;" />
<label for="simple-xor-a" style="top: 0; left: 0;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 1.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 5rem; left: 1.5rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 5rem; left: 3.5rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 7rem; left: 3.5rem;"></div>
</div>
<input type="checkbox" id="simple-xor-b" style="top: 0; left: 6rem;" />
<label for="simple-xor-b" style="top: 0; left: 6rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 7.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 5rem; left: 5.5rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 5rem; left: 5.5rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 7rem; left: 5.5rem;"></div>
</div>
<div id="simple-xor-gate" class="Gate XOR" style="left: 2.5rem; top: 7rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 12rem; left: 4.5rem; height: 2rem;"></div>
<div class="Result" style="left: 3rem; top: 14rem;"></div>
</div>
</div>
</li>
</ul>
</div>
</section>
<a href="#half-adder" id="half-adder" tabindex="2">Half Adder</a>
<section>
<div class="ShrinkWrap">
<p>
A <a href="http://en.wikipedia.org/wiki/Adder_%28electronics%29#Half_adder">half adder</a> adds two binary digits, returning the result (either 0, 1, or 10) in its two outputs. The two outputs are called the carry (the tens digit) and the sum (the ones digit); the carry can be chained into a full adder to add more inputs.
</p>
<div class="Canvas" style="width: 12.5rem; height: 21rem;">
<input type="checkbox" id="half-adder-a" style="top: 0; left: 3.5rem;" />
<label for="half-adder-a" style="top: 0; left: 3.5rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 5rem; left: 5rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 5rem; left: 7rem; height: 6rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 11rem; left: 7rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 7rem; left: 1rem; width: 6rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 7rem; left: 1rem; height: 4rem;"></div>
</div>
<input type="checkbox" id="half-adder-b" style="top: 0; left: 9.5rem;" />
<label for="half-adder-b" style="top: 0; left: 9.5rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 11rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 5rem; left: 9rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 5rem; left: 9rem; height: 6rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 11rem; left: 9rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 9rem; left: 3rem; width: 6rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 9rem; left: 3rem; height: 2rem;"></div>
</div>
<div id="half-adder-xor-gate" class="Gate XOR" style="left: 6rem; top: 11rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 16rem; left: 8rem; height: 2rem;"></div>
<div class="Result" style="left: 6.5rem; top: 18rem;"></div>
</div>
<div id="half-adder-and-gate" class="Gate AND" style="left: 0; top: 11rem;"></div>
<div class="Group">
<div class="Connector Vertical" style="top: 16rem; left: 2rem; height: 2rem;"></div>
<div class="Result" style="left: 0.5rem; top: 18rem;"></div>
</div>
</div>
</div>
</section>
<a href="#full-adder" id="full-adder" tabindex="3">Full Adder</a>
<section>
<div class="ShrinkWrap">
<p>
A <a href="http://en.wikipedia.org/wiki/Adder_%28electronics%29#Full_adder">full adder</a> adds three binary digits, returning the result (0, 1, 10, or 11) in its two outputs. The two outputs are called the carry-out (the tens digit) and the sum (the ones digit); the carry can be chained to another full adder to add more inputs. The first input (which a carry-out can be chained to) is called the carry-in; the other two are usually called A and B (this designation is arbitrary; the inputs are completely symmetric).
</p>
<div class="Canvas" style="width: 21rem; height: 42rem;">
<input type="checkbox" id="full-adder-carry" style="top: 0; left: 6rem;" />
<label for="full-adder-carry" style="top: 0; left: 6rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 7.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 5rem; left: 7.5rem; width: 4rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 5rem; left: 11.5rem; height: 13rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 18rem; left: 11.5rem; width: 1.5rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 18rem; left: 13rem; height: 6rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 24rem; left: 13rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 20rem; left: 7rem; width: 6rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 20rem; left: 7rem; height: 4rem;"></div>
</div>
<input type="checkbox" id="full-adder-a" style="top: 0; left: 12rem;" />
<label for="full-adder-a" style="top: 0; left: 12rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 13.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 5rem; left: 13.5rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 5rem; left: 15.5rem; height: 6rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 11rem; left: 15.5rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 7rem; left: 1rem; width: 14.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 7rem; left: 1rem; height: 17rem;"></div>
</div>
<input type="checkbox" id="full-adder-b" style="top: 0; left: 18rem;" />
<label for="full-adder-b" style="top: 0; left: 18rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 19.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 5rem; left: 17.5rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 5rem; left: 17.5rem; height: 6rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 11rem; left: 17.5rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 9rem; left: 3rem; width: 14.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 9rem; left: 3rem; height: 15rem;"></div>
</div>
<div id="full-adder-xor-gate-input" class="Gate XOR" style="left: 14.5rem; top: 11rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 16rem; left: 16.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 18rem; left: 15rem; width: 1.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 18rem; left: 15rem; height: 6rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 24rem; left: 15rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 22rem; left: 9rem; width: 6rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 22rem; left: 9rem; height: 2rem;"></div>
</div>
<div id="full-adder-xor-gate-carry" class="Gate XOR" style="left: 12rem; top: 24rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 29rem; left: 14rem; height: 10rem;"></div>
<div class="Result" style="left: 12.5rem; top: 39rem;"></div>
</div>
<div id="full-adder-and-gate-input" class="Gate AND" style="left: 0; top: 24rem;"></div>
<div class="Group">
<div class="Connector Vertical" style="top: 29rem; left: 2rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 31rem; left: 2rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 31rem; left: 4rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 33rem; left: 4rem;"></div>
</div>
<div id="full-adder-and-gate-sum" class="Gate AND" style="left: 6rem; top: 24rem;"></div>
<div class="Group">
<div class="Connector Vertical" style="top: 29rem; left: 8rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 31rem; left: 6rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 31rem; left: 6rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 33rem; left: 6rem;"></div>
</div>
<div id="full-adder-or-gate-carry-out" class="Gate OR" style="left: 3rem; top: 33rem;">
<span></span>
<span></span>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 37rem; left: 5rem; height: 2rem;"></div>
<div class="Result" style="left: 3.5rem; top: 39rem;"></div>
</div>
</div>
</div>
</section>
<a href="#chained-adder" id="chained-adder" tabindex="4">Chained Adder</a>
<section>
<div>
<p>
Here are four full adders chained together. These adders add two four-digit binary numbers (0 – 15), formed by the upper row of inputs and the lower row of inputs, resulting in the five digit binary number (which will always be ≤ 30) formed by the row of outputs at the bottom.
</p><p> The carry-out of each adder connects to the carry-in of the next adder, forming the chain (as opposed to the single full-adder, where both the carry-in and the carry-out are directly drawn). The right-most adder is a simple half-adder, since there is no carry-in to incorporate. The carry-out from the left-most adder is drawn directly as the most significant digit of the output, since there is no further adder to carry to.</p>
<div class="Canvas" style="width: 75rem; height: 44rem;">
<input type="checkbox" id="chained-adder-1-a" tabindex="47" style="top: 0; left: 68.5rem;" />
<label for="chained-adder-1-a" style="top: 0; left: 68.5rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 70rem; height: 23rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 26rem; left: 70rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 9rem; left: 64rem; width: 6rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 9rem; left: 64rem; height: 17rem;"></div>
</div>
<input type="checkbox" id="chained-adder-1-b" tabindex="48" style="top: 4rem; left: 71.5rem;" />
<label for="chained-adder-1-b" style="top: 4rem; left: 71.5rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 7rem; left: 73rem; height: 4rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 11rem; left: 66rem; width: 7rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 11rem; left: 66rem; height: 15rem;"></div>
<div class="Connector Vertical Junction Top" style="top: 11rem; left: 72rem; height: 15rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 26rem; left: 72rem;"></div>
</div>
<div id="chained-adder-1-xor-gate-sum" class="Gate XOR" style="left: 69rem; top: 26rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 71rem; height: 10rem;"></div>
<div class="Result" style="left: 69.5rem; top: 41rem;"></div>
</div>
<div id="chained-adder-1-gate-carry-out" class="Gate AND" style="left: 63rem; top: 26rem;">
<span></span>
<span></span>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 65rem; height: 10rem;"></div>
<div class="Connector Horizontal Corner Up Right" style="top: 41rem; left: 58rem; width: 7rem;"></div>
<div class="Connector Vertical Corner Right Bottom" style="top: 22rem; left: 58rem; height: 19rem;"></div>
<div class="Connector Horizontal Corner Down Right" style="top: 22rem; left: 47rem; width: 11rem; z-index: 2"></div>
<div class="Connector Vertical Corner Right" style="top: 22rem; left: 47rem; height: 4rem; z-index: 2"></div>
<div class="Connector Vertical Junction Top" style="top: 22rem; left: 53rem; height: 4rem; z-index: 2"></div>
<div class="Connector Vertical Convex Left" style="top: 26rem; left: 53rem;"></div>
</div>
<input type="checkbox" id="chained-adder-2-a" tabindex="45" style="top: 0; left: 54rem;" />
<label for="chained-adder-2-a" style="top: 0; left: 54rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 55.5rem; height: 10rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 13rem; left: 55.5rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 9rem; left: 41rem; width: 14.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 9rem; left: 41rem; height: 17rem;"></div>
</div>
<input type="checkbox" id="chained-adder-2-b" tabindex="46" style="top: 4rem; left: 57rem;" />
<label for="chained-adder-2-b" style="top: 4rem; left: 57rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 7rem; left: 58.5rem; height: 4rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 11rem; left: 43rem; width: 15.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 11rem; left: 43rem; height: 15rem;"></div>
<div class="Connector Vertical Junction Top" style="top: 11rem; left: 57.5rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 13rem; left: 57.5rem;"></div>
</div>
<div id="chained-adder-2-xor-gate-input" class="Gate XOR" style="left: 54.5rem; top: 13rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 18rem; left: 56.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 20rem; left: 55rem; width: 1.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 20rem; left: 55rem; height: 6rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 26rem; left: 55rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 24rem; left: 49rem; width: 6rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 24rem; left: 49rem; height: 2rem;"></div>
</div>
<div id="chained-adder-2-xor-gate-carry" class="Gate XOR" style="left: 52rem; top: 26rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 54rem; height: 10rem;"></div>
<div class="Result" style="left: 52.5rem; top: 41rem;"></div>
</div>
<div id="chained-adder-2-and-gate-input" class="Gate AND" style="left: 40rem; top: 26rem;"></div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 42rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 33rem; left: 42rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 33rem; left: 44rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 35rem; left: 44rem;"></div>
</div>
<div id="chained-adder-2-and-gate-sum" class="Gate AND" style="left: 46rem; top: 26rem;"></div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 48rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 33rem; left: 46rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 33rem; left: 46rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 35rem; left: 46rem;"></div>
</div>
<div id="chained-adder-2-or-gate-carry-out" class="Gate OR" style="left: 43rem; top: 35rem;">
<span></span>
<span></span>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 39rem; left: 45rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Up Right" style="top: 41rem; left: 38rem; width: 7rem;"></div>
<div class="Connector Vertical Corner Right Bottom" style="top: 22rem; left: 38rem; height: 19rem;"></div>
<div class="Connector Horizontal Corner Down Right" style="top: 22rem; left: 27rem; width: 11rem; z-index: 2"></div>
<div class="Connector Vertical Corner Right" style="top: 22rem; left: 27rem; height: 4rem; z-index: 2"></div>
<div class="Connector Vertical Junction Top" style="top: 22rem; left: 33rem; height: 4rem; z-index: 2"></div>
<div class="Connector Vertical Convex Left" style="top: 26rem; left: 33rem;"></div>
</div>
<input type="checkbox" id="chained-adder-3-a" tabindex="43" style="top: 0; left: 34rem;" />
<label for="chained-adder-3-a" style="top: 0; left: 34rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 35.5rem; height: 10rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 13rem; left: 35.5rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 9rem; left: 21rem; width: 14.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 9rem; left: 21rem; height: 17rem;"></div>
</div>
<input type="checkbox" id="chained-adder-3-b" tabindex="44" style="top: 4rem; left: 37rem;" />
<label for="chained-adder-3-b" style="top: 4rem; left: 37rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 7rem; left: 38.5rem; height: 4rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 11rem; left: 23rem; width: 15.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 11rem; left: 23rem; height: 15rem;"></div>
<div class="Connector Vertical Junction Top" style="top: 11rem; left: 37.5rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 13rem; left: 37.5rem;"></div>
</div>
<div id="chained-adder-3-xor-gate-input" class="Gate XOR" style="left: 34.5rem; top: 13rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 18rem; left: 36.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 20rem; left: 35rem; width: 1.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 20rem; left: 35rem; height: 6rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 26rem; left: 35rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 24rem; left: 29rem; width: 6rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 24rem; left: 29rem; height: 2rem;"></div>
</div>
<div id="chained-adder-3-xor-gate-carry" class="Gate XOR" style="left: 32rem; top: 26rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 34rem; height: 10rem;"></div>
<div class="Result" style="left: 32.5rem; top: 41rem;"></div>
</div>
<div id="chained-adder-3-and-gate-input" class="Gate AND" style="left: 20rem; top: 26rem;"></div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 22rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 33rem; left: 22rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 33rem; left: 24rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 35rem; left: 24rem;"></div>
</div>
<div id="chained-adder-3-and-gate-sum" class="Gate AND" style="left: 26rem; top: 26rem;"></div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 28rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 33rem; left: 26rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 33rem; left: 26rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 35rem; left: 26rem;"></div>
</div>
<div id="chained-adder-3-or-gate-carry-out" class="Gate OR" style="left: 23rem; top: 35rem;">
<span></span>
<span></span>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 39rem; left: 25rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Up Right" style="top: 41rem; left: 18rem; width: 7rem;"></div>
<div class="Connector Vertical Corner Right Bottom" style="top: 22rem; left: 18rem; height: 19rem;"></div>
<div class="Connector Horizontal Corner Down Right" style="top: 22rem; left: 7rem; width: 11rem; z-index: 2"></div>
<div class="Connector Vertical Corner Right" style="top: 22rem; left: 7rem; height: 4rem; z-index: 2"></div>
<div class="Connector Vertical Junction Top" style="top: 22rem; left: 13rem; height: 4rem; z-index: 2"></div>
<div class="Connector Vertical Convex Left" style="top: 26rem; left: 13rem;"></div>
</div>
<input type="checkbox" id="chained-adder-4-a" tabindex="41" style="top: 0; left: 14rem;" />
<label for="chained-adder-4-a" style="top: 0; left: 14rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 3rem; left: 15.5rem; height: 10rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 13rem; left: 15.5rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 9rem; left: 1rem; width: 14.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 9rem; left: 1rem; height: 17rem;"></div>
</div>
<input type="checkbox" id="chained-adder-4-b" tabindex="42" style="top: 4rem; left: 17rem;" />
<label for="chained-adder-4-b" style="top: 4rem; left: 17rem;"></label>
<div class="Group">
<div class="Connector Vertical" style="top: 7rem; left: 18.5rem; height: 4rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 11rem; left: 3rem; width: 15.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 11rem; left: 3rem; height: 15rem;"></div>
<div class="Connector Vertical Junction Top" style="top: 11rem; left: 17.5rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 13rem; left: 17.5rem;"></div>
</div>
<div id="chained-adder-4-xor-gate-input" class="Gate XOR" style="left: 14.5rem; top: 13rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 18rem; left: 16.5rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 20rem; left: 15rem; width: 1.5rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 20rem; left: 15rem; height: 6rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 26rem; left: 15rem;"></div>
<div class="Connector Horizontal Junction Right" style="top: 24rem; left: 9rem; width: 6rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 24rem; left: 9rem; height: 2rem;"></div>
</div>
<div id="chained-adder-4-xor-gate-carry" class="Gate XOR" style="left: 12rem; top: 26rem;">
<span></span>
<span></span>
<div></div>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 14rem; height: 10rem;"></div>
<div class="Result" style="left: 12.5rem; top: 41rem;"></div>
</div>
<div id="chained-adder-4-and-gate-input" class="Gate AND" style="left: 0; top: 26rem;"></div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 2rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Left Up" style="top: 33rem; left: 2rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Left" style="top: 33rem; left: 4rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Left" style="top: 35rem; left: 4rem;"></div>
</div>
<div id="chained-adder-4-and-gate-sum" class="Gate AND" style="left: 6rem; top: 26rem;"></div>
<div class="Group">
<div class="Connector Vertical" style="top: 31rem; left: 8rem; height: 2rem;"></div>
<div class="Connector Horizontal Corner Right Up" style="top: 33rem; left: 6rem; width: 2rem;"></div>
<div class="Connector Vertical Corner Right" style="top: 33rem; left: 6rem; height: 2rem;"></div>
<div class="Connector Vertical Convex Right" style="top: 35rem; left: 6rem;"></div>
</div>
<div id="chained-adder-4-or-gate-carry-out" class="Gate OR" style="left: 3rem; top: 35rem;">
<span></span>
<span></span>
</div>
<div class="Group">
<div class="Connector Vertical" style="top: 39rem; left: 5rem; height: 2rem;"></div>
<div class="Result" style="left: 3.5rem; top: 41rem;"></div>
</div>
</div>
</div>
</section>
<a href="#decimal-adder" id="decimal-adder" tabindex="5">Decimal Adder</a>
<section>
<div class="ShrinkWrap">
<p>
This has nothing to do with logic gates, but it's still a cool demo. Click any binary digit toggle between 1 and 0.
The sum of the two numbers will be computed – in pure CSS – and displayed in decimal form below.
</p>
<div class="DecimalAdder">
<input type="checkbox" id="decimal-adder-a-4" /><div></div>
<label for="decimal-adder-a-4"></label>
<input type="checkbox" id="decimal-adder-a-3" /><div></div>
<label for="decimal-adder-a-3"></label>
<input type="checkbox" id="decimal-adder-a-2" /><div></div>
<label for="decimal-adder-a-2"></label>
<input type="checkbox" id="decimal-adder-a-1" /><div></div>
<label for="decimal-adder-a-1"></label>
<input type="checkbox" id="decimal-adder-a-0" /><div></div>
<label for="decimal-adder-a-0"></label>
<input type="checkbox" id="decimal-adder-b-4" /><div></div>
<label for="decimal-adder-b-4"></label>
<input type="checkbox" id="decimal-adder-b-3" /><div></div>
<label for="decimal-adder-b-3"></label>
<input type="checkbox" id="decimal-adder-b-2" /><div></div>
<label for="decimal-adder-b-2"></label>
<input type="checkbox" id="decimal-adder-b-1" /><div></div>
<label for="decimal-adder-b-1"></label>
<input type="checkbox" id="decimal-adder-b-0" /><div></div>
<label for="decimal-adder-b-0"></label>
</div>
</div>
</section>
<section class="DefaultTab">
<div class="ShrinkWrap">
<h1>Silon</h1>
<h2>Implementing logic gates and adders in pure CSS</h2>
<p>
Silon is an experiment demonstrating the power of CSS selectors. Using
<a href="http://lesscss.org">LESS</a> to generate selectors from declared
logical operations, I implemented simple <a href="http://en.wikipedia.org/wiki/Logic_gate">logic gates</a>,
as well as <a href="http://en.wikipedia.org/wiki/Adder_%28electronics%29">half- and full- adders</a>.
</p>
<p>To get started, click a tab above.</p>
<p>To see how it works, see the <a href="https://github.com/SLaks/Silon#readme">readme</a> on GitHub.</p>
</div>
</section>
</nav>
<ul class="IconList">
<li>
<a title="Tweet about Silon" target="_blank" tabindex="8"
href="https://twitter.com/intent/tweet?related=Schabse&text=Check+out+Silon+by+%40Schabse+–+interactive+logic+gates+%26+adders+in+pure+CSS.+http%3A%2F%2Fsilon.slaks.net">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 1625.36">
<path fill="#00aced" d="M2000 192.4c-73.6 32.6-152.7 54.7-235.7 64.6 84.7-50.8 149.8-131.2 180.4-227-79.2 47-167 81.2-260.5 99.6C1609.2 49.8 1502.7 0 1384.7 0 1158 0 974.4 183.7 974.4 410.3c0 32.2 3.6 63.5 10.6 93.5-341-17-643.4-180.5-845.8-428.7-35.2 61-55.5 132-55.5 207 0 142.6 72.4 268 182.5 341.7-67.2-2-130.5-20.6-185.8-51.3v5c0 198.8 141.4 364.6 329 402.3-34.3 9.6-70.6 14.6-108 14.6-26.5 0-52.2-2.7-77.2-7.5 52.2 163 203.7 281.8 383.3 285C467 1381 290 1446.8 98 1446.8c-33.2 0-66-2-98-5.7 181.6 117 397.3 185 629 185 754.7 0 1167.5-625 1167.5-1167.2 0-18-.5-35.5-1.2-53 80-58 149.7-130 204.7-212.5" />
</svg>
</a>
</li>
<li>
<a title="Open source & documentation on GitHub" href="https://github.com/SLaks/Silon" target="_blank" tabindex="9">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1163 1657.7 56.69 56.69">
<path fill-rule="evenodd" d="M-1134.66 1662.92c-13.6 0-24.63 11.02-24.63 24.63 0 10.88 7.1 20.1 16.9 23.37 1.3.23 1.7-.54 1.7-1.2v-4.57c-6.82 1.5-8.3-2.9-8.3-2.9-1.1-2.86-2.7-3.6-2.7-3.6-2.22-1.54.18-1.5.18-1.5 2.48.16 3.78 2.53 3.78 2.53 2.2 3.76 5.8 2.67 7.2 2.05.2-1.6.85-2.68 1.56-3.3-5.5-.62-11.24-2.73-11.24-12.17 0-2.7.97-4.9 2.54-6.6-.27-.63-1.1-3.14.22-6.53 0 0 2.07-.66 6.78 2.53 1.97-.55 4.08-.82 6.17-.83 2.1 0 4.2.28 6.17.83 4.7-3.2 6.78-2.53 6.78-2.53 1.35 3.4.5 5.9.25 6.52 1.6 1.72 2.54 3.92 2.54 6.6 0 9.47-5.74 11.55-11.22 12.16.9.8 1.7 2.3 1.7 4.6 0 3.3-.04 6-.04 6.8 0 .7.44 1.48 1.7 1.2 9.77-3.22 16.8-12.5 16.8-23.32 0-13.6-11-24.63-24.6-24.63z" clip-rule="evenodd" />
<path d="M-1149.96 1698.28c-.06.12-.25.16-.42.07-.18-.08-.28-.24-.22-.37.05-.12.24-.16.42-.07.18.1.28.3.22.4zm1 1.12c-.12.1-.35.05-.5-.12-.17-.17-.2-.4-.08-.5.12-.12.35-.07.5.1.17.17.2.4.08.5zm.96 1.4c-.14.12-.4.02-.54-.2-.15-.22-.15-.48 0-.6.15-.1.4 0 .55.22.2.22.2.48 0 .6zm1.34 1.38c-.14.15-.42.1-.63-.1-.2-.2-.2-.47-.1-.62.2-.15.5-.1.7.1.25.2.3.47.17.62zm1.83.8c-.06.2-.33.28-.6.2-.3-.1-.47-.32-.42-.5.06-.2.34-.3.62-.2.28.08.46.3.4.5zm2.03.14c0 .2-.24.38-.53.38-.3 0-.54-.16-.54-.36 0-.2.23-.37.53-.38.3 0 .53.16.53.36zm1.86-.32c.04.2-.16.4-.45.46-.2.05-.5-.07-.5-.27s.2-.4.5-.5c.3-.1.55 0 .58.2zm0 0" />
</svg>
</a>
</li>
</ul>
</body>
</html>