Control Unit - Q12

+2 votes

Consider a new instruction named branch-tri-equal (mnemonic bte) which is bte R1, R2, R3, label which compares contents of R1, R2, and R3 and if they are all equal then jumps to ‘label’

To emulate this instruction with beq instruction which can compare only 2 registers following sequence steps are executed

temp1 \leftarrow R1 \text{ \& }R2

temp2 \leftarrow R2 \text{ \& }R3

\text{beq X1, X2, label}

X1 , X2 respectively are  

(A) temp1 & temp2 , ~temp1 & temp2

(B) temp1 & temp2, ~temp1 & ~temp2

(C) temp1, temp2

(D) ~temp1, ~temp2

asked Jun 8 in Computer Organization by gbmentor (54,290 points)
reshown Jun 9 by gbmentor

1 Answer

0 votes
I think something is wrong here because no option is correct.

For example R1 = 1010. R2=1010

R3 =1010 now all are equal

R1&R2= 1010

R2&R3= 1010

So R1 R2 R3 all are equal new X1,X2 label go to label but only when x1 and X2 equal

A) option 1010,0000 not correct

B)1010,0101 not correct

C)1010,1010 we think here it is correct. Bit it is not because when we used R1=1010 R2=0101 R3=0000 now all are deffrent



No C) 0000,0000 but all are not equal

Same for D) 1111,1111

But all are not equal.

So all the option are not correct something miss in option


If someone know the the correct one than please reply which one or why.
answered Jun 9 by tsnikhilsharmagate2018 (19,690 points)
Taking R1=1010 and R2=0101 and R3=1111

temp1=0000     temp2 = 0101

Checking option A: X1 = 0101 and X2 = 0101 so equal

Checking option B: X1 = 0101 and X2 = 1010 so not equal

Checking option C: also not equal

Checking option D: also not equal

Taking R1=1100 and R2=1101 and R3=0110

temp1= 1100 and temp2= 0100

Checking option A: X1= 0100 and X2 = 0000 so not equal

Checking option B: X1= 0100 and X2=  0011 also not equal

Checking option C:  Not equal

Checking option D: Not Equal

Taking R1=1010 and R2=1010 and R3=1010

temp1= 1010 and temp2= 1010

Checking option A: X1= 1010 and X2 = 0000 so not equal

Checking option B: X1= 1010 and X2=  0101 also not equal

Checking option C:  equal

Checking option D:  Equal

None of the options seems to be correct on different and same values for R1 R2 and R3.