Computer Architecture · Unit 1 · 4 hrs
Data Representation
Exam-focused notes for Data Representation (Computer Architecture, CSC213): what the TU syllabus asks and how it has actually been tested, with 5 solved past questions from this unit.
Data Representation in short
This chapter looks at how a computer represents numbers, text and codes at the bit level, and at the complements, fixed and floating point layouts, and overflow checks that let simple adder hardware do subtraction and handle signed values. Computer architecture denotes the attributes of a system visible to a programmer (instruction set, data representation, addressing techniques), while computer organization denotes how those attributes are realized in hardware (control signals, buses, memory technology); both views of the same machine recur throughout this subject.
What this unit covers
- Data Representation: Binary Representation, BCD, Alphanumeric Representation, Complements, Fixed Point representation, Representing Negative Numbers, Floating Point Representation, Arithmetic with Complements, Overflow, Detecting Overflow
- Other Binary Codes: Gray Code, self Complementing Code, Weighted Code, Excess-3 Code, EBCDIC
- Error Detection Codes: Parity Bit, Odd Parity, Even parity, Parity Generator & Checker
Error Detection Codes
2081 · 5 marks
How parity bit is generated in even parity? Demonstrate with suitable table and circuit diagram. [5]
2080 · 5 marks
What do you mean by error correction codes? Explain any one of error correction technique. [5]
Show solved answerHide answer
Error Correction Codes
Definition
An error correction code is a binary code that not only detects errors that occur during data transmission but also corrects those errors automatically without requiring retransmission. Unlike error detection codes (such as parity bits) which can only indicate the presence of an error, error correction codes can identify the exact location of the erroneous bit and fix it.
Hamming Code (Error Correction Technique)
Hamming Code is the most widely used error correction technique, developed by R.W. Hamming. It adds redundant bits (called parity bits) at specific positions to detect and correct single-bit errors.
Key Rules for Hamming Code
- Parity bits are placed at positions that are powers of 2: position 1, 2, 4, 8, 16, ...
- Each parity bit checks specific bit positions in the codeword.
- Data bits occupy the remaining positions.
Formula for Number of Parity Bits
If the data has m bits, the number of parity bits r must satisfy:
2^r >= m + r + 1
Worked Example
Encode the data bits: 1011
Step 1: Determine number of parity bits
- m = 4 (data bits)
- Try r = 3: 2^3 = 8 >= 4 + 3 + 1 = 8 ✓
- So we need 3 parity bits
Step 2: Total bits = m + r = 4 + 3 = 7 bits
Step 3: Assign positions
| Position | 1 (P1) | 2 (P2) | 3 (D1) | 4 (P3) | 5 (D2) | 6 (D3) | 7 (D4) |
|---|---|---|---|---|---|---|---|
| Bit | P1 | P2 | 1 | P3 | 0 | 1 | 1 |
Data bits 1, 0, 1, 1 are placed at positions 3, 5, 6, 7 respectively.
Step 4: Calculate parity bits (using even parity)
-
P1 (position 1): checks positions 1, 3, 5, 7
- Bits: P1, 1, 0, 1 → count of 1s = 2 (even) → P1 = 0
-
P2 (position 2): checks positions 2, 3, 6, 7
- Bits: P2, 1, 1, 1 → count of 1s = 3 (odd) → P2 = 1
-
P3 (position 4): checks positions 4, 5, 6, 7
- Bits: P3, 0, 1, 1 → count of 1s = 2 (even) → P3 = 0
Step 5: Final Hamming Codeword
| Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| Bit | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
Transmitted codeword: 0110011
Error Detection and Correction
At the receiver, parity checks are recalculated. If an error occurs (say bit 5 flips from 0 to 1):
- The parity checks that fail are noted.
- Their position numbers are added to give the position of the erroneous bit.
- That bit is then flipped to correct the error.
Advantages of Hamming Code
- Corrects all single-bit errors
- Detects double-bit errors (with extended Hamming code)
- Efficient and widely used in memory systems (ECC RAM)
2075.1 · 6 marks
Explain the error detection codes with example. [6]
Data Representation
2080 · 5 marks
What is arithmetic overflow? How can it be detected? [5]
2079 · 5 marks
What are different methods for representing signed numbers? Represent (-71) in those formats. [5]
Make Unit 1 stick
Practice CSC213 with flashcards & quizzes