subject

1. For this assignment you will print the steps for 8-bit by 8-bit multiplication. 2. Your program should read in two unsigned numbers from stdin, the first being the multiplicand and the second being the multiplier. Your program should verify that both values are within the range 0 to 255. If not, the program should print an appropriate error message and exit.
3. Your program should then initialize the simulated registers and echo the input values in decimal and also in binary.
4. Then your program should illustrate the eight steps required for multiplication using the same type of step diagrams as given in the lecture notes.
5. Finally, your program should print a check section that shows a summary of the multiplication in binary as well as in decimal. See the example below.
6. You may write your program in C, C++, or Java. If you choose to work in C, here is an example function that will allow you to represent an n-bit value within an int data type and print out the binary value in "length" bits. It uses the shift right operator and the bitwise and. (You can also choose to use unsigned int as the data type; since you are using only the lower 8 of the 32 bits in an int, there will be no apparent difference between using int and using unsigned int. However, if you choose to use char as the data type, you should use unsigned char to ensure that the compiler generates logical rather than arithmetic shifts.)
void prt_bin( int value, int length ){
int i;
for( i=(length-1); i>=0; i--){
if((value>>i)&1)
putchar('1');
else
putchar('0');
}
}
For example, if you declare acc as an int, then you could call prt_bin(acc,8) to print the 8-bit value in the accumulator.
You should format your output to exactly match the output below. 10% of the grade will be awarded for following the same format.
Sample Run is given below:
multiplicand: 33
multiplier: 55
c and acc set to 0
mq set to multiplier = 55 decimal and 00110111 binary
mdr set to multiplicand = 33 decimal and 00100001 binary

step 1: 0 00000000 00110111
+ 00100001 ^ add based on lsb=1

0 00100001 00110111
>> shift right
0 00010000 10011011

step 2: 0 00010000 10011011
+ 00100001 ^ add based on lsb=1

0 00110001 10011011
>> shift right
0 00011000 11001101

step 3: 0 00011000 11001101
+ 00100001 ^ add based on lsb=1

0 00111001 11001101
>> shift right
0 00011100 11100110

step 4: 0 00011100 11100110
+ 00000000 ^ no add based on lsb=0

0 00011100 11100110
>> shift right
0 00001110 01110011

step 5: 0 00001110 01110011
+ 00100001 ^ add based on lsb=1

0 00101111 01110011
>> shift right
0 00010111 10111001

step 6: 0 00010111 10111001
+ 00100001 ^ add based on lsb=1

0 00111000 10111001
>> shift right
0 00011100 01011100

step 7: 0 00011100 01011100
+ 00000000 ^ no add based on lsb=0

0 00011100 01011100
>> shift right
0 00001110 00101110

step 8: 0 00001110 00101110
+ 00000000 ^ no add based on lsb=0

0 00001110 00101110
>> shift right
0 00000111 00010111

check: binary decimal
00100001 33
x 00110111 x 55

0000011100010111 1815

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:50
Explain why it is reasonable to assume that receiving 3 duplicate acks in tcp is an indication that the network is not currently congested.
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
What is a distinguishing feature of today’s graphic application software?) graphic applications are used today on a variety of devices, including touch-screen kiosks and mobile phones.
Answers: 3
question
Computers and Technology, 22.06.2019 23:20
How can you tell if someone sent you a text message to your email instead of a email
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Which feature of a blog to restore and retrieve older post
Answers: 3
You know the right answer?
1. For this assignment you will print the steps for 8-bit by 8-bit multiplication. 2. Your program...
Questions
question
Biology, 14.11.2019 02:31
question
Mathematics, 14.11.2019 02:31
Questions on the website: 13722363