Sunday, October 21, 2012

Digital Logic

3.0 Digital Logic
As we all known , informations inside a computer is processed and stored as 0-1 bit. Followed by graphical symbol and algebraic expression of basic logic gates such as AND gate , OR gate , NOT gate and also universal gates , NAND gate , NOR gate and XOR gate. These gates sometimes act as a switch also.

3.1 basic logic gates

examples of basic logic gates symbols and brief explanations :

AND gate










The notation for the AND of A and B is A*B or AB
A.B =Y

truth table:
A
B
Y=A.B
0
0
0
0
1
0
1
0
0
1
1
1







OR gate






The notation for the OR of A and B is A+B
A+B=Y 

truth table:
A
B
Y=A+B
0
0
0
0
1
1
1
0
1
1
1
1


  





NOT gate







The notation for the COMPLEMENT or NOT of A is A'
A=A'

truth table :
A
A'
0
0
1
0





NAND gate







The term “NAND” stands for “not-and” meaning that output C is the inverse from the AND gate
A.B=(A.B)’=Y

truth table:
A
B
Y=(AB)’
0
0
1
0
1
1
1
0
1
1
1
0








NOR gate






The term “NOR” stands for “not-or,” meaning that output C is the inverse from the OR gate
A+B=(A+B)’=Y

truth table :
A
B
Y=(A+B)'
0
0
1
0
1
0
1
0
0
1
1
0












3.2 Combinational circuit

Combinational circuit involves circuit that combined gates in altering inputs into various output to suit the circuit builds.

  • computes output based on current input and it is a logic block that contains no memory
  • it can be defined in three ways
           1.by using truth table
              e.g:   
A
B
Y=(A+B)'
0
0
1
0
1
0
1
0
0
1
1
0

           2.by using graphical symbol
               e.g: 
           3.and using boolean equations
              e.g:  F=(A.B)+(A+C)'(CB)

3.2.1 Boolean equation form

Boolean equation can be represented in two forms, Sum-Of-Product and Product-Of-Sum.

Sum-of-product (SOP)
  • Sum of each product
  • Easier to derive from truth table
  • E = ((A.B) + (A.C) + (B.C))

Product-of-sum (POS) 
  • Product each sum.
  • Usually used if more 1s produced in output function
  • E = ((A+B).(A+C).(B+C))

*two ways to simplify boolean equations by using Laws Of Boolean Algebra and De Morgan's Law.


3.2.1.1 Laws Of Boolean Algebra

basic laws of Boolean Algebra


3.2.1.2 De Morgan's Law

first and second De Morgan's Law
De-marg f law.PNG





Arithmetics for computer

First of all, i would like to tell you all that this is my first time in blog.if you seen any error please tell me. I hope this blog can help you all and enjoy it (^ ^).


Arithmetics for Computers (Number Systems and Operations)

2.1 NUMBER SYSTEM

2.1.1 What is number system and basic types of number system

Number system is a basic way to represent a set of quantities. We are used to using the base-10 number system, which is also called decimal. Other common number systems include base-16 (hexadecimal), base-8 (octal), and base-2 (binary).
The are many types of number system but now we only focus on decimal, hexadecimal and binary.

Graph below shows different types of number system and its unique set of dstrict

1.      Decimal number
·         Base of 10
·         Their positive and negative values are determined by their positon weight structure(their power of wether positive or negative). For example

2.      Binary number
·         Base of 2
·         Only contain two digits, 1 and 0 only
·         The least significant bit (LSB) and most singnificiant bit (MSB) depends on the size binary number


3.      Hexadecimal number
·         Base of 16
·         Composed number starts from 0 to f
·         Suitable to present in 4 bits number

4.      Octal number
·         Base of 8
·         Contain number from 0 to7

2.2 NUMBER SYSTEM CONVERSION
The table below shows the number conversaion. We will just focus in three types, decimal,binary and hexadecimal.
Hexadecimal
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Binary
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1010
1011
1110
1111
Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

The are many ways can be apply to convert number system. But usualy we will by repeated divisin by base 2 ,10 and 16.
·         EXAMPLE
1.1 Convert decimal number to binary number.


1.2 Binary number to Hexadecimal number.



ANSWER :
0011 1001 1010 0010 = 39A2
0010 1011 1000 0001.1001 1000 = 2DB1.98

1.3 Hexadecimal Numbers to Binary Numbers

 

Answer :

39A2 = 0011 1001 1010 0010

2DB1.98 = 0010 1011 1000 0001.1001 1000


2.3 2’S COMPLEMENT NUMBER

2s complement method of representing number is recently use in microprocessor-based equipment. Microprocessor must process negative and positive number( before this we just only assume the numbers only negative).

For example,we assume in microprocessor that have 8 bits,that in MSB (most significant bit). If the MSB bit is 0,then the number is positive (+),but if the MSB is 1,then the number is negatve (-). While the remaining bits are represent as the mangnitude numbers. The first bits from right is a least significant bit (LSB).

For example :

  1111 1111                                      255
− 0101 1111                                   −  95
===========                                =====
  1010 0000  (ones' complement)   160
+         1                                           +   1
===========                                =====
  1010 0001  (two's complement)   161


2.4 Basic Binary Number Operation
In this chapter,we will focus in 4 operation only, addition, subtraction,  multiplication and division.
There are some rules that you should know and follow in every operations :-
Binary addition

Binary Rules
Sum
Carry
0 + 0 = 0
0
0
0 + 1 = 1
1
0
1 + 0 = 1
1
0
1 + 1 = 1
0
1

Binary Subtraction 

Binary Rules
Sum
Borrow
0 - 0 = 0
0
0
0 - 1 = 1
1
10
1 - 0 = 1
1
0
1 - 1 = 1
0
1

Binary/division multiplication
(binary and division use the same rules)

Binary Rules
Multiply/Division
0 * / 0 = 0
0
0 * / 1 = 1
0
1 * / 0 = 1
0
1 * / 1 = 1
1







2.5 Hexadecimal Number Operation
Hexadecimal addition
If the amount of sum greater than 7 bits,then the amount if sum that exceed to  8 will carry a 1 to the next column.
       example
           
Hexadecimal Subtraction


                                         
                                                              (please refer to this video)