Sunday, 21 October 2012

2) The Basic of logic design


1.1 LOGIC DESIGN

      Digital electronics operate with only two voltage levels
high voltage and a low voltage
      Computer used binary system (0,1)
      Combinational logic block contains no memory
      logic block with n inputs, there are 2n entries (possibility) in the truth table

TRUTH TABLE
A truth table shows how a logic circuit's output responds to various combinations of the inputs, using logic 1 for true and logic 0 for false. All permutations of the inputs are listed on the left, and the output of the circuit is listed on the right. The desired output can be achieved by a combination of logic gates. A truth table for two inputs is shown, but it can be extended to any number of inputs. The input columns are usually constructed in the order of binary counting with a number of bits equal to the number of inputs.


   Binary Functions of Two Variables


The following table gives a list of the common logic functions and their equivalent Boolean notation.
Logic Function
Boolean Notation
AND
A.B
OR
A+B
NOT
A
NAND
A.B
NOR
A+B
EX-OR
(A.B) + (A.B) or AB
EX-NOR
(A.B) +  or  B


Example:

 

·         input AND Gate


The output Q is true if both input A, AND input B are both true, (Q = A and B).





 


·         input OR (Inclusive OR) Gate

The output Q is true if either input A, OR input B is true, (Q = A or B).






Boolean algebra
v Another approach to express the logic function with logic equations
v OR operator is written as +, as in A + B
     0 +1 = 1 ------- 1 + 0 = 1
v AND operator is written as & , as in A & B
     0 & 1 = 0 -------1 & 0 = 0
v NOT (inversion) operator is written as or’  , as in A’
     0’=1 ------ 1’= 0


Boolean Algebra Law

1.     Identity law: A + 0 = A and A & 1 = A.

2.     Zero and One laws: A + 1 = 1 and A & 0 = 0.

3.     Inverse laws: A + A’ = 1 and A & A’ = 1.

4.     Commutative laws: A + B = B + A and A & B = B & A.

5.     Associative laws: A + (B + C) = (A + B) + C and A & (B & C) = (A & B) & C.

6.     Distributive laws: A & (B + C) = (A & B) + (A & C) and
              A + (B & C) = (A + B) & (A + C).



Gates

}  Logic gates
Logic gates process signals which represent true or false. Normally the positive supply voltage +Vs represents true and 0V represents false. Other terms which are used for the true and false states are shown in the table on the right. It is best to be familiar with them all.
Gates are identified by their function: NOT, AND, NAND, OR, NOR, EX-OR and EX-NOR. Capital letters are normally used to make it clear that the term refers to a logic gate.
Note that logic gates are not always required because simple logic functions can be performed with switches or diodes:

 NOT gate (inverter)

The output Q is true when the input A is NOT true, the output is the inverse of the input: Q = NOT A
A NOT gate can only have one input. A NOT gate is also called an inverter.



 AND gate

The output Q is true if input A AND input B are both true: Q = A AND B
An AND gate can have two or more inputs, its output is true if all inputs are true.



 


IZNI FARHANA BINTI SOOUDIN
B031210021





1.2  DECODER

-Decoder is use to build larger components
-The most common type of decoder has an n-bit input and 2outputs
-This decoder translates the n-bit input into a signal that corresponds to the binary value of the              n-bit input
-The outputs are shows a 3-bit decoder and the truth table.This decoder is called a 3-to-8 decoder
-Encoder performs the inverse function of a decoder






1.3 MULTIPLEXOR

-The output is one of the inputs that is selected by a control


-The left side shows this multiplexor has three inputs:
  two data values and a selector (control) value.
-The selector value determines which of the inputs becomes the output
-We can represent the logic function computed by a two-input multiplexor

  C = (A & S') + (B & S)

-Multiplexor can be created with an arbitrary number of data input
-If there are only two inputs, the selector is a single signal that selects one of the inputs
-If it true (1) and the other if it is false (0)
-The multiplexor basically consists of 3 parts:

  1) A decoder that generates n signalseach indicating a different input
  2) An array of n AND gates, each combining one of the inputs with a signal from the decoder
  3) A single large OR gate that incorporates the outputs of the AND gates

-To associate the inputs with selector values, we often label the data inputs numerically
  
HALIMAH BINTI RAHMAN
B031210349
BITC 



1.4 Arithmetic Logic Unit ( ALU )

ALU ~ the part of computer processor or also known as CPU that carries out the arithmetic operations ( addition , subtraction ) and logical operation ( AND , OR ) on the operands in a computer.

~divided into 2 units :          a) Arithmetic unit            b) Logic unit                                                                                                                             

~A large part of ALU design is captured by the design of a 1-bit ALU~ALU consists of 32 bit-wide arranged in parallel to send output bits from each operation to the ALU outputs.
1-bit logical unit for OR and AND

~This adder is called full adder.  
~Also called (3,2) adder because it has 2 outputs and 3 inputs.
~Adder with only A and B inputs is called (2,2) adder or HALF Adder
                                                                                                                                                      
    
Figure 2









 ~Adder have two inputs for the operands and a single bit output for the sum .
~There are a second output pass on the carry called CARRYOUT.
~The CarryOut from the neighbour adder have to be included as an input.
~The third input is called CarryIn .                                                              


~Each bit of addition has 3 input bits (Ai, Bi, and CarryIni), as well as 2 outputs bits (Sumi, CarryOuti), where  CarryIni+1 = CarryOuti. (Note: The "i" subscript denotes the i-th bit.) .



                                                                                                       ~Nur Amira Farhana bt Zainol
                                                                                                          ~B031210351
                     

1.5 Sum of Product and Product of Sum

Sum of Product (SOP)

*is a logical sum OR of products.
*Each function result is 1
*Form product of all variables.
*When two or more product terms are summed by Boolean addition, the resulting expression is sum of product ( SOP ).
Examples :

*SOP expression can also contain a single variable term , example :




Product of Sum (POS)


*is logical sum AND of products
*Each function result is 0

~When two or more sum terms are multiplied the resulting expression is product of sum ( POS ).
For examples :
*can contain single variable terms 

example :
* A single overbar cannot extend over more than one variable, but more than one variable in a term can have  an overbar.

Example :


*Figure 1 shows for the expression (A + B)(B + C + D)(A + C). The output  X of the AND gate equals the POS expression.

Figure 1
The standard POS form . 



                                                                                                               ~Nur Amira Farhana bt Zainol  
                                                                                                               ~B031210351    
                                                                                                                 
                                


1.6 Sum of Product and Product of Sum

Sum of Product (SOP)

*is a logical sum OR of products.
*Each function result is 1
*Form product of all variables.
*When two or more product terms are summed by Boolean addition, the resulting expression is sum of product ( SOP ).
Examples :

*SOP expression can also contain a single variable term , example :



Product of Sum (POS)

*is logical sum AND of products
*Each function result is 0

~When two or more sum terms are multiplied the resulting expression is product of sum ( POS ).
For examples :
*can contain single variable terms 

example :
* A single overbar cannot extend over more than one variable, but more than one variable in a term can have  an overbar.

Example :


*Figure 1 shows for the expression (A + B)(B + C + D)(A + C). The output  X of the AND gate equals the POS expression.

Figure 1
The standard POS form . 



                                                                                                               ~Nur Amira Farhana bt Zainol  
                                                                                                               ~B031210351    
                                                                                                                 
                                











1 ) Arithmetic for Computers (Number Systems and Operations)


1.1  Number system
           
       1.1.1    Basic Types Of Number System

The collection of unique digits that a computer can represent is one component of its number system. Most modern computers use the binary number system, which has only two digits, 0 and 1. The binary system is chosen because a computer must be able to represent each digit in some unique manner.
               
           There are many types number system. Here we only focus on the decimal, hexadecimal and    
      binary number.
             

     1.1.2 Number system base

Most of the numbering system will have a base. Refer the table below :-
System
Base
Possible Digits
Binary
2
0 1
Octal
8
0 1 2 3 4 5 6 7
Decimal
10
0 1 2 3 4 5 6 7 8 9
Hexadecimal
16
0 1 2 3 4 5 6 7 8 9  A B C D E F
   

             BINARY NUMBER
·         Base of 2
·         The system has two digits : 0 and 1
·         The weight of each position is a power of two
For example:
       
·         The least significant bit (LSB) and most significant bit (MSB) is depend on the size of binary number.



DECIMAL NUMBER

·         Base of 10
·         The radix point separate digit positions whose weights are positive and negative powers.

For example :
  •                …. 105, 104, 103, 102, 101, 100     [positive value] 
  •          ….102, 101, 100, 10-1, 10-2, 10-3 [negative value]


  
                  HEXADECIMALNUMBER

·         Base of 16
·         Start from 0 until F
·         Suitable to present in fours bit number


DECIMAL
BINARY
HEXADECIMAL
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
   
            

      










                




                1.1.3 Floating point numbers

·         Representation for non-integral numbers.
·         It is also useful to represent both very large and very small numbers.
·         Like scientific notation
~ 1234.56  [ 0.123456 x 104]
~0.000000123456789  [0.1234567 x 10-6]

1.1.4 IEEE standard for Floating point standard

·         Define by IEEE standard
·         Two representation
  1.          Single precision (32-bit) 
  2.      Double precision (64-bit)



     Single-precision range
  •      Exponents 00000000 and 11111111 reserved
    Double-precision range
  •        Exponents 0000…00 and 1111…11 reserved


                1.1.5 FD adder hardware

  •        Much more complex than integer adder
  •        Doing it in one clock would take too long 
                ~ much longer than integer operations
                      ~slower clock would penalize all instructions
  •          FP adder usually takes several cycles that can be pipe lined
                
                     Thank you for visit our blog :)

   
                                                                                                                  Written by: 
                                                                                          
                                                                                            NURFARAH ATHIRA BINTI MUHAMMAD TUAH

                                                        B031210253




    1.2 Computer Arithmetic

Most computers use complement arithmetic for integer representations. The reason for this is mostly to simplify the circuitry required to perform integer arithmetic operations.

Binary Number System
System Digits:  0 and 1
Bit (short for binary digit):  A single binary digit
LSB (least significant bit):  The rightmost bit
MSB (most significant bit):  The leftmost bit
Upper Byte (or nybble):  The right-hand byte (or nybble) of a pair
Lower Byte (or nybble):  The left-hand byte (or nybble) of a pair

Binary Equivalents
1 Nybble (or nibble)  =  4 bits
1 Byte  =  2 nybbles  =  8 bits
1 Kilobyte (KB)  =  1024 bytes
1 Megabyte (MB)  =  1024 kilobytes  =  1,048,576 bytes
1 Gigabyte (GB)  =  1024 megabytes  =  1,073,741,824 bytes

Binary Addition
  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 0, and carry 1 to the next more significant bit
For example,
00011010 + 00001100 = 00100110
        
        1  1

carries
  0  0  0  1  1  0  1  0
   =   
26(base 10)
+ 0  0  0  0  1  1  0  0



   =   
12(base 10)
  0  0  1  0  0  1  1  0
   =   
38(base 10)

 
00010011 + 00111110 = 01010001
    
     1  1  1  1  1

carries
  0  0  0  1  0  0  1  1
   =   
19(base 10)
+ 0  0  1  1  1  1  1  0



   =   
62(base 10)
  0  1  0  1  0  0  0  1
   =   
81(base 10)
Note:  The rules of binary addition (without carries) are the same as the truths of the XOR gate.

Binary Subtraction
  • 0 - 0 = 0
  • 0 - 1 = 1, and borrow 1 from the next more significant bit
  • 1 - 0 = 1
  • 1 - 1 = 0
For example,
00100101 - 00010001 = 00010100
        
        0

borrows
  0  0  1 10  0  1  0  1
   =   
37(base 10)
- 0  0  0  1  0  0  0  1



   =   
17(base 10)
  0  0  0  1  0  1  0  0
   =   
20(base 10)

 
00110011 - 00010110 = 00011101
    
        0 10  1

borrows
  0  0  1  1  0 10  1  1
   =   
51(base 10)
- 0  0  0  1  0  1  1  0



   =   
22(base 10)
  0  0  0  1  1  1  0  1
   =   
29(base 10)
Binary Multiplication
Rules of Binary Multiplication
  • 0 x 0 = 0
  • 0 x 1 = 0
  • 1 x 0 = 0
  • 1 x 1 = 1, and no carry or borrow bits
For example,
00101001 × 00000110 = 11110110
        
0  0  1  0  1  0  0  1
   =   
41(base 10)
× 0  0  0  0  0  1  1  0



   =   
6(base 10)
0  0  0  0  0  0  0  0

0  0  1  0  1  0  0  1   

0  0  1  0  1  0  0  1      




0  0  1  1  1  1  0  1  1  0
   =   
246(base 10)

 
00010111 × 00000011 = 01000101
        
0  0  0  1  0  1  1  1
   =   
23(base 10)
× 0  0  0  0  0  0  1  1



   =   
3(base 10)
   1  1  1  1  1      

carries
0  0  0  1  0  1  1  1

0  0  0  1  0  1  1  1   




0  0  1  0  0  0  1  0  1
   =   
69(base 10)
Note:  The rules of binary multiplication are the same as the truths of the AND gate.
Another Method:  Binary multiplication is the same as repeated binary addition; add the multicand to itself the multiplier number of times.
For example,
00001000 × 00000011 = 00011000
        
           1

carries
  0  0  0  0  1  0  0  0
   =   
8(base 10)
  0  0  0  0  1  0  0  0
   =   
8(base 10)
+ 0  0  0  0  1  0  0  0



   =   
8(base 10)
  0  0  0  1  1  0  0  0
   =   
24(base 10)
Binary Division

Rules of Binary Division



  • Binary division is the repeated process of subtraction, just as in decimal division.


For example,

00101010 ÷ 00000110 = 00000111
        







 1 
 1 
 1 
   =   
7(base 10)



1  1  0 
)
 0 
 0 
 1 
1
 1 
 0 
 1 
 0 
   =   
42(base 10)




-  
 1 
 1 
 0 


   =   
6(base 10)









 1 




borrows



1 
 0 
1
 1 




-  
 1 
 1 
 0 










   
 1 
 1 
 0 




-  
 1 
 1 
 0 











 0 

 
10000111 ÷ 00000101 = 00011011
        





 1 
 1 
 0 
 1 
 1 
   =   
27(base 10)



1  0  1 
)
 1 
 0 
 0 
1
 0 
 1 
 1 
 1 
   =   
135(base 10)


-  
 1 
 0 
 1 




   =   
5(base 10)






 1 
 1 
1




-  
 1 
 0 
 1 












 1 
 1 





-  

 0 











 1 
 1 
 1 




-  
 1 
 0 
 1 











 1 
 0 
 1 




-  
 1 
 0 
 1 











 0 
Thank You for visit our blog :)
WRITTEN BY   :  `ADILAH HANANI BINTI ABDUL HAMID
(B031210170)