eifueo/docs/1b/ece124.md

71 lines
2.4 KiB
Markdown
Raw Normal View History

2023-01-09 08:23:07 -05:00
# ECE 124: Digital Circuits
2023-01-11 15:28:39 -05:00
## Base / radix conversion
Please see [ECE 150: C++#Non-decimal numbers](/1a/ece150/#non-decimal numbers) for more information.
2023-01-12 11:28:05 -05:00
## Binary logic
2023-01-11 15:28:39 -05:00
2023-01-12 11:28:05 -05:00
A **binary logic variable** is a variable that has exactly two states:
- 0, or false (switch open)
- 1, or true (switch closed)
**Binary logic functions** are any function that satisfies the following type signature:
```python
BoolFunc = Callable[[bool | BoolFunc, ...], bool]
```
In other words:
- it must accept a number of booleans and/or other logic functions, and
- it must return exactly one boolean.
These can be expressed via truth table inputs/outputs, algebraically, or via a logical circuit schematic.
### Logical operators
Operator precedence is () > NOT > AND > OR.
The **AND** operator returns true if and only if **all** arguments are true.
$$A\cdot B \text{ or }AB$$
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b9/AND_ANSI_Labelled.svg" width=200>(Source: Wikimedia Commons)
The **OR** operator returns true if and only if **at least one** argument is true.
$$A+B$$
<img src="https://upload.wikimedia.org/wikipedia/commons/1/16/OR_ANSI_Labelled.svg" align="middle" width=200>(Source: Wikimedia Commons)</img>
The **NOT** operator returns the opposite of its singular input.
$$\overline A \text{ or } A'$$
<img src="https://upload.wikimedia.org/wikipedia/commons/6/60/NOT_ANSI_Labelled.svg" width=200>(Source: Wikimedia Commons)</img>
2023-01-13 11:21:04 -05:00
### Postulates
In binary algebra, if $x,y,z\in\mathbb B$ such that $\mathbb B=\{0, 1\}$:
The **identity element** for **AND** $1$ is such that any $x\cdot 1 = x$.
The **identity element** for **OR** $0$ is such that any $x + 0 = x$.
In this space, it can be deduced that $x+x'=1$ and $x\cdot x'=0$.
**De Morgan's laws** are much easier to express in boolean algebra, and denote distributing a negation by flipping the operator:
$$
(x\cdot y)'=x'+y' \\
(x+y)=x'\cdot y'
$$
Please see [ECE 108: Discrete Math 1#Operator laws](/1b/ece108/#operator-laws) for more information.
The **synthesis** of an algebraic formula represents its implementation via logic gates. In this course, its total cost is the sum of all inputs to all gates and the number of gates, *excluding* initial inputs of "true" or an initial negation.
In order to deduce an algebraic expression from a truth table, **OR** all of the rows in which the function returns true and simplify.