0

i am new to assembly and i have to write a program in MIPS that read string as an input,and use it as 32*32 binary matrix M(first 4 bytes is the first row in the matrix) and prints to the screen M^2(matrix is modulo 2).

i tried by using syscall and the adress of the buffer but i dont have any idea of how to solve this question.

i dont really know how to do this because i didn't find an easy way to get binary values from the bit. in addition,in order to calculate M^2 i need always the the matrix column,which are not organized as an array in the memory.

thanks to all helpers.

Matan
  • 109
  • 2
  • 13
  • I think first writing what you want to do in C or pseudocode, and then translate it to assembly is one of a easy (less confusing) way. – MikeCAT Dec 18 '15 at 08:27
  • i still cant understand how to implement it in mips,i donk know how to solve the two problems i wrote above – Matan Dec 18 '15 at 13:27
  • Is the user input in ASCII hex, or raw binary? Also, you need to decide whether you want to store your matrix "unpacked", with one entry per byte, or "packed" with 8 entries per byte. You can get single bits out of bytes with shift and AND instructions. Also note that addition mod2 is simply XOR. If you ever need to multiply a row by a scalar, you can broadcast the scalar to fill a word (e.g. with a signed right-shift to take advantage of the duplicate-the-sign-bit effect), and XOR that with words holding the row. – Peter Cordes Dec 20 '15 at 07:36

0 Answers0