Question No. 5
(a) 0X48 + 0X75
Solution: The question demands us to solve the operation in the binary number system and then convert the result back to the hexadecimal number system.
Step 1: Convert the hexadecimal numbers into binary
As we know the hexadecimal number has base 16 (24) and binary numbers have base 2 and one can directly convert hexadecimal number into binary number without going into decimal number. The approach is writing each digit of hexadecimal number into its corresponding 4 digit binary code. eg. 0X4 corresponds to B'0100' and so on. Hence,
0x48 corresponds to B'01001000'
0X75 corresponds to B'01110101'
Step 2: Now add two binary numbers
As we know the rules of binary addition, but for quick reference, the same is reiterated below
B'0' + B'0' = B'0'
B'0' + B'1' = B'1'
B'1' + B'1' = B'0' and Carry B'1', Hence
B'01001000' + B'01110101' = B'10111101'
Step 3: Status of DC, Z & C Flag
DC flag: As we know during addition operation, DC or Digital Carry flag sets iff there is carry generated at digit 3. In the above example since that was not the case hence the DC flag remains reset.
Z flag: As we know during any arithmetic operation, if the end result is zero then only this flag sets else remain reset. In the above example, it shall be reset only.
C flag: As we know during addition operation the carry flag sets to indicate the presence of final carry. In the above example, there is no final carry generated by digit 7. Hence that flag remains reset.
Step 4: Converting the result back into the hexadecimal number
Using the reverse approach of step 1, the conversion could be achieved. All we need to do is to split the end result of 8 bits into two nibbles of 4 bits and then we need to write it's equivalent hexadecimal number. eg. B'1011' = 0XB, B'1101' = 0XD.
Hence, B'10111101' = 0XBD
Step 5: Repeat the above for (b) & (c)
(d) 0X56 - 0XAD = ?
Step 1: This step is same as the above solution. Hence
0X56 = B'01010110'
0XAD = B'10101101'
Step 2: Subtraction: The following are the rules of binary subtraction.
B'1' - B'0' = B'1'
B'1' - B'1' = B'0'
B'0' - B'0' = B'0'
B'0' - B'1' = B'1' with Borrow B'1'
With the help of above rules
B'0101 0110'
- B'1010 1101'
= B'1010 1001' with Borrow B'1'
Step 3: Status of DC, Z & C Flag
DC flag: Doesn't get affected in subtraction operation, hence remains reset.
Z flag: As we know during any arithmetic operation, if the end result is zero then only this flag sets else remain reset. In the above example, it shall be reset only.
C flag: As we know during subtraction operation the carry flag sets to indicate the presence of final borrow. In the above example, there is final borrow generated by digit 7. Hence that flag remains set.
Step 4: Converting the result back into the hexadecimal number
Similar to the above solution, eg. B'1001' = 0X9, B'1010' = 0XA.
Hence, B'10101001' = 0XA9 with Borrow
Step 5: Repeat the above for (e) & (f)
Q6.
(a) 0X40 AND 0X7F
Step 1: Convert hex to binary as per question
0X40 = B'01000000'
0X7F = B'01111111'
Step 2: AND Operation, As we know in AND operation if both inputs are B'1' then only output is B'1' else B'0'
B'01000000'
AND B'01111111'
= B'01000000'
Step 3: Status of DC, Z & C Flag
DC flag: Doesn't get affected in logical operations.
Z flag: As we know during any operation, if the end result is zero then only this flag sets else remain reset. In the above example, it shall be reset only.
C flag: Doesn't get affected in logical operations.
Step 4: Converting the result back into the hexadecimal number
Similar to the above solution,
Hence, B'01000000' = 0X40
Step 5: Repeat the above for (d)
(b) 0XEO IOR 0XAF
Step 1: Convert hex to binary as per question
0XE0 = B'11100000'
0XAF = B'10101111'
Step 2: IOR Operation, As we know in IOR operation if both inputs are B'0' then only output is B'0' else B'1'
B'11100000'
IOR B'10101111'
= B'11101111'
Step 3: Status of DC, Z & C Flag
DC flag: Doesn't get affected in logical operations.
Z flag: As we know during any operation, if the end result is zero then only this flag sets else remain reset. In the above example, it shall be reset only.
C flag: Doesn't get affected in logical operations.
Step 4: Converting the result back into the hexadecimal number
Similar to the above solution,
Hence, B'11101111' = 0XEF
Step 5: Repeat the above for (e)
(f) 0X49 XOR 0X49
Step 1: Convert hex to binary as per question
0X49 = B'01001001'
Step 2: XOR Operation, As we know in XOR operation if both inputs are different then only output is B'1' else B'0'
B'01001001'
XOR B'01001001'
= B'00000000'
Step 3: Status of DC, Z & C Flag
DC flag: Doesn't get affected in logical operations.
Z flag: As we know during any arithmetic operation, if the end result is zero then only this flag sets else remain reset. In the above example, it shall be set only.
C flag: Doesn't get affected in logical operations.
Step 4: Converting the result back into the hexadecimal number
Similar to the above solution,
Hence, B'00000000' = 0X00
Step 5: Repeat the above for (f)
3. Perform the following arithmetic operations in Binary and present your resu indicate the C &Z...
6. Convert .3710 to a binary fraction of 10 binary digits. 7. Use two's compliment arithmetic to perform the following 8 bit binary operations. a. 0010 1110 + 0001 1011 b. 0101 1101 – 0011 1010 c. 1011 1000 – 1000 1011 d. 1000 1100 – 1111 0111 8. Convert 150.8476562510 to IEEE Floating Point Standard. 9. Simplify the following Boolean expressions. a. xy + xy + xz b. (w + x)(x + y)(w + x + y + z)...
All of the following questions are in relation to the following journal article which is available on Moodle: Parr CL, Magnus MC, Karlstad O, Holvik K, Lund-Blix NA, Jaugen M, et al. Vitamin A and D intake in pregnancy, infant supplementation and asthma development: the Norwegian Mother and Child Cohort. Am J Clin Nutr 2018:107:789-798 QUESTIONS: 1. State one hypothesis the author's proposed in the manuscript. 2. There is previous research that shows that adequate Vitamin A intake is required...