**Overview**: Computer Organization: Binary number representation, Boolean logic, circuits and gates, machine language.

- Consider the machine instruction
`10001000000000010001`

, where`10001`

is an opcode indicating the STORE X command, meaning to copy the contents of the register R to memory address X.- What is the maximum number of instructions that could be in the instruction set of this machine? Why?
- How many memory cells (addresses) does the computer have? Why?
- How big are the registers in this machine (i.e. how many bits do they hold)? Why?

- Translate the number 42 into 8 bit signed binary notation. Show your work.
- Translate the number 11.75 into 16 bit signed binary notation, assuming 6 bit for the decimal part. Show your work.
- What is the largest number representable on 8 bits, signed?
- Consider the following bit pattern:
`1000000010000110`

- If this is interpreted as a 16-bit unsigned integer, what integer would it represent? Show your work.
- If the same bit pattern is interpreted as a 16-bit signed integer, what integer would it represent? Show your work.
- If the same bit pattern is interpreted as a machine instruction, what instruction would it represent? Use the chart given in class (attached at the end).

- Draw a circuit (using only AND, OR, and NOT gates) for the following truth table. You may, but you do not need to, use the sum-of-products approach discussed in class.
input 1 input 2 output 1 0 0 1 0 1 0 1 0 1 1 1 0 x - Draw a circuit (using only AND, OR, and NOT gates) for the following truth table. You may, but you do not need to, use the sum-of-products approach discussed in class. Be sure to indicate which line is output 1 and which line is output 2.
input 1 input 2 input 3 output 1 output 2 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 0 0 1 1 0 1 0 1 1 1 0 0 - Design a truth table for the following expression.
`NOT(Found=No AND I<10,000) OR (I<=0)`

Let the logic variables P , Q and R represent the sub-expressions

`Found=No`

,`I<10,000`

, and`I<=0`

respectively. - Consider the following two logic expressions.
`NOT(Found=No AND I<10,000)`

`NOT(Found=No) OR NOT(I<10,000)`

`Found=No`

and`I<10,000`

respectively.Determine whether or not the expressions (a) and (b) are equivalent. (To tell whether two logic expressions are equivalent, you can just make their truth tables and compare their right-hand columns.)

- Let a and b be two Boolean variables. Draw the truth table for the following Boolean expressions:

a)`NOT (a AND b)`

b)`(NOT a) OR (NOT b)`

Are they equivalent? (Two expression are equivalent if their truth tables are identical).

x - What does the following assembly language program do? Let's denote by X, Y and Z the content of memory cells at adresses 16, 17, and 18 respectively. Show what changes occur in X, Y, and Z as its steps are executed, and then show the output. Use the instruction set discussed in class.
Address Contents of memory cell 0 LOAD 17 1 ADD 18 2 STORE 17 3 INCREMENT 18 4 INCREMENT 18 5 LOAD 16 6 COMPARE 18 7 JUMPLT 0 8 OUT 17 9 HALT 10 11 12 13 14 15 16 12 17 0 18 1 x - Consider the following code:
cin >> a; cin >> b; c = 0; while (b>0) { c = c+a; b = b-1; } cout << c;

- Describe what the program does at a high level (e.e it gets two numbers a and b and output a+b).
- Translate the program into machine instructions (using the attached instruction set). Please do not write your instructions in binary. Use English words for the operators and decimal numbers for the address in your instructions (e.g. LOAD 14, STORE 18). You may not assume that there is a particular value (e.g. zero) in a memory location where a variable is being stored until some instruction puts it there.

Address Contents of memory cell 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

### What to turn in:

- The 12 problems.

If you work in a team submit only one file per team.