Caap Assigment5
Caap Assigment5
By submitting this assignment, you affirm that the work is your own and that you have
adhered to the university’s policies on academic honesty. Plagiarism or collaboration is
not permitted and will result in disciplinary action.
Contents
Instructions 2
Submission Guidelines 2
Grading Criteria 2
Conclusion 11
1
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
Instructions
This assignment is designed to assess your understanding of the fetch-decode-execute
cycle, instruction timing diagrams, and assembly programming. Each task is customized
based on your roll number to ensure individual and unique handwritten solutions.
Please read each part carefully and complete all tasks. All solutions must be hand-
written to ensure originality and individual effort.
Submission Guidelines
• Deadline: [Insert Due Date Here]
• Submission Method: [Insert Submission Platform or Email]
• Format:
– All parts must be handwritten.
– Submit scanned PDFs or clear photographs of your work.
– Ensure your name and roll number are included on each page.
– Label your files appropriately (e.g., RollNumber PartA.pdf, RollNumber PartB.pdf,
etc.).
Grading Criteria
2
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
Objective: Hand-draw a detailed flowchart illustrating the fetch and decode phases for
a customized instruction based on your roll number.
Instruction Format: The instruction has a fixed length of 16 bits, divided as follows:
Examples:
Examples:
• Roll Number 22CS09: Last two digits are 0 and 9 → Sum = 0 + 9 = 9 (odd)
→ I Bit: 1
• Roll Number 22CS13: Last two digits are 1 and 3 → Sum = 1 + 3 = 4 (even)
→ I Bit: 0
• For roll numbers ending in two digits (e.g., 22CS45): Use the last two digits
of your roll number.
• For roll numbers ending in three digits (e.g., 22CS105): Use the last three
digits of your roll number.
• If necessary, take modulo 4096 (since 212 = 4096) to fit into 12 bits.
3
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
• Convert this value into a 12-bit binary number, padding with leading zeros if
necessary.
Examples:
• Roll Number 22CS25: Last two digits are 25 → Binary (12 bits): 000000011001
• Roll Number 22CS105: Last three digits are 105 → Binary (12 bits): 000001101001
• Step 1: AR ← PC
Load the Address Register (AR) with the content of the Program Counter (PC).
• Step 2: IR ← M[AR], PC ← PC + 1
Fetch the instruction from memory at address AR into the Instruction Register
(IR) and increment PC.
• Step 3: Extract I Bit, Opcode, and Address Field from the Instruction Register
(IR).
• Step 4: Determine the Instruction Type:
– If Opcode ̸= 7 (binary 111): Memory-Reference Instruction.
– If Opcode = 7 and I Bit = 0: Register-Reference Instruction.
– If Opcode = 7 and I Bit = 1: Input/Output Instruction.
• Step 5: Decode the Address Field if applicable.
Flowchart Requirements:
• Represent each step in the fetch and decode phases using standard flowchart sym-
bols.
• Include: Registers (PC, AR, IR), Buses (Address Bus, Data Bus), Control Unit
(relevant signals).
• Ensure clarity and neatness in your drawing.
• The flowchart must be handwritten.
4
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
Instructions:
1. Determine Micro-Operations: Based on your custom instruction from Part A,
identify the micro-operations required during the following phases:
Fetch Phase:
• T0: AR ← PC
• T1: IR ← M[AR], PC ← PC + 1
Decode Phase:
• T2: Decode IR to extract I Bit, Opcode, and Address Field.
Execute Phase:
• Based on your opcode, determine the necessary micro-operations.
2. Clock Cycle Allocation: Assign each micro-operation to a clock cycle (e.g., T0,
T1, T2, etc.). Some micro-operations can occur simultaneously if they do not
conflict.
3. Hand-Draw the Timing Diagram: Your timing diagram should include:
• Horizontal Axis: Clock cycles (T0, T1, T2, etc.).
• Vertical Axis: Micro-operations and control signals.
• Represent the duration of each micro-operation within its assigned clock cycle.
• Include control signals such as Read, Write, Increment PC, etc.
4. Include Pipeline Considerations (Optional):
• If your course covers pipelining, illustrate how your instruction would be pro-
cessed in a pipeline.
• Identify any potential hazards or stalls due to your instruction’s characteristics.
5
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
Instructions:
1. **Roll Number-Based Value Extraction:**
Based on your roll number, follow the **generalized rules** below to determine **Num1**
and **Num2**:
- **For roll numbers in the form ‘22CS0X‘ (e.g., ‘22CS01‘, ‘22CS03‘):** - **Num1** =
The last digit of your roll number. - **Num2** = ‘10‘ (fixed value for single-digit roll
numbers).
- **For roll numbers in the form ‘22CSXY‘ (e.g., ‘22CS13‘, ‘22CS67‘):** - **Num1** =
The first digit of the two-digit number (‘X‘). - **Num2** = The second digit of the
two-digit number (‘Y‘).
- **For roll numbers in the form ‘22CSXXX‘ (e.g., ‘22CS105‘, ‘22CS117‘):** - **Num1**
= The first two digits of the three-digit number (‘XX‘). - **Num2** = The last digit of
the three-digit number (‘X‘).
- **For roll numbers in the form ‘22-21CSXY‘ (e.g., ‘22-21CS39‘, ‘22-21CS81‘):** -
**Num1** = The first digit of ‘XY‘. - **Num2** = The second digit of ‘XY‘.
6
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
(4 + 67) × (83 − 5)
- **Postfix Notation:**
4 67 + 83 5 − ×
- **Evaluate using a stack.**
Step Stack (Top to Bottom) Operation
1 4 Push 4
2 67, 4 Push 67
3 71 Add 4 + 67 = 71
Stack Evaluation:
4 83, 71 Push 83
5 5, 83, 71 Push 5
6 78, 71 Subtract 83 - 5 = 78
7 5538 Multiply 71 × 78 = 5538
—
3. **Unsolved Expressions for Students:**
a) **Expression 2:**
(Num2 + 22) × ASCII of S
- Convert to postfix notation and evaluate using a stack.
b) **Expression 3:**
7
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
Objective: Draw a detailed block diagram of a common bus system, where the number
of registers is determined by your roll number and each register contains 8 bits. The
system should be designed using multiplexers, and registers should be connected to the
bus for data transfer.
1. Number of Registers:
Examples:
• Roll Number 22CS19: First digit = 1, Second digit = 9 → 1+9 = 10, 10/2 = 5
→ **5 registers**.
• Roll Number 22CS05: First digit = 0, Second digit = 5 → 0 + 5 = 5, 5/2 = 2.5
→ **3 registers**.
• Roll Number 22CS31: First digit = 3, Second digit = 1 → 3 + 1 = 4, 4/2 = 2
→ **2 registers**.
Diagram Requirements:
• Draw the determined number of registers based on your roll number.
• The width of the bus should match the 8-bit width of each register.
Example Diagrams:
• Roll Number 22CS19 → 5 registers, each with 8 bits, connected to the bus using
a multiplexer.
• Roll Number 22CS45 → 8 registers, each with 8 bits, connected to the bus using
a multiplexer.
8
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
• Roll Number 22CS01 → 2 registers, each with 8 bits, connected to the bus using
a multiplexer.
Submission Requirements:
Task: Based on your roll number, follow the steps above to design and draw a common
bus system diagram. Ensure the number of registers and bits per register adhere to the
provided rules.
Objective: Customize a 16-bit binary instruction based on your roll number, encode
it, and execute it step-by-step using the appropriate assembly-like operations. This will
include calculating values from your roll number and applying the operations on the
registers.
Instruction Format: You are provided a 16-bit instruction format with the following
breakdown:
Operations (Opcodes): The Opcode (Bits 8–11) will dictate the operation to be
performed. Based on your roll number, generate an instruction and execute it.
9
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
• Operand (Bits 0–7): Use the sum of the last two digits of your roll number,
convert it into an 8-bit binary number.
• Opcode (Bits 8–11): Use the last digit of your roll number, take modulo 16, and
convert it into a 4-bit binary number (this will select the operation).
• Register Address (Bits 12–15): Use the first digit of your roll number, take
modulo 8, and convert it into a 4-bit binary number (this will select the register to
operate on).
Register Selection: Each student will have to use one of the following registers based
on the **first digit** of their roll number (after applying the modulo 8 rule):
10
Computer Systems Engineering 22-Batch, Semester 5 Roll No:
• Operand (Bits 0–7): Sum of the last two digits = 1 + 9 = 10. 8-bit binary
representation of 10 is: 00001010.
Unsolved Tasks for Students: Based on your roll number, follow these steps:
1. Task 1: Instruction 1 (Load and Add) Generate an instruction that loads the
operand into a register and then adds another operand to it. Perform the binary
encoding and show the register update after executing the instruction.
Submission Requirements:
• Step 1: Generate the 16-bit binary instruction based on the given roll-number-
based rules.
• Step 2: Execute the instruction step-by-step, showing the register value updates
after each operation.
Conclusion
Good luck with your assignment! Apply your knowledge thoroughly, and ensure that
your handwritten work reflects your understanding of the concepts.
11