Please help me on this... Thanks a) Suppose three values x, y, and z are stores
ID: 3607835 • Letter: P
Question
Please help me on this... Thanks a) Suppose three values x, y, and z are stores in a machine'smemory. Describe the sequence of events ((loading registers frommemory, saving values in memory, and son on) that leads to thecomputation of 2x + 3y. b) Describe the process of converting a number in one randowmbase to base 10. c) Describe the process of converting a number in base 10 toany other base. Please help me on this... Thanks a) Suppose three values x, y, and z are stores in a machine'smemory. Describe the sequence of events ((loading registers frommemory, saving values in memory, and son on) that leads to thecomputation of 2x + 3y. b) Describe the process of converting a number in one randowmbase to base 10. c) Describe the process of converting a number in base 10 toany other base.Explanation / Answer
a) Suppose three values x, y, and z arestores in a machine's memory. Describe the sequence of events((loading registers from memory, saving values in memory, and sonon) that leads to the computation of 2x + 3y.load the value 2 into a register (r1) :: r1=2 most machines have somesort of load immediate instruction to do this
load the value 3 into a register (r2) :: r2=3
load the value of x from memory into a register(r3) :: r3=x
load the value of y from memory into a register(r4) :: r4 = y
multiply r1 and r3 results will be in one of the registers, letssay r1 :: r1=2*x
multiply r2 and r4 results will be in one of the registers, letssay r2 :: r2=3*y
add r1 and r2 results will be in one of the registers, letssay r1 :: r1=r1+r2
store value in r1 into memory locationz :: z = r1
b) Describe the process of converting anumber in one randowm base to base 10.
lets say you are converting the numberxyzn to base 10. first label each digits columnwith its "place" value. the value of the rightmost column isn0 the column to the left of it is n1 to theleft of that is n2 next column n3 and soon.
Then take each digit and multiply it by its column value. add allthe results. So xyzn would be
x(n2)+y(n1)+z(n0)
with realnumbers 3278=3*82+2*81+7*80 which is 3*64+2*8+7*1 = 192+16+7 = 215
3278=21510
c) Describe the process of converting a number in base 10to any other base.
To go from base 10 to another base divide thebase 10 number by the base you are converting to and use theremainder. Keep doing this using the quotient as yourdividend until the quotient is 0. The answer is theremainders. Last remainder is the most significant digit.
Example: 34210 to base 3 342/3 = 114 r 0 114/3 = 38 r0 38/3 = 12 r 2 12/3 =4 r0 4/3 = 1 r1
1/3 = 0 r 1 reading last remainder asmost significant digit 34210=1102003
to check convert base 3 to base 10 as above
0*1 =0 (1=30)
0*3 =0 (3=31)
2*9 =18 (9=32)
0*27 =0 (27=33)
1*81 =81 (81=34)
1*243=243 (243=35)
243+81+18=342