
Section Description:
Welcome to the first step in your journey to understanding the inner workings of computers! This introductory section lays the essential groundwork for the entire course. We will begin by demystifying the core concepts of computer organization and architecture, exploring the fundamental components that make up a modern computer system. You will learn how we measure a computer's power through its capacity and speed and take a brief tour through the history of computing to appreciate how we arrived at today's technology.
We will then dive into the language of computers: the binary world. This section provides a comprehensive overview of the number systems crucial to computing, including binary, octal, decimal, and hexadecimal. You'll master the art of converting between these systems and understand how computers represent not just numbers but all forms of data using various coding schemes like BCD, Gray Code, and ASCII. We'll also cover the essentials of binary arithmetic and error detection.
Finally, we will get to the absolute foundation of all digital computation: logic gates. You will learn about the basic building blocks like AND, OR, and NOT, as well as universal gates, which can be used to build any digital circuit imaginable. By the end of this section, you will have a solid grasp of the fundamental principles upon which all complex computer systems are built.
Binary Arithmetic: Addition, Subtraction, Multiplication, Division
Binary arithmetic forms the foundation of all digital computation, enabling computers to process data using only 0s and 1s. Understanding these operations is essential for grasping how digital systems perform calculations at the most fundamental level.
Overview of Binary Arithmetic Operations
Binary arithmetic follows similar principles to decimal arithmetic but operates within the base‑2 number system. Each operation has specific rules and procedures due to the binary nature of the operands.
OperationBasic RulesKey Characteristics
Addition0+0=0, 0+1=1, 1+0=1, 1+1=10
Generates carry when sum ≥ 2SubtractionDirect or complement methodsUses borrowing or complement arithmeticMultiplication0×0=0, 0×1=0, 1×0=0, 1×1=1Similar to decimal but simplerDivision0÷1=0, 1÷1=1, division by 0 is undefinedUses long division bit-wise
1. Binary Addition
Fundamental Rules
ABSumCarry0000011010101101
Extra rule: 1 + 1 + 1 = 1 (carry 1)
Procedure
Align numbers by place value.
Start from the rightmost bit.
Apply binary addition rules.
Propagate carries to the left.
Continue until all bits are processed.
Examples
Without Carry:
101₂ (5)
+ 010₂ (2)
--------
111₂ (7)
With Carry:
1001₂ (9)
+ 0111₂ (7)
-----------
10000₂ (16)
Multi-bit:
10001₂
+ 11101₂
---------
101110₂
Fractional Binary Addition
markdown
CopyEdit 101.10₂
+ 011.01₂
------------
1000.11₂
2. Binary Subtraction
Direct Method Rules
0 − 0 = 0
1 − 0 = 1
1 − 1 = 0
0 − 1 = 1 (with borrow)
Example:
markdown
CopyEdit 10110₂ (22)
− 10010₂ (18)
-------------
0100₂ (4)
1’s Complement Method
Steps:
Flip bits of subtrahend.
Add to minuend.
If carry occurs, add it back (end-around carry).
If no carry, complement result and mark it negative.
Example:
CopyEditMinuend: 110110₂
Subtrahend: 100010₂
1's Comp: 011101₂
Sum: 110110 + 011101 = 1010011₂
Add carry → Result: 010100₂ (20)
2’s Complement Method
Steps:
Find 1’s complement + 1 (i.e., 2’s complement) of subtrahend.
Add to minuend.
Discard carry if any.
Example:
15₁₀ = 01111₂
9₁₀ = 01001₂
2's Comp of 9 = 10111₂
Sum = 01111 + 10111 = 100110₂
Result (ignore carry) = 00110₂ (6)
3. Binary Multiplication
Rules
ABProduct000010100111
Procedure
Multiply each bit of multiplier with multiplicand.
Shift each partial product to the left accordingly.
Add all partial products.
Examples
Example 1:
1010₂ (10)
× 101₂ (5)
-------------
1010
0000
+ 1010
-------------
110010₂ (50)
Example 2:
1101₂ (13)
× 011₂ (3)
-------------
1101
+ 1101 (shifted)
-------------
100111₂ (39)
Fractional Multiplication
0.101₂ × 0.11₂
Partial Products:
101
+1010 (shifted)
-------------
01111₂ → Result: 0.01111₂
4. Binary Division
Rules
DividendDivisorQuotientRemainder0100111000Undefined–10Undefined–
Procedure
Compare divisor with bits of dividend from left.
If fits, write 1 and subtract.
Else write 0.
Bring down next bit and repeat.
Examples
Example 1:
11011₂ ÷ 11₂
1001
------
11)11011
11
---
001 (bring down 0)
011 (bring down 1)
011 (fits)
---
000
Quotient: 1001₂ (9)
Example 2:
110011₂ ÷ 11₂
10001
-------
11)110011
11
---
000 (bring down bits)
011
---
000
Quotient: 10001₂ (17), Remainder: 0
Fractional Division
CopyEdit110101.11₂ ÷ 10₂
= 11010.111₂ (26.875)
Sign‑Magnitude Arithmetic
Sign-magnitude representation uses the MSB (Most Significant Bit) to indicate the sign.
SignMagnitudeValue00110+610110–601001+911001–9
Operations
Same sign: Add magnitudes, retain sign.
Different sign: Subtract smaller magnitude from larger; keep sign of larger.
Subtraction: Flip the sign of subtrahend and add.
Example: (+6) + (–4)
+6 = 0110
–4 = 1100 (sign bit 1, mag 0100)
Result: 0010 (+2)
Pros & Cons
Easy sign detection
Two zeros: +0 and –0
More complex circuits for arithmetic
Key Takeaways
Carry propagation in addition is essential.
Complement methods reduce subtraction logic.
Binary multiplication relies on shifting and adding.
Binary division mirrors long division with bit-by-bit steps.
Sign-magnitude is simple in concept but less efficient for computation.
Codes: Gray, BCD, Excess‑3, ASCII, Parity
Digital systems require specialized encoding schemes to represent decimal digits, characters, and detect transmission errors. This guide covers five fundamental binary codes that form the backbone of digital communication and computation systems.
Overview of Binary Codes
Binary codes serve different purposes in digital systems. Each code is optimized for specific applications. Understanding their properties, conversion methods, and applications is crucial for designing efficient digital systems.
Code Classification Summary
BCD (8421): Base-10, weighted, not self-complementary, no error detection; used in decimal display systems.
Excess-3: Base-10, non-weighted, self-complementary, limited error detection; used in arithmetic operations.
Gray Code: Base-2, non-weighted, not self-complementary, no error detection; used in position encoding.
ASCII: Not weighted, not self-complementary, no error detection; used in character representation.
Parity: Not weighted, not self-complementary, used for error detection.
1. Binary Coded Decimal (BCD – 8421 Code)
Definition and Properties
BCD represents each decimal digit (0 to 9) using exactly 4 bits with weights of 8, 4, 2, and 1. It is a weighted code.
Conversion Methods
Decimal to BCD: Convert each decimal digit separately to its 4-bit binary form and concatenate.
Example: 527 → 5 → 0101, 2 → 0010, 7 → 0111 → Result: 0101 0010 0111.
Binary to BCD: First convert the binary number to decimal, then apply decimal-to-BCD conversion.
Example: 11101₂ → 29₁₀ → 2 → 0010, 9 → 1001 → Result: 0010 1001.
BCD Arithmetic
Addition: If the result exceeds 9 or generates a carry, add 0110 (6) to correct.
Example: 8 (1000) + 7 (0111) = 1111 (invalid) + 0110 = 1 0101 (15₁₀).
Subtraction: If a borrow occurs, subtract 0110 from the digit receiving the borrow.
2. Gray Code (Reflected Binary Code)
Definition and Properties
Gray code ensures that only one bit changes between consecutive code words. This minimizes transition errors, especially in mechanical systems.
Conversion Methods
Binary to Gray:
The most significant bit (MSB) of Gray code is the same as the MSB of the binary.
Each following Gray bit is the XOR of the current and previous binary bits.
Example: 1011 → Gray = 1110.
Gray to Binary:
MSB of Binary = MSB of Gray.
Each following Binary bit is the XOR of the previous binary bit and the current Gray bit.
Applications
Used in analog-to-digital converters, rotary encoders, clock domain crossing, and genetic algorithms.
3. Excess‑3 Code
Definition and Properties
Excess-3 is a non-weighted, self-complementary code that represents decimal digits by adding 3 to their binary values. This simplifies digital arithmetic and complements.
Conversion Methods
Method 1 – Direct Addition:
Add 3 to each decimal digit and convert to 4-bit binary.
Example: 27 → 2+3 = 5 → 0101; 7+3 = 10 → 1010 → Result: 0101 1010.
Method 2 – BCD Addition:
Convert the decimal to BCD, then add 0011 (3) to each group.
Example: 45 → 0100 0101 + 0011 → 0111 1000.
Excess-3 to Decimal:
Subtract 3 from each 4-bit group.
Example: 0110 1001 → 6 → 3; 9 → 6 → Result: 36.
Self-Complementary Property
Taking the 1’s complement of an Excess-3 code gives the Excess-3 representation of the 9’s complement of the original digit.
Example: 5 (1000) → 1’s comp = 0111 → Represents 4 (which is 9−5).
4. ASCII Code
Definition and Structure
ASCII is a 7-bit character encoding standard representing 128 characters, including control characters, digits, uppercase/lowercase letters, and symbols.
Examples of ASCII Codes
Control Characters: 0 = NUL, 1 = SOH, 8 = BS (Backspace), 9 = HT (Tab), 10 = LF (Line Feed), 13 = CR (Carriage Return), 27 = ESC.
Digits: 0 to 9 → ASCII 48 to 57 → Binary starts from 0110000 to 0111001.
Letters:
Uppercase A-Z = 65 to 90
Lowercase a-z = 97 to 122
Conversion Methods
Text to ASCII:
Example: "HELLO" → H = 1001000, E = 1000101, L = 1001100, O = 1001111.
ASCII to Text:
Example: 1000011 1000001 1010100 → 67, 65, 84 → CAT.
ASCII Patterns
Digits: start with 0011
Uppercase: start with 100
Lowercase: start with 110
Toggle case: flip the 5th bit (±32).
5. Parity Code
Definition and Types
Parity adds an extra bit to a binary message to make the number of 1s even (even parity) or odd (odd parity). It is a basic form of error detection.
Even Parity
If the number of 1s in the data is even, parity bit = 0; if odd, parity = 1.
Example:
0000000 → Even → Add 0 → 00000000
0000001 → Odd → Add 1 → 10000001
Odd Parity
If the number of 1s is even, parity bit = 1; if odd, parity = 0.
Example:
0000000 → Even → Add 1 → 10000000
0000001 → Odd → Add 0 → 00000001
Implementation
Count the number of 1s in the data.
Add a parity bit to maintain even or odd parity as required.
Used in error checking during transmission.
Error Detection
At the transmitter, the parity bit is calculated and added. At the receiver, the bits are re-evaluated. If the parity doesn’t match, an error is detected.
Limitation: Parity cannot detect errors if an even number of bits are flipped.
Code Comparison and Applications
BCD: Excellent for digital displays; acceptable for arithmetic with correction logic.
Excess-3: Great for arithmetic operations due to self-complementary nature.
Gray Code: Best for applications needing glitch-free transitions, like position sensors.
ASCII: Industry standard for representing characters in computing and communication.
Parity: Basic error detection in communication systems.
Practice Problems
BCD Addition
Add 0111 (7) + 1001 (9) = 10000 (invalid) → Add 0110 → Result: 1 0110 (16).
Gray Code Sequence (3-bit)
Sequence: 000, 001, 011, 010, 110, 111, 101, 100.
ASCII Encoding Example
"Code‑123":
C = 67 → 1000011
o = 111 → 1101111
d = 100 → 1100100
e = 101 → 1100101
= 45 → 0101101
1 = 49 → 0110001
2 = 50 → 0110010
3 = 51 → 0110011
Key Takeaways
BCD is suitable for decimal display systems but needs correction for sums above 9.
Excess‑3 code's self‑complementing nature helps in subtraction.
Gray code minimizes errors in hardware transitions by changing only one bit.
ASCII enables consistent text representation in digital systems.
Parity bits provide simple error detection but fail against even-bit errors.
The appropriate binary code should be chosen based on the application’s requirements—whether speed, accuracy, simplicity, or fault tolerance.
The Computer Organization and Architecture course is a comprehensive exploration into the intricate workings of computers. It provides a deep dive into the fundamentals of computer hardware, memory operations, and addressing modes, offering students a solid foundation in understanding the internal structure of computers.
The course begins with an introduction to number systems, including binary, decimal, octal, and hexadecimal, and covers various codes such as Grey, BCD, Excess-3, ASCII, and Parity. It also delves into binary arithmetic, including addition, subtraction, multiplication, and division using Sign Magnitude, 1’s compliment, 2’s compliment, and BCD Arithmetic. The course also introduces students to logic gates, including AND, OR, NOT, NAND, NOR, EX-OR, and EX-NOR.
The course then moves on to the study of computer architectures, focusing on the functional units of a computer, operational concepts, bus structures, memory addresses and operations, assembly language, instructions, instruction sequencing, and addressing modes. It includes a case study on the 8086 architecture to provide practical insights.
The design and operation of the Arithmetic and Logic Unit (ALU) form a significant part of the course. Students learn about De Morgan’s Theorem, adders, multipliers, division, and IEEE 754 Floating point numbers and operations. The course also covers the basic processing unit, ALU operations, instruction execution, branch instruction, multiple bus organization, hardwired control, generation of control signals, micro-programmed control, and the basic concepts of pipelining.
The course explores the need for parallelism, the architecture of parallel systems, and Flynn’s classification. It also introduces students to the ARM Processor, its instruction set, processor and CPU cores, instruction encoding format, memory load and store instruction, and the basics of I/O operations. Case studies on ARM 5 and ARM 7 Architecture are included to provide practical insights.
By the end of the course, students will have a thorough understanding of computer organization and architecture, enabling them to identify computer hardware, apply Boolean algebra in designing computer logic, examine the operation of basic processing units, analyze concepts of parallelism and multi-core processors, and classify memory technologies and input-output systems. This course equips students with the knowledge and skills necessary to excel in the field of computer science and engineering.