0% found this document useful (0 votes)
8 views10 pages

LOGIC GATES Etc 6B

The document provides an overview of fundamental digital logic components, including logic gates, flip-flops, registers, counters, adders, multiplexers, encoders, and decoders, along with their operations and truth tables. It also explains data representation methods such as bits, bytes, fixed-point, floating-point, and character encoding, as well as number bases and conversion techniques. Additionally, it describes the Central Processing Unit (CPU), its components, instruction formats, and instruction sets, highlighting the CPU's role in processing data and executing instructions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

LOGIC GATES Etc 6B

The document provides an overview of fundamental digital logic components, including logic gates, flip-flops, registers, counters, adders, multiplexers, encoders, and decoders, along with their operations and truth tables. It also explains data representation methods such as bits, bytes, fixed-point, floating-point, and character encoding, as well as number bases and conversion techniques. Additionally, it describes the Central Processing Unit (CPU), its components, instruction formats, and instruction sets, highlighting the CPU's role in processing data and executing instructions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

LOGIC GATES etc.

1. Logic Gates

Logic gates are the fundamental building blocks of digital circuits. They perform basic logical functions and are
used to create more complex circuits. The common types of logic gates are:
a. AND Gate
 Operation: The output is 1 only if both inputs are 1.
 Truth Table:
A B Output (A AND B)

0 0 0
0 1 0
1 0 0
1 1 1
b. OR Gate
 Operation: The output is 1 if at least one of the inputs is 1.
 Truth Table:
A B Output (A OR B)

0 0 0
0 1 1
1 0 1
1 1 1
c. NOT Gate (Inverter)
 Operation: Reverses the input (inverts the signal).
 Truth Table:

A Output (NOT A)

0 1

1 0

d. NAND Gate
 Operation: The output is 0 only if both inputs are 1.
 Truth Table:
A B Output (A NAND B)

0 0 1
0 1 1
1 0 1
1 1 0
e. NOR Gate
 Operation: The output is 1 only if both inputs are 0.
 Truth Table:
A B Output (A NOR B)

0 0 1
0 1 0
1 0 0
1 1 0
f. XOR Gate (Exclusive OR)
 Operation: The output is 1 if one and only one input is 1.
 Truth Table:
A B Output (A XOR B)

0 0 0
0 1 1
1 0 1
1 1 0
g. XAND Gate (Exclusive AND)
 Operation: The output is 1 if both inputs are 1, otherwise 0 (similar to AND but with exclusive control).
 Truth Table:
A B Output (A XAND B)

0 0 0
0 1 0
1 0 0
1 1 1

2. Flip-Flops
Flip-flops are circuits used to store binary data (0 or 1). They are the building blocks of memory and registers in
digital computers.
a. Data Flip-Flop (D-Flip-Flop)
 Operation: The output Q takes the value of input D on the triggering edge of the clock pulse.
 Truth Table:
Clock D Q (Output)

↑ 0 0
↑ 1 1
b. JK Flip-Flop
 Operation: A more versatile flip-flop with inputs J and K. It can be toggled, set, or reset based on the
inputs.
 Truth Table:
Clock J K Q (Output) Description

↑ 0 0 No Change No Change
↑ 0 1 0 Reset
↑ 1 0 1 Set
↑ 1 1 Toggle Toggle (Flip)
c. SR Flip-Flop (Set-Reset)
 Operation: Uses inputs S (set) and R (reset) to control the output.
 Truth Table:
Clock S R Q (Output) Description

↑ 0 0 No Change No Change
↑ 0 1 0 Reset
↑ 1 0 1 Set
↑ 1 1 Invalid Invalid State (undefined)

3. Registers
A register is a small storage location that holds data or instructions. A register typically contains multiple flip-
flops. Registers are used to store intermediate data within the CPU.
Example:
 A 4-bit register might consist of four D-Flip-Flops, where each flip-flop stores one bit of data.

4. Counters
A counter is a sequential circuit that counts in a specific sequence, such as binary counting.
 Binary Counter: A counter that increments or decrements in binary. A 4-bit binary counter can count
from 0 to 15 (0000 to 1111 in binary).

5. Adders
An adder is a digital circuit that performs the addition of two binary numbers.
a. Half Adder
 Operation: Adds two single-bit numbers and produces a sum and a carry.
 Truth Table:

A B Sum Carry

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

b. Full Adder
 Operation: Adds two bits along with a carry-in bit.
 Truth Table:

A B Cin Sum Cout

0 0 0 0 0

0 1 0 1 0

1 0 0 1 0

1 1 0 0 1

6. Multiplexers (MUX)
A multiplexer is a device that selects one of many input signals and forwards the selected input to a single
output line.
 2-to-1 MUX: It has two data inputs, one control input, and one output.
Truth Table:

Control Output

0 D0

1 D1

7. Encoders
An encoder is a circuit that converts an active input signal into a coded output. For example, a 4-to-2 binary
encoder converts 4 input lines into 2 output lines.

8. Decoders
A decoder is the inverse of an encoder. It takes binary inputs and activates one of many outputs based on the
input.
 3-to-8 Line Decoder: It has 3 input lines and 8 output lines.

DATA REPRESENTATION

1. Bits and Bytes


 Bit (Binary Digit):
A bit is the smallest unit of data in a computer system. It can have one of two values: 0 or 1.
 Byte:
A byte consists of 8 bits and is the basic unit of data storage. A byte can represent 256 different values
(2^8), ranging from 0 to 255 in unsigned representation.
Example:
o 1 byte = 8 bits (e.g., 01101001)
2. Fixed-Point Representation
Fixed-point representation is used to represent real numbers using a set number of bits for the integer and
fractional parts. The two common formats are:
a. Signed Magnitude Representation
 In signed magnitude representation, the first bit is the sign bit, where 0 represents a positive number,
and 1 represents a negative number. The remaining bits represent the magnitude (absolute value) of the
number.
Example:
o +5 is represented as 00000101 (8-bit signed magnitude)
o -5 is represented as 10000101 (8-bit signed magnitude)
b. One's Complement Representation
 In one's complement, negative numbers are represented by inverting all the bits of the corresponding
positive number.
Example:
o +5 is represented as 00000101 (8-bit one’s complement)
o -5 is represented as 11111010 (8-bit one’s complement)
c. Two's Complement Representation
 In two's complement, negative numbers are represented by taking the one's complement and adding 1.
Example:
o +5 is represented as 00000101 (8-bit two’s complement)
o -5 is represented as 11111011 (8-bit two’s complement)
3. Floating-Point Representation
Floating-point numbers represent real numbers in scientific notation and are expressed as a mantissa
(significant digits) and an exponent (scaling factor). This representation allows for a wide range of values, both
large and small.
a. IEEE 754 Standard (32-bit single precision)
 Single Precision uses 32 bits:
o 1 bit for the sign (S)
o 8 bits for the exponent (E)
o 23 bits for the mantissa (M)
The formula for a floating-point number is:
(−1)S×(1+M)×2E−127(-1)^S \times (1 + M) \times 2^{E-127}(−1)S×(1+M)×2E−127
Where E is the exponent, and M is the mantissa.
Example:
Decimal number: -13.25
1. Convert 13.25 to binary:
o 13 = 1101 (binary)
o 0.25 = .01 (binary)
o So, 13.25 = 1101.01
2. Normalize the binary number:
o 13.25 = 1.10101 × 2^3
3. Apply the IEEE 754 formula:
o Sign = 1 (negative number)
o Mantissa = 10101000000000000000000 (23 bits)
o Exponent = 3 + 127 = 130, or 10000010 in binary.
The IEEE 754 representation is:
Sign: 1 | Exponent: 10000010 | Mantissa: 10101000000000000000000
4. Number and Character Representation
 Numbers: Numbers in a computer are typically represented using binary, and the binary system can be
extended to represent larger and smaller values using fixed-point or floating-point representations.
 Characters: Characters are represented using character encoding standards, such as ASCII (American
Standard Code for Information Interchange) or Unicode. Each character is assigned a specific binary
value.
o ASCII: Uses 7 or 8 bits to represent 128 or 256 characters. For example:
 'A' is 01000001 (binary) or 65 (decimal)
 'B' is 01000010 (binary) or 66 (decimal)
o Unicode: A more comprehensive encoding system that supports a larger number of characters
across different languages and symbols, typically represented with 16 bits or more.

5. Number Bases
In computer systems, we use different number bases to represent values, such as binary (base-2), decimal (base-
10), octal (base-8), and hexadecimal (base-16).
a. Binary (Base-2)
Uses two digits: 0 and 1.
b. Decimal (Base-10)
Uses ten digits: 0 to 9.
c. Octal (Base-8)
Uses eight digits: 0 to 7. Each octal digit represents three binary digits.
d. Hexadecimal (Base-16)
Uses sixteen digits: 0 to 9 and A to F. Each hexadecimal digit represents four binary digits.

6. Converting Between Number Bases


a. Decimal to Binary
To convert a decimal number to binary, divide the number by 2, noting the quotient and the remainder until the
quotient is 0. The binary number is the remainders read in reverse order.
Example: Convert 13 to binary:
1. 13 ÷ 2 = 6 remainder 1
2. 6 ÷ 2 = 3 remainder 0
3. 3 ÷ 2 = 1 remainder 1
4. 1 ÷ 2 = 0 remainder 1
Thus, 13 in decimal is 1101 in binary.
b. Binary to Decimal
To convert binary to decimal, multiply each bit by 2 raised to the power of its position (starting from 0), and
sum the results.
Example: Convert 1101 to decimal:
1×23+1×22+0×21+1×20=8+4+0+1=131 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 8 + 4 + 0 + 1
= 131×23+1×22+0×21+1×20=8+4+0+1=13
c. Decimal to Hexadecimal
To convert decimal to hexadecimal, divide the decimal number by 16, noting the quotient and remainder until
the quotient is 0. The hexadecimal number is the remainders read in reverse order.
Example: Convert 255 to hexadecimal:
1. 255 ÷ 16 = 15 remainder 15 (F)
2. 15 ÷ 16 = 0 remainder 15 (F)
Thus, 255 in decimal is FF in hexadecimal.
d. Hexadecimal to Decimal
To convert hexadecimal to decimal, multiply each digit by 16 raised to the power of its position (starting from
0), and sum the results.
Example: Convert FF to decimal:
F×161+F×160=15×16+15×1=240+15=255F \times 16^1 + F \times 16^0 = 15 \times 16 + 15 \times 1 = 240 +
15 = 255F×161+F×160=15×16+15×1=240+15=255

7. Calculating One's and Two's Complements


a. One's Complement of a Number
To find the one's complement of a binary number, invert all the bits (0s become 1s and 1s become 0s).
Example: Find the one's complement of 10101000:
 One's complement of 10101000 is 01010111.
b. Two's Complement of a Number
To find the two's complement of a binary number, invert all the bits (one's complement), and then add 1 to the
result.
Example: Find the two's complement of 10101000:
1. One's complement: 01010111
2. Add 1: 01010111 + 1 = 01011000
Thus, the two's complement of 10101000 is 01011000.

CENTRAL PROCESSING UNIT – CPU

A processor (or Central Processing Unit - CPU) is the brain of a computer system. It performs computations,
executes instructions, and controls the flow of data.
1. CPU Components
The CPU is made up of several key components that work together to process data and instructions. These
components include:
a. Control Unit (CU)
 The Control Unit directs the operation of the processor by interpreting and executing instructions. It
manages data flow between the CPU, memory, and input/output devices. It controls the timing and
coordination of operations by generating control signals.
b. Arithmetic and Logic Unit (ALU)
 The ALU performs arithmetic operations (e.g., addition, subtraction, multiplication) and logical
operations (e.g., AND, OR, NOT). It processes the data that is being executed.
c. Registers
 Registers are small, fast storage locations within the CPU used to hold data temporarily during
processing. Some key types of registers include:
o Program Counter (PC): Holds the address of the next instruction to be executed.
o Accumulator (ACC): Stores intermediate results of calculations.
o Instruction Register (IR): Holds the current instruction being decoded and executed.
d. Bus Interface Unit
 The Bus Interface Unit is responsible for communication between the CPU and other components such
as memory, I/O devices, and other processors. It ensures data is transferred correctly across the system
bus.

2. Instruction Format
An instruction is a binary code that tells the CPU what operation to perform. The instruction format
determines how instructions are structured in memory. A typical instruction consists of the following fields:
 Opcode: The operation code that specifies the operation to be performed (e.g., ADD, SUB, LOAD,
STORE).
 Operand(s): The data or memory location on which the operation is performed (e.g., a number, register,
or memory address).
| Opcode | Operand 1 | Operand 2 | Operand 3 |

| ADD | R1 | R2 | - |

3. Instruction Set
The Instruction Set is a collection of all the instructions a processor can execute. It defines the operations,
formats, and addressing modes available to the programmer. The instruction set architecture (ISA) is critical in
determining the processor’s capabilities.
Key types of instructions in a CPU include:
 Data Transfer: E.g., LOAD, STORE
 Arithmetic Operations: E.g., ADD, SUB, MUL
 Logical Operations: E.g., AND, OR, NOT
 Control Flow: E.g., JUMP, CALL, RETURN
 Comparison: E.g., CMP (compare), TEST
4. Addressing Modes
Addressing modes define how the CPU accesses data and instructions. The most common addressing modes
include:
a. Immediate Addressing
 The operand is specified directly in the instruction. The value is constant.
o Example: MOV R1, #5 (Move the value 5 into register R1)
b. Direct Addressing
 The address of the operand is specified explicitly.
o Example: MOV R1, [1000] (Move the value at memory address 1000 into register R1)
c. Indirect Addressing
 The operand’s address is stored in a register or memory location.
o Example: MOV R1, [R2] (Move the value at the address stored in R2 into R1)
d. Register Addressing
 The operand is stored in a register, and the instruction specifies the register.
o Example: MOV R1, R2 (Move the value in R2 into R1)
e. Indexed Addressing
 A register holds a base address, and an offset is added to it to calculate the effective address.
o Example: MOV R1, [R2 + 5] (Move the value at the address R2 + 5 into R1)

5. Opcode and Operand


 Opcode (Operation Code): The portion of an instruction that specifies the operation to be executed by
the CPU. Examples of opcodes include ADD, SUB, MOV, JMP.
 Operand: The data or memory address on which the operation will be performed. Operands can be
immediate values (like numbers), memory addresses, or registers.

6. Cache Memory
 Cache Memory is a small, fast type of memory located close to the CPU. It is used to store frequently
accessed data and instructions to reduce the time needed to access them from slower main memory
(RAM).
o Levels of Cache:
 L1 Cache: Located on the processor chip, the smallest and fastest cache.
 L2 Cache: Slightly larger and slower than L1 cache, often located on the CPU chip or
nearby.
 L3 Cache: Larger and slower than L2, typically shared across multiple CPU cores.
 Cache Hit: When the requested data is found in the cache.
 Cache Miss: When the requested data is not found in the cache, and the system must fetch it from
slower memory.

7. Instruction Cycle
The Instruction Cycle is the process by which the CPU fetches, decodes, and executes instructions. It consists
of the following stages:
1. Fetch: The CPU fetches the instruction from memory (using the Program Counter).
2. Decode: The CPU decodes the instruction to determine the operation and operands.
3. Execute: The CPU performs the specified operation using the ALU or other components.
4. Store: The result of the operation is stored back in a register or memory.
This cycle is repeated for each instruction in the program.

8. Clock Speed
 Clock Speed refers to the rate at which the processor executes instructions, measured in Hertz (Hz). A
clock cycle is the time between two ticks of the clock. The higher the clock speed, the faster the
processor can execute instructions.
Example: A processor with a clock speed of 3 GHz can perform 3 billion cycles per second.
 Overclocking: Increasing the clock speed beyond the manufacturer’s specifications to boost
performance (can result in overheating).
9. Graphics Processing Unit (GPU)
 The Graphics Processing Unit is a specialized processor designed to handle graphics rendering tasks. It
is optimized for performing parallel operations on large datasets, such as rendering pixels in an image or
performing calculations for 3D graphics.
GPU vs. CPU:
o CPU: Optimized for serial processing tasks and general-purpose computing.
o GPU: Optimized for parallel processing, making it ideal for tasks like rendering images, video
decoding, and scientific simulations.

10. Parallel Processing


 Parallel Processing involves using multiple processing units to perform tasks simultaneously,
improving the overall performance of computational tasks.
o Types of Parallelism:
 Data Parallelism: The same operation is performed on different pieces of data
simultaneously.
 Task Parallelism: Different tasks are performed simultaneously, possibly with different
operations.
 SIMD (Single Instruction, Multiple Data): A form of parallel processing where the same instruction is
applied to multiple pieces of data simultaneously.

11. Multi-Core Systems


 Multi-core Systems refer to processors that have multiple independent cores within the same physical
CPU. Each core can independently execute instructions, allowing for true parallel processing of tasks.
Advantages:
o Increased Performance: Multiple cores can process data simultaneously, speeding up tasks that
support parallel processing.
o Energy Efficiency: Multi-core processors can provide better performance per watt compared to
single-core processors by distributing the workload across cores.
Example: A quad-core processor has 4 cores, which can independently execute 4 threads at once, improving
performance for multi-threaded applications.

You might also like