7 Feb 2013

# Homework 3 -- CS 429 Spring 2013

We have covered Chapter 3 of B+O (Computer Systems: A Programmer's Perspective (2nd Edition), Randal E. Bryant, David R. O'Hallaron, 2010), so these exercises are meant to check that you understand basic instruction set architecture (ISA) issues.

Topics: memory, bus, cpu, ISA, shift/rotate, condition codes, machine state, interrupts

1. For the following binary numbers, compute even and odd parity:
• 0100101100101001
• 1101101010101111
• 0000000000000000
• 1101100100101011

2. Assume I have a 32-bit word. If I want to detect a memory error in that word, how many bits do I need? If I want to do single bit correction, what is the minimum number of bits that I need? If we could come up with a code that could detect and correct any two bits changing, what is the minimum number of bits that I need?

3. If I have in memory, starting at location 0x0200, the four bytes 0x00, 0x11, 0x22, 0x33, in that word, and I load them into a 32-bit register as little-endian, what is the result? What is the result if I load them big-endian?

4. If I have an 18-bit physical address for a word-address machine, how much memory can my architecture support? How about a 24-bit byte-address machine?

5. Name 4 types of wires/lines that would be on a bus connecting a CPU and memory.

6. What is the defining characteristic of a Von Neumann machine?

7. Give the basic operation loop of a computer.

8. What is PC? How big is it?

9. Give an example of a special purpose register. How does it vary from a general purpose register?

10. If I have a 6-bit opcode field, how many different instructions can I have? If two of those 6-bit opcodes indicate that there is another 6-bit secondary opcode, now how many instructions can I have?

12. For a 0-address instruction, where does an instruction find its operands?

13. What is the purpose of an index register?

14. How does an "add immediate" instruction differ from an "add" instruction?

15. For each of the following binary values, show the result for a (a) left-shift by 3, (b) arithmetic shift right by 3, (c) logical shift right by 3, (d) rotate left by 3, (e) rotate right by 3.
• 0100101100101001
• 1101101010101111
• 0000000000000000
• 1101100100101011

16. For the binary value 0110100100101010, if we had a 6-bit opcode, what would it be? An 8-bit opcode? Would you expect it to be represented in decimal, octal, hexadecimal, or binary?

17. What mask would I use to select bits 4 to 7 (numbering bits from 31 (high order) down to 0 (low order)). Represent it in both binary and hex.

18. If we encode a conditional jump by 3 bits: leg where l indicates to jump on less than zero, e indicates to jump on equal to zero, and g indicates to jump on greater than zero, what is the meaning of:
1. 010
2. 000
3. 110
4. 111
5. 101

19. What types of errors can a computer detect as it is executing instructions?

20. What is the essential difference between a vectored interrupt and a non-vectored interrupt?