Homework II
Due Wednesday, April 20
In this problem, you will write assembly language code to multiply two
compressed symmetric matrices. Here are the specs:
-
Since the matrix is symmetric, we will save storage space by only storing
what is on or above the diagonal. We will do so column-by-column. So,
for example, the matrix
5 13 12
13 8 1
12 1 6
would be stored as (5,13,8,12,1,6).
- Your function must be named mulsym. It will
have four arguments, stored in registers since you do not know how to
pass arguments on the stack yet (some machines do this anyway):
- the matrix size, i.e. number of rows/columns, stored in EDX
- the address of the multiplier matrix, stored in ESI
- the address of the multiplicand matrix, stored in EDI
- the address of the product matrix, stored in EBP
- You will write wrapper code that will test your function.
Its .data section will have your matrices. At the
beginning of your .text section you will set the
registers (EDX, ESI, EDI, EBP) to the proper values, and then call
mulsym.
- The product matrix will in general be asymmetric. Store it in
row-major order, for compatibility with C.
-
For convenience, put all your code in one file. When the TA grades your
work, he will use the mouse to cut-and-paste your
mulsym code into his own file, where he will already
have his wrapper code.
- You will need to devise an algorithm for multiplying these matrices
WITHOUT EXPANDING THEM TO FULL SQUARE FORM. In other
words, do NOT uncompress the matrices. Document your algorithm
this well in your comments.
- You may "run out of registers." If so, use memory, but do this
sparingly.