Assignment # 2 Solutions - CSI 2111
Assignment # 2 Solutions - CSI 2111
Q1. We need to design a full subtractor which computes a – b – c, where c is the borrow from
the next less significant digit that produces a difference, d, and a borrow from the next
more significant bit, p.
b) Implement the circuit using only NAND gates and inverters. (5)
d = [(ab’c’)’(a’bc’)’(a’b’c)’(abc)’]’and
p = [(a’b)’(a’c)’(bc)’]’
Q2. a) Implement, with a decoder and external OR gates, the combinational circuit specified
by the following three Boolean functions: (5)
f1(A, B, C) = Σm(0,3,4)
f2(A, B, C) = Σm(1,2,7)
f3(A, B, C) = Π M(0,1,2,4)
X0 2x4 D0
Decoder
D1
D2
X1
E D3
X2 2x4
Decoder 2x4
X0 D4
Decoder
D5
X3
E D6
X1
E D7
X0 2x4 D8
Decoder
D9
D10
X1
E D11
X0 2x4 D12
Decoder
D13
D14
X1
E D15
Q3. a) Implement the following Boolean function with an 8-to-1 line multiplexer and a single
inverter with variable B as an input. (5)
b) Give the canonical sum of product expression for the function which is implemented using
the following circuit.
(5)
A
22 MU
B f
21
C 8-to-1 (1 bit)
20
0 1 2 3 4 5 6 7
D 1 0 ′D 1 D 0
f(A,B,C,D) = Σm(1,2,3,6,9,10,11,13)
Q4. a) Given a 256 x 8 ROM chip with Enable input, show the external connections
necessary to construct a 2K x 8 ROM with eight chips and a decoder. (5)
A0 - 7 256 x 8 D0 - 7
ROM
3x8 0 256 x 8
A8 A0 - 7 D0 - 7
1
Decoder ROM
A9 .
.
.
A10 7
E
.
.
.
A0 - 7 256 x 8 D0 - 7
ROM
b) Specify the size of a ROM (number of words and number of bits per word) necessary
to implement a binary multiplier that multiplies two 8-bit numbers. (5)
We need 16 bits to represent the result, and since there are two operands (each of 8-bits), the
RAM table size is 216 x 16 = 64K x 16.
Q5. Consider the function f (w, x, y, z) = Σm (1, 3, 7, 11, 13, 14, 15).
a) Implement f in VHDL, using AND, OR, NOT gates. Call it circuit5a. (5)
b) Implement f in VHDL, but use only NAND gates (no NOT gates!). Call it circuit5b. (5)
c) Implement f again in VHDL, but use only NOR gates this time. Call it circuit5c. (5)
d) Compare the simulation results of the three implementations in VHDL for all combinations of
the inputs w, x, y, z. Please include the timing diagram (0 ns to 1600 ns) and the truth tables for
1a), 1b), and 1c) and explain the differences, if any. (5)
For this question, use Max+plus II in the Functional SNF Extractor mode. This mode eliminates
the signal transmission delays, which makes checking the equivalence between two functions
easier.
Solution:
Part (a) See attached file “circuit5a.vhd”.
Part (b) See attached file “circuit5b.vhd”.
Part (c) See attached file “circuit5c.vhd”.
Part (d) The simulation results from “circuit5a”, “circuit5a”, “circuit5a” should be exactly same,
because they implement the same function. See attached files : “circuit5a.scf”, “circuit5b.scf”,
“circuit5a.scf”.
-- Question 5 (a)
-- Implements f(w,x,y,z)= m(1,3,7,13,14,15) using AND,OR,NOT
--
-- f = (y.z) + (w'.x'.z) + (w.x)(y + z)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY circuit5a IS
PORT ( W, X, Y, Z : IN STD_LOGIC;
F : OUT STD_LOGIC);
END circuit5a;
-- Question 5 (b)
-- Implements f(w,x,y,z)= m(1,3,7,13,14,15) using NAND only
--
-- f = ((y.z)'.(w'.x'.z)'.(w.x.y)'.(w.x.z)')'
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY circuit5b IS
PORT ( W, X, Y, Z : IN STD_LOGIC;
F : OUT STD_LOGIC);
END circuit5b;
-- Question 5 (C)
-- Implements f(w,x,y,z)= m(1,3,7,13,14,15) using NOR only
--
-- f = (y+z).(x+z).(w+z).(w+x'+y).(w'+x+y) [ POS
form ]
-- = ((y+z)'+(x+z)'+(w+z)'+(w+x'+y)'+(w'+x+y)')'
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY circuit5c IS
PORT ( W, X, Y, Z : IN STD_LOGIC;
F : OUT STD_LOGIC);
END circuit5c;
END noronly;