Академический Документы
Профессиональный Документы
Культура Документы
ID: 201800866
Section: 2
PC points to the 1st instruction of the program (MAC Mem1, Mem2, Mem3)
The contents of PC are sent to MAR to signal a Read operation for Memory
After “Memory-Access” time has elapsed, the instruction Word is loaded into MDR
The contents of MDR are transferred into IR which decodes it and determine the
MAC type and the operands Mem1, Mem2 and Mem3
The address of Mem1 is sent to MAR, and the contents of MDR are transferred to R0
Similarly, the contents of Mem2 and Mem3 are stored respectively in R1 and R2
The contents of R1 and R2 are sent as operands to the ALU to execute the
multiplication operation and store the result in R3
The contents of R0 and R3 are sent as operands to the ALU to execute the add
operation and store the result in MDR with a Write control signal, and the address of
Mem1 is sent to MAR
2) g = 1 - 2*B[i];
lw $t0, 0($t1)
f = h + A[0] + B[C[1]];
lw $t0, 0($s5)
lw $t2, 0($t2)
sw $t0, 0($t1)
3) $s3 = 00000000000000000000000000000101
Name: Christophe El Haddad
ID: 201800866
Section: 2
$s4 = 11111110111111101111111011111111
4) First, we must create a mask containing a 1 at the position to be flipped. Then, we store
in $s0 the result of the content of $s0 XOR the mask.
j Loop
Another way to create the mask without using a loop (but in a memory demanding way)
is to create 32 consecutive words in memory, starting from a base address A, consisting
of 0x1, 0x2, 0x4, 0x8, 0x10, … , 0x80000000. To load a mask, we simply load the word
from the address (4*content of $s1 + A).
5)
1. The code permutes the entries of the matrix outside the main diagonal, so the
matrix becomes its transpose. Also, the code returns the maximum value of the
entries of the matrix.
2. The function returns 1 for the 10x10 identity matrix (and the new matrix A is still
the 10x10 identity matrix).