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
The following code segment is stored in memory starting at memory location 0x00445670. What are the...
The following code segment is stored in memory starting at memory location 0x00445670. What are the two possible values for the contents of the PC after the branch instruction has executed?       bgez $a0, skip                      # mem location: 0x00445670 subu $s2, $s1, $t0 # branch NOT taken (false) ori    $v0, $t1, 0x0003 #       skip: addi $t0, $t1, 2 # branch taken (true) if taken: if not taken: Hint: Remember how many bytes each instructions takes.
What are the block tags and block indexes for the below 12-bit memory locations with 256-byte...
What are the block tags and block indexes for the below 12-bit memory locations with 256-byte cache? a. 0001 0110 1010, for 16-byte blocks with direct-mapped cache b. 0010 0011 1011, for 4-byte blocks with 4-way associative cache
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)...
Question1 Match the variables with the location and memory layout given the following declarations: int numbers1[5][4];...
Question1 Match the variables with the location and memory layout given the following declarations: int numbers1[5][4]; int * numbers2 = malloc (5*4*sizeof(int)); int ** numbers3 = malloc (5 * sizeof(int *)); for (int r = 0; r < 5; r++) { numbers3[r] = malloc(4 * sizeof(int)); } stack is static (fixed size) memory, heap is dynamic memory (allocated by the program at run time with malloc, calloc, etc) contiguous memory is memory that is all in one place. All values...
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.
Write an inline assembly program that initialized a 100 byte area of memory using the STOS...
Write an inline assembly program that initialized a 100 byte area of memory using the STOS instruction.
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...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT