Question: Using the following 3 instructions: HALT, stops the program INC r j, increments the contents of register r, and moves to instruction number j DEB

Using the following 3 instructions:
HALT, stops the program
INC r j, increments the contents of register r, and moves to instruction number j
DEB r i j, If contents of register r is > 0 then decrement the register and move to instruction i, else move to instruction j.
Q3. Write a register program for computing the number of l's in the binary expansion of a number n. n is provided as input, say in register 2. Test the program using the emulator. CNT R2 will return the number of ls in the binary expansion of the number is R2. The result will be store in R1. Q3. Write a register program for computing the number of l's in the binary expansion of a number n. n is provided as input, say in register 2. Test the program using the emulator. CNT R2 will return the number of ls in the binary expansion of the number is R2. The result will be store in R1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
