SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Linda Null ,julia Lobur
Chapter:
A Closer Look At Instruction Set Architectures
Exercise:
Exercises
Question:3 | ISBN:9780763704445 | Edition: 3

Question

3. The first two bytes of a 2M 16 main memory have the following hex values:

  • Byte 0 is FE

  • Byte 1 is 01

If these bytes hold a 16-bit two’s complement integer, what is its actual decimal value if:

a) Memory is big endian?

b) Memory is little endian?

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

From the given information Byte 0=FE and Byte 1= 01, which holds two’s compliment value

a) when we represent the given information in big endian format :

Byte 0

Byte 1

 

01

FE

 

When we convert (01 FE) into binary:(0000 0001 1111 1110)

To get the actual decimal value from the given two’s compliment binary value , we have to perform two’s compliment again for the binary value (since two’s compliment is a self compliment code).

Two’s compliment = one’s compliment +1

One’s compliment (0000 0001 1111 1110) = 1111 1110 0000 0001

two’s compliment = one’s compliment+1   =                               +1
                                                                   = 1111 1110 0000 0010

The decimal equivalent (1111 1110 0000 0010)2 = (65026)10 

b)  when we represent the given information in Little endian format :

Byte 1

Byte 0

 

FE

01

 

When we convert (FE 01) into binary:(1111 1110 0000 0001)

To get the actual decimal value from the given two’s compliment binary value , we have to perform two’s compliment again for the binary value (since two’s compliment is a self compliment code).

Two’s compliment = one’s compliment +1

One’s compliment (1111 1110 0000 0001) = 0000 0001 1111 1110

two’s compliment = one’s compliment+1   =                               +1
                                                                   = 0000 0001 1111 1111

The decimal equivalent (0000 0001 1111 1111)2 = (511)10      

0 0

Discussions

Post the discussion to improve the above solution.