Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 22

TITLE:

INTRODUCTION TO DIGITAL LOGIC

MANIPAL UNIVERSITY JAIPUR

SCHOOL OF LAW

Supervised By Submitted By Sanjana


Sachan

Mr Ravinder Sir Registration No. - 161401087

Designation: Course BA.LLB

Professor Semester 1ST


Section - B

CERTIFICATE

This is to certify that the project entitled, INTRODUCTION TO DIGITAL LOGIC


submitted by SANJANA SACHAN in partial fulfilment of the requirement for the award
of BA.LLB (HONOURS) at the MANIPAL UNIVERSITY JAIPUR is an authentic work
carried out by her under my supervision and guidance.

To the best of my knowledge, the matter embodied in the project has not been submitted to
any other University / Institute for the award of any Degree or Diploma in the year 2016-
2017.

Date: 10/09/2016

(H.O.D, SCHOOL OF LAW, MANIPAL UNIVERSITY JAIPUR)


ACKNOWLEDGEMENT

In performing our assignment, I had to take the help and guidance of some respected persons
who deserve our greatest gratitude. The completion of this assignment gives me much
pleasure. I would like to show our gratitude to RAVINDER SIR, Course Instructor, Manipal
University Jaipur for giving us good guideline for assignment throughout numerous
consultations. I would also like to expand our deepest gratitude to all those who have directly
and indirectly guided us in writing this assignment.

In addition, a thank you to the Professor who introduced us to the Methodology of work and
whose passion for the underlying structures had lasting effect. I also thank the Manipal
University Jaipur for the consent to include the copyrighted pictures as a part of our paper.

Many people, especially our classmates and team members itself have made valuable
comment suggestions on this proposal which gave us inspiration to improve our assignment. I
thank all the people for their help directly and indirectly to complete our assignment.

SANJANA SACHAN
Table of Contents
CERTIFICATE......................................................................................................... 2
ACKNOWLEDGEMENT........................................................................................... 3
INTRODUCTION..................................................................................................... 4
CHAPTER 1............................................................................................................. 5
Characteristics of binary number system are as follows:.............................................7
Example............................................................................................................ 8
Characteristics of octal number system are as follows:................................................8
Example............................................................................................................ 8
Characteristics of hexadecimal number system are as follows:.....................................9
Example............................................................................................................ 9
CHAPTER 2........................................................................................................... 10
Counting in binary............................................................................................ 11
Converting binary to decimal.............................................................................. 12
CHAPTER 3........................................................................................................... 14
Combinational Logic........................................................................................... 15
CHAPTER 4........................................................................................................... 16
Complement (NOT)........................................................................................... 17
OR................................................................................................................. 17
AND............................................................................................................... 18
XOR............................................................................................................... 18
CONCLUSION....................................................................................................... 20
WEBLIOGRAPHY.................................................................................................. 21
INTRODUCTION

What is Digital Logic ?

Digital logic is a wide-open and rapidly-growing field, and yet every single digital device
operates on some combination of three basic logic functions: AND, OR, and NOT. Even the
most complex circuit contains some combination of these three functions, and can be reduced
to them in the final analysis. These pages define and describe the three basic functions and
some of the unending ways in which they can be usefully combined.

It includes :

- Digital Circuitry
- Programming

Digital Circuitry

Digital logic circuits can be broken down into two


subcategories- combinational and sequential. Combinational logic changes instantly- the
output of the circuit responds as soon as the input changes (with some delay, of course, since
the propagation of the signal through the circuit elements takes a little time). Sequential
circuits have a clock signal, and changes propagate through stages of the circuit on edges of
the clock.

Typically, a sequential circuit will be built up of blocks of combinational logic separated by


memory elements that are activated by a clock signal.

Programming

Digital logic is important in programming, as well. Understanding digital logic makes


complex decision making possible in programs.
There are also some subtleties in programming that are important to understand; well get
into that once weve covered the basics.

CHAPTER 1

WHAT IS A NUMBER SYSTEM ?

When we type some letters or words, the computer translates them in numbers as computers
can understand only numbers. A computer can understand positional number system where
there are only a few symbols called digits and these symbols represent different values
depending on the position they occupy in the number.

A value of each digit in a number can be determined using

The digit

The position of the digit in the number

The base of the number system (where base is defined as the total number of digits
available in the number system).

TYPES OF NUMBER SYSTEMS

DECIMAL NUMBER SYSTEM

The number system that we use in our day-to-day life is the decimal number system.
Decimal number system has base 10 as it uses 10 digits from 0 to 9. In decimal number
system, the successive positions to the left of the decimal point represent units, tens,
hundreds, thousands and so on.
Each position represents a specific power of the base (10). For example, the decimal number
1234 consists of the digit 4 in the units position, 3 in the tens position, 2 in the hundreds
position, and 1 in the thousands position, and its value can be written as

(1x1000)+ (2x100)+ (3x10)+ (4xl)

(1x103)+ (2x102)+ (3x101)+ (4xl00)

1000 + 200 + 30 + 4

1234

As a computer programmer or an IT professional, you should understand the following


number systems which are frequently used in computers.

S.N. Number System and Description

1 Binary Number System

Base 2. Digits used : 0, 1

2 Octal Number System

Base 8. Digits used : 0 to 7

3 Hexa Decimal Number System

Base 16. Digits used : 0 to 9, Letters used : A- F

BINARY NUMBER SYSTEM

Characteristics of binary number system are as follows:

Uses two digits, 0 and 1.


Also called base 2 number system

Each position in a binary number represents a 0 power of the base (2). Example 20

Last position in a binary number represents a x power of the base (2). Example
2x where x represents the last position - 1.

Example

Binary Number : 101012

Calculating Decimal Equivalent:

Step Binary Number Decimal Number

Step 1 101012 ((1 x 24) + (0 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10

Step 2 101012 (16 + 0 + 4 + 0 + 1)10

Step 3 101012 2110

Note : 101012 is normally written as 10101.

OCTAL NUMBER SYSTEM

Characteristics of octal number system are as follows:

Uses eight digits, 0,1,2,3,4,5,6,7.

Also called base 8 number system

Each position in an octal number represents a 0 power of the base (8). Example 80
Last position in an octal number represents a x power of the base (8). Example
8x where x represents the last position - 1.

Example

Octal Number : 125708

Calculating Decimal Equivalent:

Step Octal Number Decimal Number

Step 1 125708 ((1 x 84) + (2 x 83) + (5 x 82) + (7 x 81) + (0 x 80))10

Step 2 125708 (4096 + 1024 + 320 + 56 + 0)10

Step 3 125708 549610

Note : 125708 is normally written as 12570.

HEXADECIMAL NUMBER SYSTEM

Characteristics of hexadecimal number system are as follows:

Uses 10 digits and 6 letters, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.

Letters represents numbers starting from 10. A = 10. B = 11, C = 12, D = 13, E = 14,
F = 15.

Also called base 16 number system

Each position in a hexadecimal number represents a 0 power of the base (16).


Example 160

Last position in a hexadecimal number represents a x power of the base (16).


Example 16x where x represents the last position - 1.
Example

Hexadecimal Number : 19FDE16

Calculating Decimal Equivalent:

Step Binary Number Decimal Number

Step 1 19FDE16 ((1 x 164) + (9 x 163) + (F x 162) + (D x 161) + (E x 160))10

Step 2 19FDE16 ((1 x 164) + (9 x 163) + (15 x 162) + (13 x 161) + (14 x
160))10

Step 3 19FDE16 (65536+ 36864 + 3840 + 208 + 14)10

Step 4 19FDE16 10646210

Note : 19FDE16 is normally written as 19FDE.


CHAPTER 2

CONVERSIONS & COUNTING

Counting in binary

You can count in decimal endlessly, even in your sleep, but how would you count in binary?
Zero and one in base-two should look pretty familiar: 0 and 1. From there things get
decidedly binary.

Remember that weve only got those two digits, so as we do in decimal, when we run out of
symbols weve got to shift one column to the left, add a 1, and turn all of the digits to right to
0. So after 1 we get 10, then 11, then 100. Lets start counting

Decimal Binary ... Decimal Binary

0 0 16 10000

1 1 17 10001

2 10 18 10010

3 11 19 10011

4 100 20 10100
5 101 21 10101

6 110 22 10110

7 111 23 10111

8 1000 24 11000

9 1001 25 11001

10 1010 26 11010

11 1011 27 11011

12 1100 28 11100

13 1101 29 11101

14 1110 30 11110

15 1111 31 11111

Does that start to paint the picture? Lets examine how we might convert from those binary
numbers to decimal.

Converting binary to decimal

Theres no one way to convert binary-to-decimal. Well outline two methods below, the more
mathy method, and another thats more visual. Well cover both, but if the first uses too
much ugly terminology skip down to the second.

Method 1

Theres a handy function we can use to convert any binary number to decimal:

There are four important elements to that equation:

an, an-1, a1, etc., are the digits of a number. These are the 0s and 1s youre familiar
with, but in binary they canonly be 0 or 1.
The position of a digit is also important to observe. The position starts at 0, on the
right-most digit; this 1 or 0 is the least-significant. Every digit you move to the left
increases in significance, and also increases the position by 1.

The length of a binary number is given by the value of n, actually its n+1. For
example, a binary number like 101 has a length of 3, something larger, like 10011110
has a length of 8.

Each digit is multiplied by a weight: the 2n, 2n-1, 21, etc. The right-most weight -
20 equates to 1, move one digit to the left and the weight becomes 2, then 4, 8, 16, 32,
64, 128, 256, and on and on. Powers of two are of great importance to binary, they
quickly become very familiar.

Lets get rid of those ns and exponents, and carry out our binary positional notation equation
out eight positions:

Taking that further, lets plug in some values for the digits. What if you had a binary number
like: 10011011? That would mean an values of:

For the sake of this tutorial, assume that the right-most value is always the least-significant.
The least-significant digit in a number is the digit that has the smallest influence on a
numbers ultimate value. The significance of the digits is arbitrary - part of a convention
called endianness. A binary number can be either big-endian, where the most-significant
digit is the left-most, or little-endian which well use in this tutorial (and youll usually see
binary numbers written this way).

Now, plug those digits into our binary to decimal equation. Because our number is little-
endian the least-significant value should be multiplied by the smallest weight.
1 * 27 + 0 * 26 + 0 * 25 + 1 * 24 + 1 * 23 + 0 * 22 + 1 * 21 + 1 * 20

And we can simplify it down to find our decimal number:

= 1 * 128 + 0 * 64 + 0 * 32 + 1 * 16 + 1 * 8 + 0 * 4 + 1 * 2 + 1 * 1

= 128 + 16 + 8 + 2 + 1
= 155

Youll quickly notice that it takes many more digits to represent a number in binary than it
does in decimal, but its all done with just two digits!

Method 2

Another, more visual way to convert binary numbers to decimal is to begin by sorting
each 1 and 0 into a bin. Each bin has a successive power of two weight to it, the 1, 2, 4, 8, 16,
were used to. Carrying it out eight places would look something like this:

128 64 32 16 8 4 2 1

So, if we sorted our 10011011 binary number into those bins, itd look like this:

128 64 32 16 8 4 2 1

1 0 0 1 1 0 1 1

For every bin that has a binary 0 value in it, just cross out and remove it.

128 64 32 16 8 4 2 1

1 0 0 1 1 0 1 1
CHAPTER 3

COMBINATIONAL LOGIC CIRCUITS

Unlike Sequential Logic Circuits whose outputs are dependant on both their present inputs
and their previous output state giving them some form of Memory, the outputs
of Combinational Logic Circuits are only determined by the logical function of their current
input state, logic 0 or logic 1, at any given instant in time.

The result is that combinational logic circuits have no feedback, and any changes to the
signals being applied to their inputs will immediately have an effect at the output. In other
words, in a Combinational Logic Circuit, the output is dependant at all times on the
combination of its inputs. So if one of its inputs condition changes state, from 0-1or 1-0, so
too will the resulting output as by default combinational logic circuits have no memory,
timing or feedback loops within their design.
Combinational Logic

Combinational Logic Circuits are made up from basic logic NAND, NOR or NOT gates
that are combined or connected together to produce more complicated switching circuits.
These logic gates are the building blocks of combinational logic circuits. An example of a
combinational circuit is a decoder, which converts the binary code data present at its input
into a number of different output lines, one at a time producing an equivalent decimal code at
its output.

Combinational logic circuits can be very simple or very complicated and any combinational
circuit can be implemented with only NAND and NOR gates as these are classed as
universal gates.

The three main ways of specifying the function of a combinational logic circuit are:

1. Boolean Algebra This forms the algebraic expression showing the operation of
the logic circuit for each input variable either True or False that results in a logic
1 output.

2. Truth Table A truth table defines the function of a logic gate by providing a
concise list that shows all the output states in tabular form for each possible
combination of input variable that the gate could encounter.

3. Logic Diagram This is a graphical representation of a logic circuit that shows


the wiring and connections of each individual logic gate, represented by a specific
graphical symbol, that implements the logic circuit.

and all three of these logic circuit representations are shown below.
As combinational logic circuits are made up from individual logic gates only, they can also be
considered as decision making circuits and combinational logic is about combining logic
gates together to process two or more signals in order to produce at least one output signal
according to the logical function of each logic gate. Common combinational circuits made up
from individual logic gates that carry out a desired application include Multiplexers, De-
multiplexers, Encoders, Decoders, Full and Half Adders etc.

CHAPTER 4

Complement (NOT)

The complement of a binary value is like finding the exact opposite of everything about it.
The complement function looks at a number and turns every 1 into a 0 and every 0 becomes
a 1. The complement operator is also called NOT.

For example to find the complement of 10110101:


NOT 10110101 (decimal 181)

-------- =
01001010 (decimal 74)

NOT is the only bitwise operator which only operates on a single binary value.

OR

OR takes two numbers and produces the union of them. Heres the process to OR two binary
numbers together: line up each number so the bits match up, then compare each of their bits
that share a position. For each bit comparison, if either or both bits are 1, the value of the
result at that bit-position is 1. If both values have a 0 at that position, the result also gets a 0 at
that position.

The four possible OR combinations, and their outcome are:

0 OR 0 = 0

0 OR 1 = 1

1 OR 0 = 1

1 OR 1 = 1

For example to find the 10011010 OR 01000110, line up each of the numbers bit-by-bit. If
either or both numbers has a 1 in a column, the result value has a 1 there too:

10011010

OR 01000110
-------- =
11011110

Think of the OR operation as binary addition, without a carry-over. 0 plus 0 is 0, but 1 plus
anything will be 1.
AND

AND takes two numbers and produces the conjunction of them. AND will only produce
a 1 if both of the values its operating on are also 1.

The process of AND'ing two binary values together is similar to that of OR. Line up each
number so the bits match up, then compare each of their bits that share a position. For each
bit comparison, if either or both bits are 0, the value of the result at that bit-position is 0. If
both values have a 1 at that position, the result also gets a 1 at that position.

The four possible AND combinations, and their outcome are:

0 AND 0 = 0

0 AND 1 = 0

1 AND 0 = 0

1 AND 1 = 1

For example, to find the value of 10011010 AND 01000110, start by lining up each value.
The result of each bit-position will only be 1 if both bits in that column are also 1.

10011010

AND 01000110
-------- =
00000010

Think of AND as kind of like multiplication. Whenever you multiply by 0 the result will also
be 0.

XOR

XOR is the exclusive OR. XOR behaves like regular OR, except itll only produce
a 1 if either one or the othernumbers has a 1 in that bit-position.
The four possible XOR combinations, and their outcome are:

0 XOR 0 = 0

0 XOR 1 = 1

1 XOR 0 = 1

1 XOR 1 = 0

For example, to find the result of 10011010 XOR 01000110:

10011010

XOR 01000110
-------- =
11011100

Notice the 2nd bit, a 0 resulting from two 1s XORed together.


CONCLUSION

In this project I have introduced the topic of Digital Logic. First I have given the basic
introduction of digital logic and then proceeded with the main topics. It includes digital
circuitry and programming.
And also covered the topics of conversions and counting as well as combinational logic.
And chapter 4 includes
NOT
OR
AND
XOR
WEBLIOGRAPHY

https://learn.sparkfun.com/tutorials/digital-logic
https://learn.sparkfun.com/tutorials/binary
http://www.electronics-tutorials.ws/combination/comb_1.html

You might also like