60 likes | 228 Views
מבנה המחשב – מבוא למחשבים ספרתיים. The ISA of the Simplified DLX. Problem #1. if(i==j) goto L1; f=g+h; L1: f=f-i;. xor r1 r19 r20 beqz r1 1 add r16 r17 r18 sub r16 r16 r19. LEGEND: r16 = f r17 = g r18 = h r19 = i r20 = j r21 = k. Problem #2. if(i==j) skip to else f=g+h; else
E N D
מבנה המחשב – מבוא למחשבים ספרתיים The ISA of the Simplified DLX
Problem #1 if(i==j) goto L1; f=g+h; L1: f=f-i; xor r1 r19 r20 beqz r1 1 add r16 r17 r18 sub r16 r16 r19 LEGEND: r16 = f r17 = g r18 = h r19 = i r20 = j r21 = k
Problem #2 if(i==j) skip to else f=g+h; else f=g-h; xor r1 r19 r20 bnez r1 2 add r16 r17 r18 beqz r1 1 sub r16 r17 r18
Problem #3 LOOP: g=g + A[i] ; i=i+j; if((i!=h) goto LOOP; addi r4 r0 Astart add r1 r4 r19 lw r2 r1 0 add r17 r17 r2 add r19 r19 r20 xor r3 r19 r18 bnez r3 -6 Address of A[0] = Astart
Problem #4 while ( save[i] == save[k-i] ) i=i+1; addi r4 r0 Sstart add r1 r4 r19 sub r2 r20 r19 add r3 r4 r2 lw r5 r1 0 lw r6 r3 0 xor r7 r5 r6 bnez r7 2 addi r19 r19 1 beqz r0 -9 Address of save[0] = Sstart
Problem #5 addi r4 r21 0 bnez r4 2 add r16 r19 r20 beqz r0 11 addi r4 r4 -1 bnez r4 2 add r16 r17 r18 beqz r0 7 addi r4 r4 -1 bnez r4 2 sub r16 r17 r18 beqz r0 3 addi r4 r4 -1 bnez r4 1 sub r16 r19 r20 switch(k){ case 0: f=i+j; break; case 1: f=g+h; break; case 2: f=g-h; break; case 3: f=i-j; }