COA Major Assignment4
COA Major Assignment4
ASSIGNMENT 5:
Implementaion of recursion using MIPS ISA and design of processor data path and control.
Due date: 16.4.2016(Saturday)
This assignment is designed to give you practice with:
1. Implementation of recursive procedure using MIPS instruction set.
2. Design of processor datapath and control for single cycle implementation and
pipeline implementation.
(You are allowed to use only those concepts which are covered in the lecture class till date.)
Plagiarized assignments will be given a zero mark.
1. Write an assembly language program to read two integers through console.
-Find the GCD between two numbers using recursion,
where GCD(m,n)=n (if m%n=0)
= GCD(n,m%n), otherwise.
2. Write a recursive function to find the sum of digits of a number n.
Where sumdig=0 (if n=0)
= (n%10)+sumdig(n/10)
3. Write a recursive function in MIPS to generate first n terms of the fibonacci series.
4. Assume we are going to design a processor, data path and control for the following subset
of instructions:
lh, sh, bne, sub, and, ori.
The 2bit AluOp and the corresponding ALU operations for these instructions are as per the
table below.
[Hint: If any phase of instruction execution uses two or more data path conponents
parallelly, (i.e one's input does not depends on another's output) then the time
required for that phase is the time required for the slowest component in that step.]
• What would be the clock cycle time required for the processor to implement 5
consequitive fetch instructions using single clock cycle implementation?
• What is the total clock cycle time required by the processor for implementation of
each of the following instructions:
beq, lw, sw, ori.
6. Assume that the following sequenses of instructions are executed on a five stage pipelined
data path.
(a) Represent each set of instructions using the multiple clock cycle pipeline diagram.
(b) Indicate the dependencies in the pipeline diagram for each code sequence.
(c) Indicate the type of hazard by analyzing the dependencies.
(d) For each code sequence, state whether it must stall. Can avoid stalls using only forwarding
or can execute without stalling or forwarding.
Submit your hard copy assignment by the due date, i.e. 16.4.2016(Saturday).
Part of your assignment grade comes from its "external correctness." This is based on
correct output on various sample inputs (like you have seen in the laboratory classes).
Your output should match the format of the sample run exactly.
The rest of your assignment's score comes from "internal correctness." Internal
correctness includes:
1. Use of minimal MIPS instructions and registers in your program.
2. Appropriate use of the theoretical concepts and suitable diagrams to enhance
readability of your responses.