COSC 211 Lab 5/6 – Binary Math and Building a Datapath

0.Introduction

In this lab, you will have the opportunity to implement an integer multiplication algorithm in MIPS

assembly. You will also have the opportunity to explore the MIPS datapath by adding functionality to the

processor on paper. Additionally, there are a series of questions from the text book that will also cover

logic operations and numerical representation. There is a total of 78 marks available for this assignment.

The assignment is broken into two parts. The submission can be hand written and scanned or typed and

submitted through Canvas. Work must be clear with all work shown. The coding part of the assignment

requires two submissions. Your code is to be submitted through Canvas by the end of the day on Friday,

November 10th, 2023. Submissions will be accepted earlier. Late submissions will not be accepted.

Even if you do not complete all questions, please try them all and submit what you have for partial marks.

1.Programming Assignment

Simulating Multiplication Algorithms

1. (/30) Implement an assembly program that reads two positive integers and outputs their

product. Your program will need to read the input from the user and then display the

output as seen below:

Please enter the first number: 256

Please enter the second number: 100

The product is: 25600

In your implementation, you are not allowed to use the MIPS instruction for

multiplications (ie mul or mult are forbidden). Instead, you need to use two 32-bit general

registers to mimic a 64-bit product register, and to use the shift and addition operations to

implement the version of the multiplication algorithm discussed in class (See page 12-15 in

slide deck – Topic 11. Figure 3.5 shows the implementation but will also work). Your code

should generate an error message if the multiplication generates an overflow. Include a

program comment header that has your name, student number and program name. Name

your file excercise1.s.

Code Submission

Submit your code via Canvas on the above indicated due date.

2. Written Assignment

1. (/8) Exercises (from 5th edition)

a. 3.6 (1 mark)

b. 3.20 (2 marks)

c. 3.21 (1 mark)

d. 3.22 (2 marks)

e. 3.23 (2 mark)

2. (/8) For the following binary fraction, write the IEEE 754 single floating-point representation

of the number.

a. (4 marks) 111111.012

b. (4 marks) 100011111000101011.011012

3. (/10) Prove that the NOR gate is universal by showing how to build the AND, OR, and NOT

functions using a two-input NOR gate. You are to use only NOR gates to implement the

functionality of the other functions. (review B.1, B.2)

4. (/10) We wish to add the instruction subi (subtract immediate) to the single-cycle datapath

described in the Chapter 5. Add any necessary datapath and control signals to the singlecycle datapath of Figure 4.17 on page 265 (pdf copy is available on Canvas). Generate a new

row entry for the table below for the instruction and update the datapath diagram as

required.

Download and inspect the diagram of the datapath associated with the lab from Canvas.

This can be implemented

5. (/12) We wish to add the instruction bne (branch if not equal), to the single-cycle datapath

described in the Chapter 5. Add any necessary datapath and control signals to the singlecycle datapath of Figure 4.17 on page 265. In order to accommodate the bne instruction,

an additional control line is needed to facilitate the inversion of the zero output of the ALU,

so that the PC can be updated in the results of the output are not zero. Generate a new

row entry for the table below for the instruction and update the datapath diagram as

required.

Download and modify the diagram of the datapath associated with the lab from Canvas and illustrate

your answers on the diagram. Embedded you image in your solution file.

Written Submission

Submit your written assignment via Canvas on the above indicated due date. Please take care and effort

to make your assignment answers as clear as possible.

COSC 211

# Lab 5/6 – Binary Math and Building a Datapath

Original price was: $40.00.$30.00Current price is: $30.00.

## Reviews

There are no reviews yet.