Docsity

Digital logical design, Exams of Digital Logic Design and Programming

Toggle sidebar
bg1
!
1!
Study Questions for Digital Logic
PAC II
ANSWERS
Digital Logic
1. Build a decoder with three input lines but with only six output lines. If the value of the
input corresponds to 6 or 7, then all output lines should be asserted to signal an error.
The$truth$table$is:$$
i2 i1 i0 | o5 o4 o3 o2 o1 o0
-----------------------------------
0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 1 0
0 1 0 0 0 0 1 0 0
0 1 1 0 0 1 0 0 0
1 0 0 0 1 0 0 0 0
1 0 1 1 0 0 0 0 0
1 1 0 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
As$a$slight$simplification,$notice$that$all$the$outputs$are$1$if$both$i2$and$i1$are$
1.$$$The$corresponding$Boolean$formulas$are:$
o0 = (not(i2) AND not(i1) AND not(i0)) OR (i2 AND i1)
o1 = (not(i2) AND not(i1) AND i0) OR (i2 AND i1)
o2 = (not(i2) AND i1 AND not(i0)) OR (i2 AND i1)
o3 = (not(i2) AND i1 AND i0) OR (i2 AND i1)
o4 = (i2 AND not(i1) AND not(i0)) OR (i2 AND i1)
o5 = (i2 AND not(i1) AND i0) OR (i2 AND i1)
Note$that,$since$the$(i2 AND i1)expression$is$common$to$all$the$outputs,$they$
can$share$the$AND$gate$forming$that$expression.$The$circuit$is:$
$
pf3
pf4
pf5

Partial preview of the text

Download Digital logical design and more Exams Digital Logic Design and Programming in PDF only on Docsity!

Study Questions for Digital Logic PAC II ANSWERS Digital Logic

  1. Build a decoder with three input lines but with only six output lines. If the value of the input corresponds to 6 or 7, then all output lines should be asserted to signal an error.

The truth table is:

i2 i1 i0 | o5 o4 o3 o2 o1 o

0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

As a slight simplification, notice that all the outputs are 1 if both i2 and i1 are

1. The corresponding Boolean formulas are:

o0 = (not(i2) AND not(i1) AND not(i0)) OR (i 2 AND i1) o1 = (not(i2) AND not(i1) AND i0) OR (i 2 AND i1) o2 = (not(i2) AND i 1 AND not(i0)) OR (i 2 AND i1) o3 = (not(i2) AND i 1 AND i0) OR (i 2 AND i1) o4 = (i 2 AND not(i1) AND not(i0)) OR (i 2 AND i1) o5 = (i 2 AND not(i1) AND i0) OR (i 2 AND i1)

Note that, since the (i 2 AND i1) expression is common to all the outputs, they

can share the AND gate forming that expression. The circuit is:

  1. Modify the 1-bit ALU covered in class (supporting AND, OR, +, and - ) to implement an XOR (exclusive OR) operation. Draw the entire ALU, adding the fewest possible gates. Use the available op code 11 to select the XOR operation. Because XOR is “OR and NOT AND” we can just use the output of the existing AND and OR gates in the ALU. See below.
  2. Build a register file out of (already built) registers, mutiplexers, decoders, and logic gates that has the following inputs:
  • read select line
  • two write select lines, selecting two registers that can be written to.
  • two write data lines, for writing data to the two registers selected.
  • two write enable lines, for enabling writing to one or both of the selected registers. and an output line for the data that was read from the selected register. Note that this is like the register file covered in class, except that instead of reading from two registers and writing to one register, it supports the writing to two registers and the reading from one register. The reading side of the register file is easy. Instead of two multiplexers choosing the values of two registers to output, we only need one multiplexer. However, on the writing side of the register file, we now need two decoders, choosing two registers to write to. Therefore, a register is written to if either of the following conditions is true:
  1. Can you build a device that, logically, behaves like an or gate from only and and not gates? If so, do so (just for the case where and and or gates have only two inputs). If not, explain why not. Then, answer the same question, except with regards to constructing an and gate from only or and not gates. Yes. Since a OR b is the same as NOT ((NOT a) AND (NOT b)), the circuit would be:
  2. Consider the register file discussed in class (shown on the first page of the November 29 lecture notes), constructed from D flip-flops. a. Suppose that, when the clock line is asserted, the values of the “Read register number 1” and “Write register” inputs are both 4 (i.e. 000...100) and “Write” (i.e. write-enable) is asserted. When the “Read data 1” output stabilizes (while the clock is still asserted), would the value of “Read data 1” necessarily be the same as the value of the “Write data” input? Explain. No. The value on the “Read data 1” line would be the value that was sitting in register 4 at the end of the previous clock cycle (i.e. prior to the most recent rising edge of the clock).

a

b

This is not necessarily the same value that appears on the “Write Data” during the current clock cycle. b. If your answer to part b was “yes”, then describe a way of reading the old value of a register at the same time as writing a new value to the same register. If your answer was “no”, then indicate (precisely) when the value of “Write data” would appear on the “Read data 1” line, assuming that the values of “Read register number 1” and “Write register” are held constant. Registers are constructed from D Flip-Flops, which don’t change their output until after falling edge of the clock. Thus, the value written to a register using the “Write Data” line would not appear on the registers output (i.e. the “read data” line) until after the falling edge of the clock.

  1. The last page of the November 22 lecture notes shows D Flip-Flop with a falling edge trigger. Draw the logic for a D Flip-Flop with a rising edge trigger (following the example in the lecture notes, not in the textbook).
  2. Build a two-bit multiplier out of gates (i.e. it multiplies two two-bit numbers resulting in a 4-bit number). As usual, it may be easiest to start out with a truth table. **Building a truth table for to determine the formulas for the outputs and then simplifying gives you (where the two bits for operand a are a0 and a1 and the bits for operand b are b and b1): out0 = a0 AND b out1 = ((a1 AND b0) OR (b1 and a0)) AND (NOT ((a1 AND b0) AND (b1 and a0))) out2 = (a1 AND b1) AND (NOT (a0 AND b0)) out3 = (a1 AND b1 AND a0 AND b0) One could also write out the multiplication as you would do it by hand (where 1-bit multiplication is just an AND), by filling in the blanks below (left to the reader). a1 a b1 b



___ ___ ___ ___**

l. T A circuit diagram showing a multiplexer with sixteen 32-bit input lines and four select lines is actually referring to an array of 32 multiplexers, each having sixteen one-bit input lines and four select lines. m. F Doubling the number of registers of a register file (but leaving everything else the same) will double the number of input lines to the register file. n. T In a DRAM, all cells have to be periodically refreshed, not just the ones that have been read. o. F When shifting a two’s complement number to the left, an overflow can only occur if the number is negative, since positive numbers have a zero in the leftmost bit. [Here’s why: Shifting a large positive number to the left can result in a negative number.] p. T To perform the operation A – B, where A and B are numbers represented in two’s complement, one can build hardware to perform the following steps: flip the bits of A, add B with a carry-in of 1, flip the bits of the result, and then add 1.