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, 22.06.2019 22:40
Write a program that defines symbolic names for several string literals (chars between quotes). * use each symbolic name in a variable definition. * use of symbolic to compose the assembly code instruction set can perform vara = (vara - varb) + (varc - vard); ensure that variable is in unsigned integer data type. * you should also further enhance your symbolic logic block to to perform expression by introducing addition substitution rule. vara = (vara+varb) - (varc+vard). required: debug the disassembly code and note down the address and memory information.
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
question
Computers and Technology, 24.06.2019 16:30
You may see the term faq on websites which stands for frequently asked questions this is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation ken has dipped many dark chocolate marshmallows (which you remember the metric system distance units in decreasing order: kilometers, hectometer, decameter, centimeter, millimeter) is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation !
Answers: 1
question
Computers and Technology, 24.06.2019 17:00
Anew author is in the process of negotiating a contract for a new romance novel. the publisher is offering three options. in the first option, the author is paid $5,000 upon delivery of the final manuscript and $20,000 when the novel is published. in the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold. in the third option, the author is paid 10% of the net price for the first 4,000 copies sold, and 14% of the net price for the copies sold over 4,000. the author has some idea about the number of copies that will be sold and would like to have an estimate of the royal- ties generated under each option. write a program that prompts the author to enter the net price of each copy of the novel and the estimated number of copies that will be sold. the program then outputs he royalties under each option and the best option the author could choose. (use appropriate named constants to store the special values such as royalty rates and fixed royalties.
Answers: 1
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
Mathematics, 30.10.2020 20:50
question
Arts, 30.10.2020 20:50
question
Mathematics, 30.10.2020 20:50
Questions on the website: 13722362