Monday, April 5, 2010

A Walk through the Gates

So now that we have digital signals, what to do with them? Obviously, we would definitely like to build some circuits that can use these signals. We said that computers use digital signals. Wouldn't it be great if we could make one, or at least design it?

We will move on to that. But before that, we need to know what digital circuits are made of. If we look into any analog circuit, the basic building blocks are resistors, capacitors and inductors. Similarly, in digital domain, we have what are called as "Logic Gates". Gates? What are these , now? Well, they are simply 'gates'. What does a normal gate do in our daily life? It lets you pass. Or, it may stop you. Similarly, for logic gates. They either let a signal pass, or they stop a signal. Why called logic gates? Because they work on simple logic. Consider an AND gate. Now, when we say Rahul and Arun, it means both of them. Similarly, an AND gate gives an output only if both the signals at its input are present.Now can you explain what an OR gate does? Write a comment to explain.

Before going into more details about logic gates, we need to know what is known as Boolean algebra. It is named after George Boole(1815-1864), an English mathematician, who invented it. We said before that digital circuits use only 0's and 1's as its signals. 0 repesents an off signal, a false logic. 1 represents an on signal, or a true logic. Based on these two logical levels, the algebra which has been developed is called Boolean algebra. Since we use only two numbers to represent this system (viz., 0 and 1), it is also called as binary algebra, and the numbers formed using this system are called binary numbers.

In Boolean algebra, we define a few operations, as follows:
  • AND: If 'a' and 'b' are the inputs, then the output is 1 only if both a and b are 1, otherwise the output is 0. Symbolically, this is represented as a.b.

  • OR: If 'a' and 'b' are the inputs, then the output is 1 if either a or b is 1., otherwise the output is 0.Symbolically, this is represented as a+b.

  • NOT: If 'a' is the input, then the output is 1 if a is 0, otherwise the output is 0. Symbolically, this is written as ~a.

  • NAND: If 'a' and 'b' are the inputs, then the output is 0 only if both a and b are 1, otherwise the output is 1. Symbolically, this is represented as ~(a.b).

  • NOR:  If 'a' and 'b' are the inputs, then the output is 0 if either a or b is 1., otherwise the output is 1.Symbolically, this is represented as ~(a+b).

  • XOR:  If 'a' and 'b' are the inputs, then the output is 1 only if a and b are unequal, otherwise the output is 0. 

  • XNOR:  If 'a' and 'b' are the inputs, then the output is 1 only if a and b are both equal, otherwise the output is 0.

These are the basic gates we use to implement any digital circuit. These logic gates are available in the market in the form of integrated circuits (ICs). We shall talk about that later on. Now let us focus on basic operations on binary digits, ie., 0 and 1.

The basic operations that can be done on binary digits are OR, AND & NOT. All other operations are combination of these three operations. For example, XOR can be obtained from these basic operations as follows:
a xor b = a.(~b)+(~a).b
Just try the above equation with all possible values of a and b, and you will know the justification of the same.

In order to make these basic operations, viz. AND, OR and NOT simpler, we have to go through some basic properties related to these operations. Let us look through these one by one:
  • Identity Property:  
             a + 0 = a
             a.1 = a
  • Zero Property:
             a.0 = 0
             a.(~a) = 0
  • Unity Property:
             a +1 = 1
             a + (~a) = 1

  • Commutative Property:
             a + b = b + a
             a.b = b.a
  • Associative Property:
             a + (b + c) = (a + b) + c
             a.(b.c) = (a.b).c

  • Distributive Property:
             a.(b + c) = (a.b) + (a.c)
             a + (b.c) = (a + b).(a + c)

  • De Morgan's Law:
             ~(a + b) = (~a).(~b)
             ~(a.b) = (~a) + (~b)
In all the above examples, a,b,c are binary digits.

Thus, keeping these properties in mind, we can go forward on our journey into the digital world. In fact, we have come quite far into the world of digital electronics. We have now known how the digital or binary data operate on each other. We have seen what logic gates are. The next problem would be how to use all these to implement a digital circuit. For this purpose, we will consider some real world problems and try to find out their solutions using the knowledge we have gained so far. But for that, we have to wait till my next post. Till then, keep your brain cells busy by solving a few questions.

Try to reduce the following Boolean expressions into the simplest form possible:

a) (a+b+c).(a.b+a.c).(~(a+b))
b) ((~a).b.(~c)) + (a.(~b).(~c)) + ((~a).(~b).(~c))
c) ~(a.b.c + (~a).b.c + a.(~b).c + a.b.(~c))
Note: While solving, you can use another notation for (~a) denoted as follows: 

Well, any comment will be highly appreciated. So please don't forget to leave a comment before you leave the page. And don't forget to express your reactions below.