# Quiz 1: Binary numbers ```1 Do the subtraction of the following 2 numbers and give the result in Hex. Hint: First convert them into
binary 2C, do the subtraction in binary and convert the result back to Hex.
x3E5A-x24B0 =
2 Draw a circuit for the following logic equation and show the truth table of Y as function of its input:
Y=((NOT A) OR C) AND (NOT B)
3 Draw the logic circuit from the following truth table and write down the logic equation: Hint: You
will need 1 OR, 2 AND gates and some inverter/circles.
A
B
Y
0
0
0
0
1
0
1
0
1
1
1
1
4 What are the 3 different types of inputs to memory above? Describe in a few words their purpose.
5 If you want to write/store the word 010 in the bottom row of memory, what values take all the inputs
from question 1? Please insert them into the picture.
6 If the total size of memory is 216 bit and the word size of a memory location is 23 bit. What is the size
for each of the 3 input types from question 1 in bit.
7 Create a logic circuit that calculates 3*x from a 4 bit word x. Hint: you should use full adder as building
blocks. There are at least 2 solutions. You can set additional inputs to constant values. If each logic gate
has a propagation delay of t1 and a full adder a delay of 3*t1, how much propagation delay has your
circuit? Write an assembly code that does the same assuming the character is at memory position 3004
and the content of register R2 is 3000. Store the result in memory at address 3005. You are not required
to use a loop for this, all you need are loads (pick the right from LD, LEA, LDR or LDI), store, NOT
8 Draw a circuit that calculates x div 2 (integer division without remainder) for a 4 bit x and works for
both positive and negative x.
9 Estimate the truth table from the following CMOS circuit
10 You are building a huge coop building in Manhattan that will have 800 2-bedroom apartments. Down
in the entrance you have to install the mailboxes for all apartments. Each mailbox has a metal plate that
shows the apartment number (from 1 to 800 in decimal). You need to order those metal plates. You need
to decide about the size. They come in 4 sizes: 1’’x2”, 1”x3”, 1x4” and 1x5”. You know that for the font
you like, each one digit number needs 1”x1”. What is the smallest size you can order? Your CFO tells you
that given the market in NYC it is better to make 2 studios instead of one 2-bedroom. What size of plate
do you have to order now? What has this problem to do with something we have talked about? How big
does the plate have to be if you want to write the apartment number in Hex, how big for binary?
11 Draw a logic circuit from the following truth table:
A B C Y
0
0
0
0
0
0
1
1
0
1
0
1
0
1
1
0
1
0
0
1
1
0
1
1
1
1
0
0
1
1
1
1
12 Write an assembly code fragment that subtracts the content of R3 from the content of R2 and leaves
the result in R1
13 What does the following assembly program in terms of A and B
LD R1, A
LD R2, B
BRp DONE
NOT R3, R3
DONE SR R3, RESULT
HALT
14 How long will a benchmark program run if it has 210 instruction, each take 2 cycles to execute and the
processor runs at a frequency of 400 MHz (Cycle time=1/Frequency)
15 Show the machine language code for ADD R3,R5,-1 and BRn GO assuming that the page offset of
GO corresponds to 010101001
16 How many bits does a branch instruction have to encode the page offset? If this number is unsigned
binary, what is the biggest possible offset you can jump to? If it is in 2C, what is the range your offset can
take?
17 If you have an instruction set that has 30 different instruction types. How many bits do you need to
encode the opcode?
18Fill in the picture the output signal Q of a D latch:
W
D
Q
19 Show the assembler instruction for the following Machine language code
0
0
0
1
1
0
0
1
1
0
1
20 Execute the memory instructions, show the register that
contains the result of a load or change a memory value after a store
(cross out the old and show the new value).
Variables:
0
R6
A35C
R4
R7
0
B134
3001
A015
3002
142A
…
3000
5B8F
14A3
3002
1
3000
R3
1
A5F3
31B4
0012
1F05
300A
642B
3006
LDR R5, R3,
LEA R2, C
LDI R2, B
ST R4, A
STR R6, R7, -1
300B
7B81
1
```