Laboratory 4 - Exercises

Exercises

  1. Given the words A and B, compute the doubleword C as follows:
    • the bits 0-4 of C are the same as the bits 11-15 of A
    • the bits 5-11 of C have the value 1
    • the bits 12-15 of C are the same as the bits 8-11 of B
    • the bits 16-31 of C are the same as the bits of A
  2. Given the words A and B, compute the doubleword C as follows:
    • the bits 0-3 of C are the same as the bits 5-8 of B
    • the bits 4-8 of C are the same as the bits 0-4 of A
    • the bits 9-15 of C are the same as the bits 6-12 of A
    • the bits 16-31 of C are the same as the bits of B
  3. Given the words A and B, compute the doubleword C as follows:
    • the bits 0-2 of C are the same as the bits 12-14 of A
    • the bits 3-8 of C are the same as the bits 0-5 of B
    • the bits 9-15 of C are the same as the bits 3-9 of A
    • the bits 16-31 of C are the same as the bits of A
  4. Given the byte A, obtain the integer number n represented on the bits 2-4 of A. Then obtain the byte B by rotating A n positions to the right. Compute the doubleword C as follows:
    • the bits 8-15 of C have the value 0
    • the bits 16-23 of C are the same as the bits of B
    • the bits 24-31 of C are the same as the bits of A
    • the bits 0-7 of C have the value 1
  5. Given the bytes A and B, compute the doubleword C as follows:
    • the bits 16-31 of C have the value 1
    • the bits 0-3 of C are the same as the bits 3-6 of B
    • the bits 4-7 of C have the value 0
    • the bits 8-10 of C have the value 110
    • the bits 11-15 of C are the same as the bits 0-4 of A
  6. Given the word A, obtain the integer number n represented on the bits 0-2 of A. Then obtain the word B by rotating A n positions to the right. Compute the doubleword C:
    • the bits 8-15 of C have the value 0
    • the bits 16-23 of C are the same as the bits of 2-9 of B
    • the bits 24-31 of C are the same as the bits of 7-14 of A
    • the bits 0-7 of C have the value 1
  7. Given the words A and B, compute the doubleword C:
    • the bits 0-4 of C have the value 1
    • the bits 5-11 of C are the same as the bits 0-6 of A
    • the bits 16-31 of C have the value 0000000001100101b
    • the bits 12-15 of C are the same as the bits 8-11 of B
  8. Given the words A and B, compute the byte C as follows:
    • the bits 0-5 are the same as the bits 5-10 of A
    • the bits 6-7 are the same as the bits 1-2 of B.
    Compute the doubleword D as follows:
    • the bits 8-15 are the same as the bits of C
    • the bits 0-7 are the same as the bits 8-15 of B
    • the bits 24-31 are the same as the bits 0-7 of A
    • the bits 16-23 are the same as the bits 8-15 of A.
  9. Given the word A and the byte B, compute the doubleword C as follows:
    • the bits 0-3 of C are the same as the bits 6-9 of A
    • the bits 4-5 of C have the value 1
    • the bits 6-7 of C are the same as the bits 1-2 of B
    • the bits 8-23 of C are the same as the bits of A
    • the bits 24-31 of C are the same as the bits of B
  10. Replace the bits 0-3 of the byte B by the bits 8-11 of the word A.
  11. Given the byte A and the word B, compute the byte C as follows:
    • the bits 0-3 are the same as the bits 2-5 of A
    • the bits 4-7 are the same as the bits 6-9 of B.
  12. Given the words A and B, compute the doubleword C as follows:
    • the bits 0-6 of C have the value 0
    • the bits 7-9 of C are the same as the bits 0-2 of A
    • the bits 10-15 of C are the same as the bits 8-13 of B
    • the bits 16-31 of C have the value 1
  13. Given 4 bytes, compute in AX the sum of the integers represented by the bits 4-6 of the 4 bytes.
  14. Given the doubleword A, obtain the integer number n represented on the bits 14-17 of A. Then obtain the doubleword B by rotating A n positions to the left. Finally, obtain the byte C as follows:
    • the btis 0-5 of C are the same as the bits 1-6 of B
    • the bits 6-7 of C are the same as the bits 17-18 of B
  15. Given the words A and B, compute the doubleword C as follows:
    • the bits 0-2 of C have the value 0
    • the bits 3-5 of C have the value 1
    • the bits 6-9 of C are the same as the bits 11-14 of A
    • the bits 10-15 of C are the same as the bits 1-6 of B
    • the bits 16-31 of C have the value 1
  16. Given the byte A and the word B, compute the doubleword C as follows:
    • the bits 0-7 of C have the value 1
    • the bits 8-11 of C are the same as the bits 4-7 of A
    • the bits 12-19 are the same as the bits 2-9 of B
    • the bits 20-23 are the same as the bits 0-3 of A
    • the bits 24-31 are the same as the high byte of B
  17. Given the word A and the byte B, compute the doubleword C:
    • the bits 0-3 of C have the value 1
    • the bits 4-7 of C are the same as the bits 0-3 of A
    • the bits 8-13 of C have the value 0
    • the bits 14-23 of C are the same as the bits 4-13 of A
    • the bits 24-29 of C are the same as the bits 2-7 of B
    • the bits 30-31 have the value 1
  18. Given the word A, compute the doubleword B as follows:
    • the bits 0-3 of B have the value 0;
    • the bits 4-7 of B are the same as the bits 8-11 of A
    • the bits 8-9 and 10-11 of B are the invert of the bits 0-1 of A (so 2 times) ;
    • the bits 12-15 of B have the value 1
    • the bits 16-31 of B are the same as the bits 0-15 of B.
  19. Given the word A, compute the doubleword B as follows:
    • the bits 28-31 of B have the value 1;
    • the bits 24- 25 and 26-27 of B are the same as the bits 8-9 of A
    • the bits 20-23 of B are the invert of the bits 0-3 of A ;
    • the bits 16-19 of B have the value 0
    • the bits 0-15 of B are the same as the bits 16-31 of B.
  20. Given the words A and B, compute the doubleword C as follows:
    • the bits 0-5 of C are the same as the bits 3-8 of A
    • the bits 6-8 of C are the same as the bits 2-4 of B
    • the bits 9-15 of C are the same as the bits 6-12 of A
    • the bits 16-31 of C have the value 0
  21. Given the words A and B, compute the doubleword C as follows:
    • the bits 0-3 of C are the same as the bits 5-8 of B
    • the bits 4-10 of C are the invert of the bits 0-6 of B
    • the bits 11-18 of C have the value 1
    • the bits 19-31 of C are the same as the bits 3-15 of B
  22. Given the doubleword A and the word B, compute the word C as follows:
    • the bits 0-4 of C are the invert of the bits 20-24 of A
    • the bits 5-8 of C have the value 1
    • the bits 9-12 of C are the same as the bits 12-15 of B
    • the bits 13-15 of C are the same as the bits 7-9 of A
  23. Given the byte A and the word B, compute the doubleword C as follows:
    • the bits 24-31 of C are the same as the bits of A
    • the bits 16-23 of C are the invert of the bits of the lowest byte of B
    • the bits 10-15 of C have the value 1
    • the bits 2-9 of C are the same as the bits of the highest byte of B
    • the bits 0-1 both contain the value of the sign bit of A
  24. Given the doubleword M, compute the doubleword MNew as follows:
    • the bits 0-3 a of MNew are the same as the bits 5-8 a of M.
    • the bits 4-7 a of MNew have the value 1
    • the bits 27-31 a of MNew have the value 0
    • the bits 8-26 of MNew are the same as the bits 8-26 a of M.
  25. Given the doublewords M and N, compute the doubleword P as follows.
    • the bits 0-6 of P are the same as the bits 10-16 of M
    • the bits 7-20 of P are the same as the bits 7-20 of (M AND N).
    • the bits 21-31 of P are the same as the bits 1-11 of N.
  26. Given 2 dublucuvinte R and T. Compute the doubleword Q as follows:
    • the bits 0-6 of Q are the same as the bits 10-16 of T
    • the bits 7-24 of Q are the same as the bits 7-24 of (R XOR T).
    • the bits 25-31 of Q are the same as the bits 5-11 of R.
  27. Given the quadword A, obtain the integer number N represented on the bits 35-37 of A. Then obtain the the doubleword B by rotating the low doubleword of A N positions to the right. Obtain the byte C as follows:
    • the bits 0-3 of C are the same as the bits 8-11 of B
    • the bits 4-7 of C are the same as the bits 16-19 of B
  28. Given the quadword A, obtain the integer number N represented on the bits 17-19 of A. Then obtain the the doubleword B by rotating the high doubleword of A N positions to the left. Obtain the byte C as follows:
    • the bits 0-2 of C are the same as the bits 9-11 of B
    • the bits 3-7 of C are the same as the bits 20-24 of B
  29. Given the doublewords A si B, obtain the quadword C as follows:
    • the bits 0-7 of C are the same as the bits 21-28 of A
    • the bits 8-15 of C are the same as the bits 23-30 of B complemented
    • the bits 16-21 of C have the value 101010
    • the bits 22-31 of C have the value 0
    • the bits 32-42 of C are the same as the bits 21-31 of B
    • the bits 43-55 of C are the same as the bits 1-13 of A
    • the bits 56-63 of C are the same as the bits 24-31 of the result A XOR 0ABh
  30. Given the word A,obtain the doubleword B as follows:
    • the bits 0-3 of B are the same as the bits 1-4 of the result A XOR 0Ah
    • the bits 4-11 of B are the same as the bits 7-14 of A
    • the bits 12-19 of B have the value 0
    • the bits 20-25 of B have the value 1
    • the bits 26-31 of C are the same as the bits 3-8 of A complemented
  31. Given the words A, B si C, obtain the word D as the sum of the integers represented by:
    • the bits 1-5 of A
    • the bits 6-10 of B
    • the bits 11-15 of C
  32. Given the words A, B si C, obtain the byte D as the sum of the integers represented by:
    • the bits 0-4 of A
    • the bits 5-9 of B
    The byte E is the integer represented by the bits 10-14 of C. Obtain the byte F by computing the subtraction D-E.