Wednesday, 25 January 2017

The Edge Triggered D Type Flip-flop

Image result for flip flop d type logic gateD Type Flip-flops

The major drawback of the SR flip-flop (i.e. its indeterminate output and non-allowed logic states) described in Digital Electronics Module 5.2 is overcome by the D type flip-flop. This flip-flop, shown in Fig. 5.3.1 together with its truth table and a typical schematic circuit symbol, may be called a Data flip-flop because of its ability to ‘latch’ and remember data, or a Delay flip-flop because latching and remembering data can be used to create a delay in the progress of that data through a circuit. To avoid the ambiguity in the title therefore, it is usually known simply as the D Type. The simplest form of D Type flip-flop is basically a high activated SR type with an additional inverter to ensure that the S and R inputs cannot both be high or both low at the same time. This simple modification prevents both the indeterminate and non-allowed states of the SR flip-flop. The S and R inputs are now replaced by a single D input, and all D type flip-flops have a clock input.D-Type-ff.gif


Edge Triggered D Type Flip-flop

The clock pulse applied to the flip-flop is reduced to a very narrow positive going clock pulse of only about 45ns duration, by using an AND gate and applying the clock pulse directly to input ‘a’ but delaying its arrival at input ‘b’ by passing it through 3 inverters. This inverts the pulse and also delays it by three propagation delays, (about 15ns per inverter gate for 74HC series gates). The AND gate therefore produces logic 1 at its output only for the 45ns when both ‘a’ and ‘b’ are at logic 1 after the rising edge of the clock pulse.

Sunday, 22 January 2017

Boolean Algebra

Related image

Boolean Algebra is used to analyze and simplify the digital (logic) circuits. It uses only the binary numbers i.e. 0 and 1. It is also called as Binary Algebra or logical Algebra. Boolean algebra was invented by George Boole in 1854.

Boolean Laws
There are six types of Boolean Laws.

Commutative law
Any binary operation which satisfies the following expression is referred to as commutative operation.

Commutative Law
Commutative law states that changing the sequence of the variables does not have any effect on the output of a logic circuit.

Associative law
This law states that the order in which the logic operations are performed is irrelevant as their effect is the same.

Associative Law
Distributive law
Distributive law states the following condition.

Distributive Law
AND law
These laws use the AND operation. Therefore they are called as AND laws.

AND Law
OR law
These laws use the OR operation. Therefore they are called as OR laws.

OR Law
INVERSION law
This law uses the NOT operation. The inversion law states that double inversion of a variable results in the original variable itself.

Image result for de morgan's law






Logic Gates



Digital systems are said to be constructed by using logic gates. These gates are the AND, OR, NOT, NAND, NOR, EXOR and EXNOR gates. The basic operations are described below with the aid of truth tables.

Image result for logic gates
The XOR gate (sometimes EOR gate, or EXOR gate and pronounced as Exclusive OR gate) is a digital logic gate that implements an exclusive or; that is, a true output (1/HIGH) results if one, and only one, of the inputs to the gate is true. If both inputs are false (0/LOW) or both are true, a false output results.

Thursday, 19 January 2017

January Mock Corrections

Paper1

1Bi) The system stores floating point numbers in normalised form using 2's complement with a 12-bit mantissa and a 4-bit exponent as follows.

Num1             A802                101010000000  0010            -2.75

Bii) Why should floating point numbers be stored in normalised form?

To maximize precision in a given number of bits to maximize the accuracy in a given number of bits, and to minimize rounding errors.


2B)  A normalised floating point representation uses an 8-bit mantissa and a 4-bit exponent, both stored using two's complement format.

1.0110000    0010
=-2.5


2C) write the normalised floating point representation of the denary value 12.75.
           0.1100110        0010

Q3E)  Run-length encoding (RLE) is an example of  compression method that could be used to reduce the amount of memory required to store the icon.
Describe the principle used by RLE to compress a file and explain why RLE is an appropriate compression method for compressing images such as icons.

Identify multiple data values/ colours that are the same and represents them as one data values. E.g b,b,b,b=4b. Icons contain sequences of pixels that are the same colour. RLE is a lossless compression so the quality will not be effected.

5B) If an image required 3000 colours - how many bits would be required for the colour depth and why?

12 bits is enough because it is the smallest number of bits that can accommodate 3000 colours. 12 bits can represent a max number of 4096 colours which is more than 3000.

Tuesday, 10 January 2017

Bubble Sort

The bubble sort is used to sort a list of numbers. It works by comparing pairs of numbers and swapping them if necessary. It means that after each iteration the next largest number in the sequence will go to the top.

Original=       1  2   7  4  5
1st Iteration= 1  2   4  5  7

You continue going through each iteration until no swaps are made. Then it is complete.

Pseudocode

Repeat
Swapped= false
For 1 to (array length) do
If A(i) > A(i + 1) then
temp=A(i)
swap(A(i)=A(i + 1))
A(i + 1) = temp
Swapped = true
End If
End for
until not swapped
End Procedure

VB Code

Module Module1
    Dim num(8) As Integer
    Dim swap As Boolean
    Dim Temp As Integer
    Sub Main()
        num(1) = 2
        num(2) = 1
        num(3) = 4
        num(4) = 8
        num(5) = 6
        num(6) = 5
        num(7) = 7
        num(8) = 3
        Do
            swap = False
            For index = 1 To 8 - 1
                If num(index) > num(index + 1) Then
                    Temp = num(index)
                    num(index) = num(index + 1)
                    num(index + 1) = Temp
                    swap = True
                End If
            Next
        Loop Until swap = False

        For index = 1 To 8
            Console.WriteLine(num(index))
        Next
        Console.ReadLine()
    End Sub
End Module