:::warning

Transistor

A transistor has 3 terminals, the gate, the drian _and the _source.
Property for N-type transistor
if the gate is supplied with 1.2 volts, the connection from source to drain is a short circuit.
if the gate is supplied with 0 volts, the connection from source to drain is an open circuit.
Property for P-type transistor
if the gate is supplied with 0 volts, the connection from source to drain is a short circuit.
if the gate is supplied with 1.2 volts, the connection from source to drain is an open circuit.
image.pngimage.png :::

Logic Gates

The NOT Gate (Inverter)

image.png image.png

:::warning

The OR and NOR Gates

NOR for NOT-OR
image.pngimage.png
image.pngimage.png ::: :::danger

The AND or NAND Gates

NAND for NOT-AND
image.png4
image.png ::: image.png
image.png

Combinational Logic Circuits 组合逻辑电路

Some Examples

:::warning

Decoder 译码器

The output line that detects the input pattern is asserted.
In general, decoders haveChapter 3 Digital Logic Structures - 图13inputs andChapter 3 Digital Logic Structures - 图14outputs.
Function To decode how the software ask hardware to do.
image.png :::

Mux 多选器

for multiplexer In general, a mux consists ofChapter 3 Digital Logic Structures - 图16inputs andChapter 3 Digital Logic Structures - 图17select lines. Function select one of the inputs and connect it to the output. image.pngimage.png image.pngimage.png

:::danger

A One-Bit Adder (a.k.a a Full Adder)

Chapter 3 Digital Logic Structures - 图22, Chapter 3 Digital Logic Structures - 图23are the two oprands ofChapter 3 Digital Logic Structures - 图24andChapter 3 Digital Logic Structures - 图25. Chapter 3 Digital Logic Structures - 图26is the carry from the previous column.
Chapter 3 Digital Logic Structures - 图27is the sum bit. Chapter 3 Digital Logic Structures - 图28is the carry over to the next column.
Also known as a full adder. But a half adder doesn’t consider the carry from the previous column.
image.png
image.png
A circuit for adding two 4-bit binary numbers
image.png :::

Other Concepts

:::warning

The Programmable Logic Array (PLA) 可编程逻辑阵列

PLA is a building block for implementing any collection of logic functions one wishes to implement.
For n-input logic functions, we need a PLA withChapter 3 Digital Logic Structures - 图32n-input AND gates. The number of OR gates corresponds to the number of logic functions we wish to implement.
The connection is dependant on our wishes. Hence the notion of programmable. We say we _program _the connections from AND gates outputs to OR gate inputs to implement our desired logic functions.
image.png :::

Logical Completeness 逻辑完备性

If any logic functions can be implemented by a set of gatesChapter 3 Digital Logic Structures - 图34, we say Chapter 3 Digital Logic Structures - 图35is logically complete. Chapter 3 Digital Logic Structures - 图36is logically complete. Chapter 3 Digital Logic Structures - 图37is logically complete. Since two NAND gates can implement a NOT gate. Thus AND gate can be implemented and thus OR gate can be implemented. So as to Chapter 3 Digital Logic Structures - 图38.

Basic Storage Elements

:::warning

The R-S Latch R-S 锁存器

The value of a R-S latch is the value of theChapter 3 Digital Logic Structures - 图39point.
S for SET, R for RESET.
SET means to store the value 1, RESET means to store the value 0.

The Quiescent State

S and R are at 1. And the value, either 0 or 1, is storaged.

Setting the Latch to 1 or 0

The latch can be set to 1, if keeping R at 1, momentarily setting S to 0.
The latch can be set to 0 _or say clear_, if keeping R at 0, momentarily setting S to 1.
In order for the R-S latch to work properly, both S and R must never be allowed to be set to 0 at the same time.
image.png :::

The Gated D Latch D 锁存器 / Data Flip-flop D 触发器

The two additional NAND gates allow the latch to be set to the value of D, but only when WE is asserted. D for data. WE stands for write enable(写使能) goal or we can say it the gating singal. image.png

The Concept of Memory

Address the unique identifier associated with each memory location.
Addressability the number of bits of information stored in each locaiton.
Address space the total number of uniquely indentifiable locations.
n bits of address can uniquely identifyChapter 3 Digital Logic Structures - 图42locations. :::warning A[high:low] numbers the bits of address and data from right to left, in order, starting with the rightmost bit 0.
[high:low] means a sequence ofChapter 3 Digital Logic Structures - 图43bits. (left is high, right is low) ::: word line one output of memory. In the following diagram example, the unique 3-bit word is the word line.
image.png

Sequential Logic Circuits

Finite State Machine

A finite state machine is at the heart of the computer. It controls the processing of information by the computer.

An Example: Combination Lock The Lock can only be unlocked provided the order R13 - L22 - R3. image.png

State Diagram / State Machine

state each of the situation of a system
current state the state the system is coming from
next state the state it is going to
The state of a system is a snapshot of all the relevant elements of the system at the moment the snapshot is taken.
The arrrows in the state diagram is called arc.
image.png

Supplement of the diagram : Add an arc from C to B with the move R13 and modify the arc from C to A with the move Other than R3 or R13. Then we get the complete diagram.

Synchronous Finite State Machine

The example of combination lock above is asynchronous because there is nothing synchronizing when each state transition must occur.
Computers are synchronus because the state transitions take place, one after the other, at identical units of time. They are controlled by a synchronous finite state machine.

The Clock

clock cycle each of the repeat sequence of identical intervals. A clock cycle starts when the clock signal transitions from 0 to 1 and ends the next time the clock signal transition from 0 to 1.
image.png :::warning An example : A Danger Sign
If the switch is on, the danger sign flashes from right to left (the first second, 1, 2 are on; the next second, 1, 2, 3, 4 are on; the next, all are on; the next, all are off. It turns in a cycle).
If the switch is off, the danger sign is off. ::: image.pngimage.png

We use 00, 01, 10, 11 to represent different states.

The Sequentail Logic Circuit for the Danger Sign Controller

image.png
Combinational logic circuits
image.png

SW for switch. S1 and S0 for the current state. S1’ and S0’ for the next state.

dasd.png

A problem If we use gated D latch to storage data, the state of elements would change so fast in a clock circle but not change only once.

:::warning

Flip-Flop

To replace the gated D latch to storage data synchronously.
Function reading and writing a particular variable. Reading must be allowed throughtout the clock cycle, and writing must occur at the end of the clock cycle.
image.png
image.png ::: :::success

Register

A register is simply a set of n flip-flops that collectively are used to store one n-bit value.
One way to implement registers is with master/slave flip-flops.
image.png :::