Monday, November 25, 2013

Digital Logic

BASIC REVISON OF LOGIC GATES
:65:Table 2.1.1 : Basic Logic Gates
Published by :
Syaqira Liyana Binti Ahmad Ghazali 
( B031310568 )

Combinational Circuit

COMBINATIONAL CIRCUITS
  • Logic circuit formed by combinational of logic circuit. Logic gates are connected together to produce a specified output
  • Various combinations of input values can determine the combinational logic circuit’s output
  • Boolean algebra provides a concise way to express the operation of combinational logic circuit

It can be defined in three way :

1.  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
Example:
:65:Table 2.2.1: Example Of truth table

2.  Graphical symbols- The layout of connected gates that represent the logic gates.
Example:
:65:Table 2.2.2 : Sample of logic circuit

3.  Boolean equation – A combinational logic circuit can be described by a Boolean equation


Can be represented in two forms :
    i. SOP ( Sum Of Product ) – 
       •  When two or more product terms are summed by Boolean addition. 

    ii. POS (Product Of Sum )
       •  When two or more product terms are multiplied by Boolean multiplication. 

Two ways to simplify Boolean equation
    i.  Laws of Boolean algebra – A set of rules for symbolic manipulation are needed in order to simplify Boolean expression.
:65:Table 2.2.3 Basic Law of Boolean Algebra

Example : 
:65: Table 2.2.3.1 Simplify Boolean Algebra

ii.  Karnaugh Map (K-Map) – Comprise a box / grid for every line in the truth table.
  • Straight forward method of minimizing Boolean expression.
  • The diagram below illustrates the correspondence between K-Map and the truth table for the general case of two variables.
:65:Table 2.2.4 : Mintermsand K-Map for 3 variable


DeMorgan’s Law

  • DeMorgan’s theorems provide mathematical verification of the equivalency of the NAND,NOR
:65:Table : DeMorgan’s Law Logic Gates


Published by :
Syaqira Liyana Binti Ahmad Ghazali 
( B031310568 )

Sunday, November 24, 2013

Operations on integers



1. Addition and subtraction


Operand
Overflow

Addition
Subtraction
+ve , -ve
no
no
+ve , +ve
If result sign is 1
If result sign is 0
-ve , -ve
If result sign is 0
If result sign is 1

Example:  5 + 4

+5 :  0000 0000 … 0000 0101
+4 :  0000 0000 … 0000 0100
+9 :  0000 0000 … 0000 1001
           
Thus, when adding two positive operand with sign result sign is 1 = overflow.

Example:  5 + (-4)

+5 :  0000 0000 … 0000 0101
-4  :  1111 1111… 1111 1100
+1 :  0000 0000 … 0000 0001

Thus, when adding a positive and a negative  operand = not overflow.

Example:  5 (+4)

+5 :  0000 0000 … 0000 0101
+4 :  0000 0000 … 0000 0100
+1 :  0000 0000 … 0000 0001
           
Thus, when subtracting two positive operand with sign result sign is 0 = overflow.


2. Dealing with overflow

      I.        Some languages (e.g., C) ignore overflow
·         Use MIPS addu, addui, subu instructions
    II.        Other languages (e.g., Ada, Fortran) require raising an exception
·         Use MIPS add, addi, sub instructions
·         On overflow, invoke exception handler
-       Save PC in exception program counter (EPC) register
-       Jump to predefined handler address
-        mfc0 (move from system control) instruction can retrieve EPC value,
           to return after corrective action

3.Arithmetic for Multimedia

       I.        Graphics and media processing operates on vectors of 8-bit and 16-bit data
·         Use 64-bit adder, with partitioned carry chain
·         Operate on 8×8-bit, 4×16-bit, or 2×32-bit vectors
·         SIMD (single-instruction, multiple-data)
-           
     II.        Saturating operations
·         On overflow, result is largest representable value
-       c.f. 2s-complement modulo arithmetic
·         E.g., clipping in audio, saturation in vide

4. Multiplication and division

# Multiplication

Binary multiplication is just a bunch of right shifts and adds

# Division

Division is just a bunch of quotient digit guesses and left shifts and subtracts dividend = quotient x divisor + remainder


Published by : 
Hafizah binti Ismail  B031310266


About Floating Point








What are the function of floating point?

To representation of non-integral numbers including very small and very large numbers.

5.98 x 10 7 = Significant digits × base exponent

Example

Actual
Floating Point
0.0000000478
4.78 × 10-8
0.00000001
0.1 × 10-7
-1000000000
-1.0 × 109
-0.00111
-1.11× 2-3

IEEE 754-1985 was an industry standard for representing floating-point numbers in computers, officially adopted in 1985 and superseded in 2008 by IEEE 754-2008. During its 23 years, it was the most widely used format for floating-point computation. It was implemented in software, in the form of floating-point libraries, and in hardware, in the instructions of many CPUs and FPUs. The first integrated circuit to implement the draft of what was to become IEEE 754-1985 was the Intel 8087.



IEEE Floating-Point Format

Single Precision


Double Precision





x = (-1)S × (1+Fraction) × 2(Exponent-Bias)

sign = 0, because the number is positive. (1 indicates negative.)
biased exponent = actual exponent + bias


Floating Point Example

From decimal to floating number

  • Convert -1313.3125 to IEEE 32-bit floating point format.
a.      The integral part is 131310 = 101001000012.
b.     The fractional:
0.3125
× 2 =
0.625
0
Generate 0 and continue.
0.625
× 2 =
1.25
1
Generate 1 and continue with the rest.
0.25
× 2 =
0.5
0
Generate 0 and continue.
0.5
× 2 =
1.0
1
Generate 1 and nothing remains.
c.      So 1313.312510 = 10100100001.01012.
d.     Normalize: 10100100001.01012 = 1.010010000101012 × 210.
e.      Fraction is 01001000010101000000000,
exponent is 10 + 127 = 137 = 100010012,
sign bit is 1 because it is negative number.

Then you will get the answers as follow:
Binary 32 bits
Sign [1bit]
Exponent [8bits]
Fraction [23bits]
1 (-)
10001001 
01001000010101
000000000 

Binary 64 bits
Sign [1bit]
Exponent [11bits]
Fraction [52bits]
1 (-)
10000001001 
01001000010101
0000000000000000
0000000000000000
000000 

From floating point to decimal

a.      Separate:
01000100001101100001000000000000 2
Sign [1bit]
Exponent [8bits]
Fraction [23bits]
0(+)
10001000
011011000010
00000000000

b.     Exponent: 100010002 = 13610; 136 − 127 = 9.
c.      Denormalize: 1.011011000012 × 29 = 1011011000.01.
d.     Convert:

Exponents      29    28   27   225  24  2221  20 2-1  2-2
Place Values 512 256 128 64 32 16  8   4   2   1  0.5 0.25
 Bits               1      0    1   1   0   1   1   0   0  0 . 0     1
Value            512     +128+64  +16 +8                   +0.25=728.25

e.      Sign: positive because the sign 1bit is 0
Result: 01000100001101100001000000000000 2 is 
728.25.

Floating point addition
is analogous to addition using scientific notation. For example, to add 2.25x 10^0 to 1.340625x 10^2 :

1.     Shift the decimal point of the smaller number to the left until the exponents are equal. Thus, the first number becomes 0.0225x 10^2 .
2.     Add the numbers with decimal points aligned:


3.     Normalize the result. = 1.363125x10^2

Floating Point Multiplication

Multiply the following two numbers in scientific notation by hand:

1.110 × 1010 × 9.200 × 10-5

1.   Add the exponents to find

New Exponent = 10 + (-5) = 5

If we add biased exponents, bias will be added twice. Therefore we need to subtract it once to compensate:
(10 + 127) + (-5 + 127) = 259
259 - 127 = 132 which is (5 + 127) = biased new exponent

2.   Multiply

1.110 × 9.200 = 10.212000

Can only keep three digits to the right of the decimal point, 
so the result is

10.212 × 105

3.   Normalise the result

1.0212 × 106

4.   Round it

1.021 × 106

 Published by 
SITI NURHASTINI BINTI ROSALI  ( B031310320 )

 

Copyright © 2013 | by BITS STUDENT SIG2