28.06.2014 Views

Chapter 5: Architecture - Computer and Information Science - CUNY

Chapter 5: Architecture - Computer and Information Science - CUNY

Chapter 5: Architecture - Computer and Information Science - CUNY

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10 CHAPTER 5. ARCHITECTURE<br />

Exercise 5.2.2 Show that this matrix performs the OR operation.<br />

The NAND gate<br />

is of special importance because every logical gate can be made out of NAND<br />

gates. Let us try to work out which matrix would correspond to NAND. One<br />

way is to sit down <strong>and</strong> consider for which of the four possible input states of<br />

two bits (00,01,10,11) does NAND output a 1 (answer: 00,01,10) <strong>and</strong> in which<br />

states does NAND output a 0 (answer: 11). From this we realize that NAND<br />

can be written as<br />

00 01 10 11<br />

[<br />

0 0 0 0 1<br />

NAND =<br />

1 1 1 1 0<br />

]<br />

. (5.35)<br />

Notice that the column names correspond to the inputs <strong>and</strong> the row names<br />

correspond to the outputs. 1 in the jth column <strong>and</strong> ith row means that on<br />

entry j the matrix/gate will output i.<br />

There is, however, another way in which one can determine the NAND gate.<br />

The NAND gate is really the AND gate followed by the NOT gate.<br />

In other words, we can perform the NAND operation by first performing the<br />

AND operation <strong>and</strong> then the NOT operation. In terms of matrices we can write<br />

this as<br />

⎡ ⎤ ⎡ ⎤ ⎡ ⎤<br />

NOT ⋆ AND = ⎣ 0 1 ⎦ ⋆ ⎣ 1 1 1 0 ⎦ = ⎣ 0 0 0 1 ⎦ = NAND. (5.36)<br />

1 0 0 0 0 1 1 1 1 0<br />

Exercise 5.2.3 Find a matrix that corresponds to NOR.<br />

This way of thinking of NAND rings to light a general situation. When we<br />

perform a computation, often we have to carry out one operation followed by<br />

another.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!