Question

In: Computer Science

Given byte-addressed memory with location 0x100 containing 0x62 and location 0x101 containing 0x7C. What is the...

Given byte-addressed memory with location 0x100 containing 0x62 and location 0x101 containing 0x7C. What is the decimal value of the signed short stored at location 0x100:

  1. Assuming big-endian addressing.

  2. Assuming little-endian addressing.

You may assume that a short occupies 2 bytes.

Solutions

Expert Solution

a)
big-endian
hex value is 0x627C

Hexadecimal     Binary
    0           0000
    1           0001
    2           0010
    3           0011
    4           0100
    5           0101
    6           0110
    7           0111
    8           1000
    9           1001
    A           1010
    B           1011
    C           1100
    D           1101
    E           1110
    F           1111
Use this table to convert from hexadecimal to binary
Converting 627C to binary
6 => 0110
2 => 0010
7 => 0111
C => 1100
So, in binary 627C is 0110001001111100

Now converting 0x627C to decimal
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 110001001111100 to decimal
110001001111100
=> 1x2^14+1x2^13+0x2^12+0x2^11+0x2^10+1x2^9+0x2^8+0x2^7+1x2^6+1x2^5+1x2^4+1x2^3+1x2^2+0x2^1+0x2^0
=> 1x16384+1x8192+0x4096+0x2048+0x1024+1x512+0x256+0x128+1x64+1x32+1x16+1x8+1x4+0x2+0x1
=> 16384+8192+0+0+0+512+0+0+64+32+16+8+4+0+0
=> 25212
Answer: 25212

b)
little-endian
hex value is 0x7C62

Hexadecimal     Binary
    0           0000
    1           0001
    2           0010
    3           0011
    4           0100
    5           0101
    6           0110
    7           0111
    8           1000
    9           1001
    A           1010
    B           1011
    C           1100
    D           1101
    E           1110
    F           1111
Use this table to convert from hexadecimal to binary
Converting 7C62 to binary
7 => 0111
C => 1100
6 => 0110
2 => 0010
So, in binary 7C62 is 0111110001100010

Now converting 0x7C62 to decimal
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 111110001100010 to decimal
111110001100010
=> 1x2^14+1x2^13+1x2^12+1x2^11+1x2^10+0x2^9+0x2^8+0x2^7+1x2^6+1x2^5+0x2^4+0x2^3+0x2^2+1x2^1+0x2^0
=> 1x16384+1x8192+1x4096+1x2048+1x1024+0x512+0x256+0x128+1x64+1x32+0x16+0x8+0x4+1x2+0x1
=> 16384+8192+4096+2048+1024+0+0+0+64+32+0+0+0+2+0
=> 31842
Answer: 31842



Related Solutions

Assume a 222 byte memory: a. What are the lowest and highest addresses if memory is...
Assume a 222 byte memory: a. What are the lowest and highest addresses if memory is byte-addressable? b. What are the lowest and highest addresses if memory is word-addressable, assuming a 16-bit word? c. What are the lowest and highest addresses if memory is word-addressable, assuming a 32-bit word? Explain with Steps please
Write an assembly code the counts the number of accuracies of the byte AAh in memory...
Write an assembly code the counts the number of accuracies of the byte AAh in memory from address 120Ah to address 130Ah. You need to use a subroutine and call it 'COUNT' to do so. You also need to provide the count in BCD if it was less than 64h so that you need to include another subroutine called 'ToBCD' to do so. assembly 8086
If SI = 1000H, what does MOV [SI], BH do? Reads byte of data from memory...
If SI = 1000H, what does MOV [SI], BH do? Reads byte of data from memory location 1000H into BH Writes byte of data from BH into memory location 1000H Illegal, only DI can be used between [ ] s Illegal, mixed sizes Translate the statement “All your friends are perfect” into a logical expression. Let P(x) be “x is perfect” and F(x) be “x is your friend” and the universe of discourse be all the people. ∀xF(x) → ∃xP(x)...
Write an inline assembly program that initializes a 100 byte area of memory to 0xFF using...
Write an inline assembly program that initializes a 100 byte area of memory to 0xFF using the STOS instruction with REP using DWORD transfers.
Question 1) Given the byte value: 0xad a) What is the equivalent decimal notation as an...
Question 1) Given the byte value: 0xad a) What is the equivalent decimal notation as an unsigned value? b_ What is the equivalent decimal notation as a signed value? Question 2) Below are integer values and the location where each is stored, which may be an address in memory or a register: Value    Location 0xc       0x130 0x82     0x134 0x5       %rdi 0x134    %rsi What are the values of the following operands? You may answer in decimal or hexadecimal, but if you...
20. A __________________ is a combinational circuit that is useful in selecting a       memory location...
20. A __________________ is a combinational circuit that is useful in selecting a       memory location according to a binary value that is placed on the address lines of a       memory bus.       A). multiplexer       B). gate       C). transistor       D). decoder 21. A _______________ is a combinational circuit that selects a single output from       multiple inputs.       A). decoder       B). multiplexer       C). AND gate       D). OR gate 22. ___________________ creates logic diagrams...
-If we assume we place the following MIPS code starting at location 8000 in memory, what...
-If we assume we place the following MIPS code starting at location 8000 in memory, what is the MIPS machine code for this code? Show the machine codes in decimal. Please explain each instruction and specify its type ( R format, I format, or J format). k corresponds to register $s4, j corresponds to register $s1, i corresponds to register $s0, and the base of the array v is in $a0 addi $s1,$s0,-1 label2: slti $t0, $s1, 0 bne $t0,...
Suppose a computer using direct mapped cache has 224 bytes of byte-addressable main memory, and a...
Suppose a computer using direct mapped cache has 224 bytes of byte-addressable main memory, and a cache of 128 blocks, where each cache block contains 8 bytes. For fully associative cache, to which block of cache the address 0x189B5A maps? Group of answer choices Block 6 Block 75 Not enough information Block 10
A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes...
A direct-mapped cache consists of 8 blocks. Byte-addressable main memory contains 4K blocks of 8 bytes each. Access time for the cache is 22ns, and the time required to fill a cache slot from main memory is 300ns. (This time allows us to determine the block is missing and bring it into cache.) Assume a request is always started in parallel to both cache and to main memory(so if it is not found in cache, we do not have to...
Assume that 20 bytes of Packed BCD data is present in a data memory at location...
Assume that 20 bytes of Packed BCD data is present in a data memory at location 0x300 to 0x313. You have to write an assembly program that will display data on a two seven segment displays one connected to Port A and other connected to Port B using loops. You also have to analyze data if the data is equal to 0x22 then start storing data bytes at corresponding memory address 0x400 to 0x413 in reverse order i.e. if the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT