Digital Logic
Miscellaneous notes related to digital logic, drawing on course material and past learning:
Logic Gates
- Logic gates have inputs and outputs.
- The set of possible values for inputs and outputs is called the Boolean set.
- There are only two elements in the Boolean set: 1 and 0.
- NOT gates are examples of a unary logic gates. (They have only one input.)
- AND gates, OR gates and XOR gates are examples of binary logic gate. (They have two inputs.)
- There are 16 different binary logic gates.
- Logic gates have diagrammatic representations.
- Logic gates are used to build logics circuits.
- Logic gates have tabular representations known as truth tables.
- Logic gates have algebraic generalisations such as boolean functions and boolean operations.
- There are subsets of boolean functions that are functionally complete. (In other words, they can create any possible truth table.)
- The set of AND and NOT gates, is functionally complete.
- NAND gates and NOR gates are known as universal gates, as each is functionally complete by itself.
- The Boolean set with the operation of AND, OR and NOT, forms a Boolean lattice.
Logic Circuits
- Logic circuits are built from logic gates.
- Logic circuits may be materialised as digital circuits.
- Digital circuits are called combinational if the outputs only depend upon the inputs.
- Encoders, Multiplexers and Rotators are examples of combinational circuits.
- Digital circuits are called sequential if the outputs depend upon internal state too.
- Counters and Flip-Flops are examples of sequential circuits.
- ALU circuits can perform arithmetic operations, comparisons and bitwise operations.
- Memory circuits can hold data.
- Logic.ly is an interactive tool to play around with logic circuits.
Bit Patterns
- Bit patterns are arrangements of values with semantic intepretations.
- Bit patterns are processed by and obtained from logic circuits.
- Operations that manipulate bit patterns are called bitwise operations.
- AND, OR, XOR and NOT are examples of bitwise operations.
- Bit patterns have base-dependent representations.
- Decimal and Hexadecimal are examples of base-dependent representations of bit patterns.
- WolframAlpha is a computational knowledge engine capable of converting between decimal, binary and hexadecimal.
Data
- Data may be encoded into bit patterns.
- Natural numbers can be encoded by converting them into binary digits.
- Integers can be encoded using two's complement encoding, or extended encoding.
- Two's complement encoding requires: converting the magnitude of the integer into binary digits, performing a bit-flip on all of the digits, and adding one to the result.
- Extended encoding requires: adding a fixed number to the integer to make it positive, and converting the result into binary digits
- Floating-point numbers are numbers that can be encoded with a bitmap containing a sign-bit, exponent and mantissa.
- The mantissa of a floating point number is a fraction between 0 and 1, with a denominator that's a power of two, determined by the length of the mantissa, and a numerator intepreted using the binary number system. The exponent of a floating point number represents a power of two to be multiplied with the mantissa. The exponent is intepreted specifically as an integer, encoded using extended encoding, and an exponent for 2.
- IEEE 754 is an active standard for floating-point arithmetic created by the IEEE standards association.
- Text can be encoded after assigining each unique character to a unique bit pattern.
- Unicode is a standardised set of character to bit pattern assignments.
- Unicode.org provides Unicode character code charts.
- Images can be encoded on a per pixel basis, which can be encoded using RGB encoding.
- RGB encoding requires: using a bitmap for the red, green and blue layers of the pixel, and assigning a value between 0 and 255 to each layer, indicating each colours intensity, so that the combination of the primary colours at the specified intensities, creates the correct colour of the pixel.
- W3 Schools RGB Calculator is an interactive tool for getting the hex patterns of colours for RGB encoding.