CSE1400 - Computer Organisation
Self-Study: Week 2
Logic Circuits
Delft University of Techuology
20
(2022 QL
Special thanks to Sra Juhosovd, Ana Baltiretu, Oskar Lorok, Kiril Vasilov and Damla Ortac
Jor helping with the compilation of this set of questions.
Important information:
L
If any question is unclear please cousult Stack Overllow, For more specific questions, you cau. we
(he (Queue! during lab ours
‘The average time for solving this self study is 8 hows, aud 1 hour is allocated to giving feedback.
Timings are included for each exercise to give you a more clear overview of how much time you
should be spending on them,
Phe inaxizmam amount of points for this self study is 200 points. To get the points you should
submit a serious attempt on Peer and properly review your peers’ submissions (100 points per
full cycle, including review evaluation),
Answers will be provided during the weekly tutorial sessions.1. (2 mins) What is the name of the inventor of the algebraic system that is used in digital computers
and in what year did he invent it?
George Boole 1847
(5 mins) Draw the following logic gates:
(a) AND
|
———
|
|
(b) NOR
|
|
| —)\ >
(c) NOT
(d) OR
|
|
(ec) NAND
|
|
|
3 mins) Simplify the following equation using DeMorgan’s laws:
-xVy AND-y Vz
AND -y OR y AND -24. (30 mins) Consider the following logic circuit
—— 7
> J
t {_»
Figure 1: Logic Cirenit
(a) Convert the logic circuit to the corresponding (non-simplified) boolean expression.
((a AND b) NAND -(¢ OR -c)) OR ((d NAND d) AND (c OR -c))
(b) Draw a Karnaugh map from the expression you derived
ed\ ab | 00/01 | 11] 10|
|
| oo Ji }a}rtii
|, oF Teele bola
| mW [t}1}otr
40 Va ba
(c) Find the minimal sum of products for the expression using either the Karnaugh map or boolean
logic
(a NAND b) + -d(d) Draw a logic circuit corresponding to the minimal sum of products expression.
qd |e
(ec) Does the logic circuit that expresses a minimal sum of products always use the least possible
amount of logic gates? Is it possible to redesign the logic circuit from the previous exe:
use fewer logic
ise to
ates?
((a AND b) NAND d) = (a NAND b) + -d
So can be written in 2 gates instead of 35. (10 mir and Stefan were fighting for the honorary title of “Candy King”, and
‘Thom slowly taking the lead with his weekly candy deliveries to the TAs. Otto realised that
in order to make a comeback, he had no choice but to bring out his seeret weapon: Eugenii
Unfortunately, while he was dropping off a package of goodies, the bottom of it broke and covered
one of Otto’s Karnaugh maps with Eugenias.
biscuits,
Otto quickly realised that this event created an excellent question and he took a picture of the
Karnaugh map. Now he tasks you with filling in the spots that were covered by the Eugenias
iB QO 01 it 10
You also know that the minimum Sum of Products for this Karnaugh map was:
(A-B-D)+(B-C)+(B-C-D)
Draw the original Karnaugh map and show your work.
Buy sandwich biseuits filled with chocolate cream and rum flavour. These treats were famous with Romanian
children because of the chocolate filling, and they were popular with the parents too, because they didn’t cost too much.6. (7 mins) The current temperature is represented as a 3 bit unsigned number T = t2tyfo, where tz is
the most significant bit. Any temperature of 7 degrees or above is stored as 111 and any temperature
of 0 degrees or below is stored as 000. Find a minimal Sum-of-Products equation that is only true
when the temperature is strictly below 3 degrees.
(T2 AND -To) OR (-T2 AND -T1 AND To)
7. (5 mins) Consider the following CMOS circuit
Ce
HO:
Figure 2: CMOS Circuit
Draw the table of outputs for each possible input of 1, 2y and state the name of the gate
222278. (10 mins) Alice wants to build a supercomputer that can perfectly predict the stock prices. Unfor-
tunately, as a TUDelft student, she is low on budget. Thus, she wants to cut the price by reducing
the number of different types of gates used in her supercomputer (she would have to build a separate
production line for each logic gate)
What is the minimum number of different types of gates that she could use in
express every possible logic circuit? Explain why.
omputer to
Either the NAND or NOR gate is sufficient for the given goal. Considering that the NAND
and NOR gates are functionally complete, every other gate type can be assembled using a
different formation and combination of these gates.
9. (7 mins) What value does the RAX register hold after it returns to line 6 (from calling the foo
function)?
movq $1, %rax
pushq $8
pushq $4
pushq 87
mova $5, %rdi
addq $8, %rsp
call foo
foo
pushq %rbp
movg Yrsp, %rbp
pushq Jordi
mulq —8(%
addq 16
bp)
%rbp) , Srax
movq %cbp, %rsp
popq %rbp
ret
First,1 is inserted into %rax. It is multiplied with 5 (5*1=5) and 4 is added to the result (5+4-9) so the final value will be 910. (15 mins) You are given the following piece of Assembly x86-64 code:
| 1. movq ]
| 2. pushe |
| 3. call |
| i jeoee |
| 5. decq
| 6. addq
| 7. pushq —-%rax |
| |
| 8. mova $0, %rdi |
| 9. call exit |
10, foo
| 11. pushq — %rbp |
| 12. mova —Yarsp, Yerbp |
| |
13. addq Yrsi
a: (pan
| 15, deeq |
| 16. popq |
| 17, pushq |
18, mova Sep,
| 19. popq Yerbp |
| 20. ret |
Before line 1 is executed, the 8-byte aligned stack looks like this:
Address | Contents | Pointers
100 2
392 *Coati RBP_ |
4 10 RSP_ |
376 13 |
368 "Owls? |
360 13 |
2 2 |
344 666 |
(a) What will the stack look like after line 17 is exeented? Explain how you got to the answer
| traced the stack line by line on an excel spreadsheet (not that much gdb skillz yet)
You can use the following table to fill in your answer
Address | Contents | Pointers
a0 4
{
|
| 392 Coati ‘BP
|
|
|
[
]
|
|
384 10 |
376 0. |
|
|
|
J
368 Coati
360 At RSP
BAG(b) What will the stack look like after line 7 is executed? Explain how you got to the answer
You can use the following table to fill in your answer
{ Address ntents | Pointers
{400
|