0% found this document useful (0 votes)
1 views

Lab5 (1)

This document outlines Lab-5 for the Computer Architecture course, focusing on matrix multiplication using the Ripes simulator. Students are required to write a RISC-V program to multiply two 2-D matrices, ensuring compatible dimensions and handling errors appropriately. The assignment must be submitted by November 3, 2022, with specific formatting and group submission guidelines.

Uploaded by

aguniagooni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Lab5 (1)

This document outlines Lab-5 for the Computer Architecture course, focusing on matrix multiplication using the Ripes simulator. Students are required to write a RISC-V program to multiply two 2-D matrices, ensuring compatible dimensions and handling errors appropriately. The assignment must be submitted by November 3, 2022, with specific formatting and group submission guidelines.

Uploaded by

aguniagooni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Computer Architecture - CS2323.

Autumn 2022
Lab-5 (Matrix Multiplication)

This assignment is a take-home assignment and is to be done on the Ripes simulator, in groups
of maximum two students (you may submit alone if you prefer so). In the next lab assignment
(Lab-6), you will execute the same code on the RED-V board in the lab and experience the
execution speedup compared to a simulator.

We are given two 2-D matrices and we need to multiply them to generate a product matrix.
Consider that each of the matrix elements is a 32-bit integer. The dimensions of the matrices
are also provided, as shown in the data section. Write a RISC-V program to multiply the two
matrices. Your program must do the following:
1. First match the dimensions of the matrices to identify whether they can be multiplied.
Else, indicate an error by writing to a memory location and exit the program.
2. If the dimensions are compatible, then perform the multiplication and write the sum
matrix.
Assume that the matrix elements are signed integers and the result will never overflow the
register width.

Following is how the data section is organized (blue are inputs, and red are generated from
program):
.data
L1: .word 0 #This location indicates the error of the result. It is 0 if no error else 1.
.word D1x D1y #x and y dimensions of MATRIX-1
.word <VALUES OF THE MATRIX-1 are present here consecutively, in a row-major order>
.word D2x D2y #x and y dimensions of MATRIX-2
.word <VALUES OF THE MATRIX-2 are present here consecutively, in a row-major order>
.word D3x D3y #values to be written by the program
.word <VALUES OF THE MATRIX-3 (product matrix) should be written by the program here
consecutively, in a row-major order>

main:
la x3, L1
<YOUR CODE STARTS FROM HERE>

Submission instructions:
Submit the assembly code as a file named ROLLNUM1_ROLLNUM2.s (e.g.,
CSYYBTECHXXXXX_CSYYBTECHZZZZZ.S) in the google classroom. Also mention the names
of the team members in comments in the assembly code file. Only one student of the group
should submit the assignment.

Deadline: 03 Nov 2022 (Thursday), 10.00 pm


Late submission: 10% for each day of late submission. Max deduction of 40%.
Note: Submissions are subject to similarity check and hence submit only your own work.

You might also like