-
-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Expand file tree
/
Copy pathbuffer_gate.py
More file actions
39 lines (30 loc) · 942 Bytes
/
buffer_gate.py
File metadata and controls
39 lines (30 loc) · 942 Bytes
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
"""
A Buffer Gate is a logic gate in boolean algebra which outputs the same value
as its input. It is used for signal isolation, increasing drive strength, or
introducing propagation delay in digital circuits.
In digital electronics, buffers are essential for:
- Isolating different circuit sections
- Increasing current drive capability
- Preventing signal degradation
- Creating intentional delays in timing circuits
Following is the truth table of a Buffer Gate:
----------------------
| Input | Output |
----------------------
| 0 | 0 |
| 1 | 1 |
----------------------
Refer - https://en.wikipedia.org/wiki/Digital_buffer
"""
def buffer_gate(input_1: int) -> int:
"""
Calculate output of a buffer gate
>>> buffer_gate(0)
0
>>> buffer_gate(1)
1
"""
return int(bool(input_1))
if __name__ == "__main__":
import doctest
doctest.testmod()