Homework2 - Name David Skidmore Assignment Homework 2 1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Name: David Skidmore Assignment: Homework 2 1. From the book, do exercises 19, 23d, 26, 27 on p. 33 a. For each of the following bit patterns, identify the integer value encoded into this bit pattern using the 8-bit 2's complement representation: i. 00110011. ii. 00010111. iii. 10000010. iv. 10101010. v. 11111111. b. Construct a Huffman code using the frequencies presented in Example 1.26. Show the tree resulting from Huffman's algorithm as well as the encoding for each letter. { E, T, Z, Q, U, M } Letter E T Z Q U M Freq. 0.1305 0.0902 0.0009 0.0014 0.0277 0.0262 Code 1 00 01011 01010 011 0100 c. For each of the following codes, give the Hamming distance of the code: i. { 0001, 1001, 0101, 1110 }. The Hamming distance is one. ii. { 11100, 00011, 01010, 10101, 11011 }. The Hamming distance is two. iii. { 01010, 10101, 11111, 00000, 00110 }. The Hamming distance is two. d. For each of the following codes add a parity bit to the code. The parity bit should be the leftmost bit and used to ensure each encoding has even parity: i. { 110, 010, 011, 111 }. ii. { 1010, 0111, 1110, 1011, 0011 }. iii. { 0011, 1010, 1100, 0000, 1111, 0101 }. 2. Assume a computer's address bus is 15 bits wide. a. How many memory locations can the computer have? b. If the memory system is byte addressable, how many bytes of memory can it have? c. How many bytes of memory can the system have if it is exactly 16-bit addressable? 3. For the following questions refer to figure 3.8 on page 81 of the book and assume the memory system is aligned and byte addressable, with a 12-bit address bus (unless stated otherwise). a. What would you assume the size of a word in this system to be? Why? I would expect words to be 16 bits because accesses can potentially pull out up to two bytes at a time. b. In what bank(s) and what row(s) would you find an 8-bit value with global address i. 2805? Row 1402, bank 1. ii. 3584? Row 1792, bank 0. c. In what bank(s) and what row(s) would you find a 16-bit value with global address i. 1234? Row 617, bank 0. ii. 3778? Row 1889, bank 0. d. Would the system be able to read a 16-bit value from global address 953? Explain your answer. This system would be unable to read a 16-bit value from here because the address starts in bank 1 rather than bank 0. The first 8 bits would appear in the second half of row 476 and the second 8 bits would appear in the first half of row 477. e. Suppose the system architect added two more memory banks to the system. Give and describe two consequences of that change. First, the rows various addresses end up on would be changed such that the address space is compressed onto fewer rows. Second, it would be possible to read four bytes at a time provided the address still lands on bank 0. f. For each of the following addresses, give all the possible alignments (1-byte, 2-byte or 4byte). i. 0x9A3 1-byte ii. 0x1FA 1-byte, 2-byte iii. 0xCAC 1-byte, 2-byte, 4-byte 4. Suppose the system described above uses a consistent Little Endian byte addressing scheme, interpret the following contents if they represent: Address 16400 16401 16402 16403 16404 16405 16406 16407 Contents 0x4E 0x6F 0x74 0x20 0x62 0x61 0x64 0x00 a. A continuous ASCII encoded string of characters, assuming the first character in the string is represented at the lowest address and the subsequent characters are represented in order at subsequent addresses. Not bad(null) b. Two integers each encoded according to the 32-bit 2's complement scheme. (Show a decimal representation of each integer.) 5. Type in the example program in Figure 1.2 on page 3 of the Lab Manual. a. What is the initial value of the program counter? 0x2020 b. What addresses do x_m, y_m, and z_m represent? x_m = 0x4000 y_m = 0x4004 z_m = 0x4008 c. What command would you use to stop your program when the PC reaches a certain address (say address 0x2048)? break 0x2048 d. What is the value of register 3 at the end of a run of your program? 0x4008 e. What four-byte value is stored at z_m at the end of a run of your program? 0x000000a4 f. 0x2050 What is the value of the PC at the end of a run of your program? g. What are the differences among the instructions set, st (store word), and ld (load word)? Set is designed to put an integer constant into a register while load and store are designed to read and write data respectively to memory. ...
View Full Document

Ask a homework question - tutors are online