Computer Architecture Assignment: Number Systems and IEEE 754
VerifiedAdded on 2025/08/07
|17
|1712
|426
AI Summary
Desklib provides solved assignments and past papers to help students succeed.

Contents
Sol.1...........................................................................................................................................2
Ans. a)....................................................................................................................................2
Ans. b) i).................................................................................................................................3
Ans. b) ii)...............................................................................................................................5
Ans. b) iii)..............................................................................................................................6
Ans. b) iv)...............................................................................................................................7
Sol.2...........................................................................................................................................9
Ans. a)....................................................................................................................................9
Ans. b)..................................................................................................................................10
Sol 3.........................................................................................................................................14
Ans. a)..................................................................................................................................14
Ans. b)..................................................................................................................................15
References................................................................................................................................17
Sol.1...........................................................................................................................................2
Ans. a)....................................................................................................................................2
Ans. b) i).................................................................................................................................3
Ans. b) ii)...............................................................................................................................5
Ans. b) iii)..............................................................................................................................6
Ans. b) iv)...............................................................................................................................7
Sol.2...........................................................................................................................................9
Ans. a)....................................................................................................................................9
Ans. b)..................................................................................................................................10
Sol 3.........................................................................................................................................14
Ans. a)..................................................................................................................................14
Ans. b)..................................................................................................................................15
References................................................................................................................................17
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Sol.1
Ans. a)
The given binary digits are
0 01111110 10100000000000000000000
To convert the IEEE-754 into Decimal number, following formula is used:
(-1)sign bit * (1+fraction) * 2exponent – Bias …( i)
Here first digit shows the sign
If it is 0, number is positive
If it is 1, number is negative
Here the sign bit is positive (+) …(ii)
Next 8 digits show the exponents
To find out exponent, first, the number should be converted to Decimal.
0 ×20+1 ×21 +1 ×22 +1× 23 +1× 24 +1 ×25 +1× 26 +0 ×27
¿ 2+4 +8+16+ 32+64
Exponent =(126)10 …(iii)
Now, this exponent can be used in the above formula of converting IEEE-754 into Decimal
digit.
Now fraction number should be calculated
1×20+0×2-1+1×2-2+0×2-3+0×2-4+0×2-5+0×2-6+0×2-7+0×2-8+0×2-9+0×2-10+0×2-11+0×2-12+0×2-
13+0×2-14+0×2-15+0×2-16+0×2-17+0×2-18+0×2-19+0×2-20+0×2-21+0×2-22
1+ 1
4
¿ 5
4 =1.25
Ans. a)
The given binary digits are
0 01111110 10100000000000000000000
To convert the IEEE-754 into Decimal number, following formula is used:
(-1)sign bit * (1+fraction) * 2exponent – Bias …( i)
Here first digit shows the sign
If it is 0, number is positive
If it is 1, number is negative
Here the sign bit is positive (+) …(ii)
Next 8 digits show the exponents
To find out exponent, first, the number should be converted to Decimal.
0 ×20+1 ×21 +1 ×22 +1× 23 +1× 24 +1 ×25 +1× 26 +0 ×27
¿ 2+4 +8+16+ 32+64
Exponent =(126)10 …(iii)
Now, this exponent can be used in the above formula of converting IEEE-754 into Decimal
digit.
Now fraction number should be calculated
1×20+0×2-1+1×2-2+0×2-3+0×2-4+0×2-5+0×2-6+0×2-7+0×2-8+0×2-9+0×2-10+0×2-11+0×2-12+0×2-
13+0×2-14+0×2-15+0×2-16+0×2-17+0×2-18+0×2-19+0×2-20+0×2-21+0×2-22
1+ 1
4
¿ 5
4 =1.25

As it is fraction number, it will be,
fraction=0.125 …(iv)
By substituting the values of sign bit, exponent and fraction in eq. (i), from eq. (ii), eq. (iii)
eq. (iv)
¿+1 ×(1+0.125)× 2126−127
¿+1.125 ×2−1
¿+ 0.5625
Therefore, Given Binary number in IEEE-754 format will be +0.5625 in Decimal (Carlough,
2016).
Ans. b) i)
0x shows that it’s a Hexadecimal number
Therefore, (AD9)16
A ×162+D ×161+ 9× 160
(Here, A=10 and D=13)
10 ×162 +13 ×161+9× 160
2560+208+9
¿( 2777)10
Now to convert above decimal term into base-3, above term is divided by 3 remainders is
calculated.
fraction=0.125 …(iv)
By substituting the values of sign bit, exponent and fraction in eq. (i), from eq. (ii), eq. (iii)
eq. (iv)
¿+1 ×(1+0.125)× 2126−127
¿+1.125 ×2−1
¿+ 0.5625
Therefore, Given Binary number in IEEE-754 format will be +0.5625 in Decimal (Carlough,
2016).
Ans. b) i)
0x shows that it’s a Hexadecimal number
Therefore, (AD9)16
A ×162+D ×161+ 9× 160
(Here, A=10 and D=13)
10 ×162 +13 ×161+9× 160
2560+208+9
¿( 2777)10
Now to convert above decimal term into base-3, above term is divided by 3 remainders is
calculated.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Divisor Remainder
2777 / 3 925 2
925 / 3 308 1
308 / 3 102 2
102 / 3 34 0
34 / 3 11 1
11 / 3 3 2
3 / 3 1 0
1 / 3 0 1
By taking the remainders downward side:
¿( 0210212)3
Therefore, ( AD 9)16 in 3-base representation will be:
( AD9)16=(0210212)3
2777 / 3 925 2
925 / 3 308 1
308 / 3 102 2
102 / 3 34 0
34 / 3 11 1
11 / 3 3 2
3 / 3 1 0
1 / 3 0 1
By taking the remainders downward side:
¿( 0210212)3
Therefore, ( AD 9)16 in 3-base representation will be:
( AD9)16=(0210212)3
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Ans. b) ii)
To convert (4518)10 into Binary number, the number 4518 will be divided by 2 and remainder
will be calculated.
Divisor Remainder
451 / 2 225 1
225 / 2 112 1
112 / 2 56 0
56 / 2 28 0
28 / 2 14 0
14 / 2 7 0
7 / 2 3 1
3 / 2 1 1
1 / 2 0 1
To convert (4518)10 into Binary number, the number 4518 will be divided by 2 and remainder
will be calculated.
Divisor Remainder
451 / 2 225 1
225 / 2 112 1
112 / 2 56 0
56 / 2 28 0
28 / 2 14 0
14 / 2 7 0
7 / 2 3 1
3 / 2 1 1
1 / 2 0 1

By taking the remainders downward side:
¿( 1000110100110)2
Therefore, (4518)10 in Binary will be:
(4518)10=(1000110100110)2
Ans. b) iii)
To convert (123.3)5 into octal number, first, it should be converted into decimal
¿ 3 ×50 +2 ×51+1 ×52
¿ 3+10+25
Integer=38
For the fraction part,
¿ 3 ×50
fraction=0.3
Therefore, (123.3)5 in decimal will be
¿( 38.3)10
Divisor Remainder
38 / 8 4 6
4 / 8 0 4
By taking the remainders from downwards:
¿( 46)8
Now the fraction part will be calculated:
¿( 1000110100110)2
Therefore, (4518)10 in Binary will be:
(4518)10=(1000110100110)2
Ans. b) iii)
To convert (123.3)5 into octal number, first, it should be converted into decimal
¿ 3 ×50 +2 ×51+1 ×52
¿ 3+10+25
Integer=38
For the fraction part,
¿ 3 ×50
fraction=0.3
Therefore, (123.3)5 in decimal will be
¿( 38.3)10
Divisor Remainder
38 / 8 4 6
4 / 8 0 4
By taking the remainders from downwards:
¿( 46)8
Now the fraction part will be calculated:
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Product Main Digit Fraction Digit
.30 × 8 2.4 2 0.4
0.4 × 8 3.2 3 0.2
0.2 × 8 1.6 1 0.6
Now calculating three main digits from upward, Fraction number will be achieved
Hence, (123.3)5 in Octal will be:
(123.3)5=(46.231)2
Ans. b) iv)
The given digits are
14.35 with Octal representation
To convert the octal into Decimal, following process should be followed.
For the Integer part,
4 ×80+1 × 81
¿ 4 +8
Integer=(12)10 …(iii)
Now fraction number (0.35)8 should be calculated
¿ 5 ×8−1+ 3× 80
¿ 5 × 1
8 + 3
¿ 0.625+3
¿ 3.625
¿ Fraction=0.3625
.30 × 8 2.4 2 0.4
0.4 × 8 3.2 3 0.2
0.2 × 8 1.6 1 0.6
Now calculating three main digits from upward, Fraction number will be achieved
Hence, (123.3)5 in Octal will be:
(123.3)5=(46.231)2
Ans. b) iv)
The given digits are
14.35 with Octal representation
To convert the octal into Decimal, following process should be followed.
For the Integer part,
4 ×80+1 × 81
¿ 4 +8
Integer=(12)10 …(iii)
Now fraction number (0.35)8 should be calculated
¿ 5 ×8−1+ 3× 80
¿ 5 × 1
8 + 3
¿ 0.625+3
¿ 3.625
¿ Fraction=0.3625
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

By the values of Integer number and fraction number
(14.35)8=(12.3625)10
(14.35)8=(12.3625)10

Sol.2
Ans. a)
Prime number “i” is the one with only two divisors in which one is 1 and another is itself.
Algorithm:
Step1. Take input “n”
Step2. Run a loop that starts from i=n and to 1. Ensure if I divide n or not.
Step3. Keep count of all the numbers that are divisors of n.
Step4. If divisor count is 2, then it’s a prime number.
Steps:
Load data from location of memory, 2029H, in the accumulator.
Start register C with OOH and it will store divisors number of n.
Move value in the accumulator in E and this will work as iterator for loop.
Move value in accumulator in B and it will store the value permanently because new value
will replace old value in accumulator.
Move value in E to the D and division should be performed and accumulator will be dividend
and D will be divisor.
Value in D should be kept on subtracting from A till it becomes 0 or below then it. Now
check a value in accumulator, if it is 0, increase divisor count by increasing C value.
Restore accumulator value by moving B value to A and keep continue the loop until the value
in E becomes 0.
Again now move divisor number from C to the A and ensure if value is 2. If it’s 2 then store
value 01H into 202AH or else if it is not 2 then collect 001-1
Ans. a)
Prime number “i” is the one with only two divisors in which one is 1 and another is itself.
Algorithm:
Step1. Take input “n”
Step2. Run a loop that starts from i=n and to 1. Ensure if I divide n or not.
Step3. Keep count of all the numbers that are divisors of n.
Step4. If divisor count is 2, then it’s a prime number.
Steps:
Load data from location of memory, 2029H, in the accumulator.
Start register C with OOH and it will store divisors number of n.
Move value in the accumulator in E and this will work as iterator for loop.
Move value in accumulator in B and it will store the value permanently because new value
will replace old value in accumulator.
Move value in E to the D and division should be performed and accumulator will be dividend
and D will be divisor.
Value in D should be kept on subtracting from A till it becomes 0 or below then it. Now
check a value in accumulator, if it is 0, increase divisor count by increasing C value.
Restore accumulator value by moving B value to A and keep continue the loop until the value
in E becomes 0.
Again now move divisor number from C to the A and ensure if value is 2. If it’s 2 then store
value 01H into 202AH or else if it is not 2 then collect 001-1
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Address Label Mnemonic
2000H LDA 2029H
2001H
2002H MVI C, 00H
2003H
2004H
2005H MOV E, A
2006H MOV B, A
2007H LOOP1 MOV D, E
2008H LOOP2 CMP D
2009H JCDIVIDENDLESSTHAN0
200AH
200BH
200CH SUB D
200DH JNZ LOOP2
200EH
200FH
2010H DIVIDENDLESSTHAN0 CPI 00H
2011H
2012H JNZ NOTADIVISOR
2013H
2014H
2015H INR C
2016H NOTADIVISOR MOV A, B
2017H DCR E
2018H JNZ LOOP1
2019H
201AH
201BH MOV A, C
201CH MVI C, 00H
201DH
201EH CPI 02H
201FH
2020H JNZ COMPOSITE
2021H
2022H
2023H INR C
2024H COMPOSITE MOV A, C
2025H STA 202AH
2026H
2027H
2028H HLT
Ans. b)
Prime number MARIE program
2000H LDA 2029H
2001H
2002H MVI C, 00H
2003H
2004H
2005H MOV E, A
2006H MOV B, A
2007H LOOP1 MOV D, E
2008H LOOP2 CMP D
2009H JCDIVIDENDLESSTHAN0
200AH
200BH
200CH SUB D
200DH JNZ LOOP2
200EH
200FH
2010H DIVIDENDLESSTHAN0 CPI 00H
2011H
2012H JNZ NOTADIVISOR
2013H
2014H
2015H INR C
2016H NOTADIVISOR MOV A, B
2017H DCR E
2018H JNZ LOOP1
2019H
201AH
201BH MOV A, C
201CH MVI C, 00H
201DH
201EH CPI 02H
201FH
2020H JNZ COMPOSITE
2021H
2022H
2023H INR C
2024H COMPOSITE MOV A, C
2025H STA 202AH
2026H
2027H
2028H HLT
Ans. b)
Prime number MARIE program
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

ORG 100
Input /it takes the input from user
Store userInput /Stores the input
Store B /userinput B is stored for loop
Store A /userinput A is stored for division
Load B
Subt One /loop from n-1 - 2 that checks user input is divisible by other number or not
Store B /store value
Load userInput /input is greater than 1 or not
Subt One /isn’t greater than output is 0
Skipcond 800
Jump invalid
loop, Load B /loop from n-1 to 2
Subt One
Skipcond 400
Jump gtTwo
Load One /if input can’t divided by number 2 to n-1, it shows number isn’t prime
Output /0 Output with given case
Halt
gtTwo, Jump divide
after, Load RES
Skipcond 800 /if B divide A then input is not prime number
Jump cNext /if it isn't then checked B-1
Input /it takes the input from user
Store userInput /Stores the input
Store B /userinput B is stored for loop
Store A /userinput A is stored for division
Load B
Subt One /loop from n-1 - 2 that checks user input is divisible by other number or not
Store B /store value
Load userInput /input is greater than 1 or not
Subt One /isn’t greater than output is 0
Skipcond 800
Jump invalid
loop, Load B /loop from n-1 to 2
Subt One
Skipcond 400
Jump gtTwo
Load One /if input can’t divided by number 2 to n-1, it shows number isn’t prime
Output /0 Output with given case
Halt
gtTwo, Jump divide
after, Load RES
Skipcond 800 /if B divide A then input is not prime number
Jump cNext /if it isn't then checked B-1

Load Zero
Output
Halt
cNext, Load userInput
Store A
Load B
Subt One
Store B
Jump loop
Divide, Load A / set RES 1, when B divide A or 0 if it isn’t then
Skipcond 800 /if AC is greater than 0, continue the loop
Jump final /else final jump
Load A
Subt B
Store A
Jump divide
Final, Load A
Skipcond 400 /if AC = 0 then, A divided by B
Jump notDb /or jump notDb
Load One
Store RES
Jump after
notDb, Load Zero /0 stored in RES if A can’t divide A
Output
Halt
cNext, Load userInput
Store A
Load B
Subt One
Store B
Jump loop
Divide, Load A / set RES 1, when B divide A or 0 if it isn’t then
Skipcond 800 /if AC is greater than 0, continue the loop
Jump final /else final jump
Load A
Subt B
Store A
Jump divide
Final, Load A
Skipcond 400 /if AC = 0 then, A divided by B
Jump notDb /or jump notDb
Load One
Store RES
Jump after
notDb, Load Zero /0 stored in RES if A can’t divide A
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 17
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.