Uploaded by Raj Prajapati

Computer Architecture Assignment: ICs, Logic Gates, Flip-Flops

advertisement
21U02023
INDIAN INSTITUTE OF INFORMATION TECHNOLOGY, BHOPAL
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
Computer Organisation and Architecture (CSE -222)
ASSIGNMENT
Submitted by:
Pranjal Dubey
21U02023
Submitted to:
Dr.Gagan Vishwakarma
Asst. Professor IIIT BHOPAL
CSE Department
Page | 1
21U02023
TABLE OF CONTENTS
S.No
Title
Date of
Performance
Page
No.
1
Integrated Circuits and Devices
18/01/23
4 - 12
2
Online Digital Logic
Simulator
Implementation of half adder
and full adder circuit in circuit
verse
Implementation of 2 X 4
Decoder in circuit verse
Implementation of 4 X 1
MUX
18/01/23
13 - 14
01/02/23
15 - 20
15/02/23
21-22
22/02/23
23-24
3
4
5
6
Implementation of Single Bus
System
22/02/23
25-26
7
Implementation of 8 bit
Arithmetic Circuit
23/03/23
27-28
8
Implementation of 8 bit logic
circuit
23/03/23
29
9
Implementation of 8 bit
circular shifter
12/04/23
30
Page | 2
Remarks
21U02023
TABLE OF FIGURES
Assignment
Figure no.
Title of Figures
Page no.
1
1 - 15
IC’s and devices
4 - 12
2
16
Gates Implementation in circuit
verse
13 - 14
3
17-36
Implementation of different cases
of Full Adder and Half Adder in
circuit verse
15 - 20
4
37 - 38
Implementation of 2X4 Decoder
in circuit verse.
21 – 22
5
39
Implementation of 4X1 MUX in
circuit verse.
23 - 24
6
40
Implementation of Single Bus
System in Circuit Verse
25 - 26
Page | 3
7
41
Implementation of 8 bit
Arithmetic Circuit
27 - 28
8
42
Implementation of 8 bit logic
circuit
29
9
43
Implementation of 8 bit circular
shifter
30
21U02023
ASSIGNMENT 1
Question 1 - Describe in detail about IC’s and devices used from computer architecture
and organisation. Also include real pictures of each devices in its brief description.
Integrated Circuits:
Integrated circuits (ICs) are small semiconductor devices that are used to perform a wide range of
electronic functions. They are made up of a combination of transistors, diodes, and other
components that are designed to work together to perform specific tasks. ICs can be found in a
wide variety of electronic devices, including computers, smartphones, televisions, and many other
devices.
In computer architecture, ICs are used to perform a wide range of functions, including memory
storage, data processing, and communication. Some common types of ICs found in computers
include:
Memory ICs: These are used to store data and instructions that the computer uses to perform tasks.
There are several different types of memory ICs, including RAM (random access memory), ROM
(read-only memory), and flash memory.
Figure 1
Microprocessors: These are the "brain" of the computer, and are used to perform the majority of
the data processing tasks. They are typically made up of a large number of transistors and other
components that are designed to work together to perform complex calculations and logical
operations.
Figure 2
Page | 4
21U02023
Input/Output (I/O) ICs: These are used to communicate with other devices and peripherals, such
as a keyboard, mouse, or monitor. They are typically responsible for converting the electrical
signals from these devices into a form that can be understood by the computer's microprocessor.
Figure 3
Communications ICs: These are used to enable communication between devices and networks,
such as Ethernet, WiFi, and Bluetooth.
Figure 4
Power Management ICs: These are used to control the power supply of the device, by regulating
the voltage and current to different sections of the device.
Figure 5
Overall, ICs are a critical component of modern computer architecture, and they play a vital role
in enabling the high performance and functionality of today's computers.
Logic gates:
A logic gate is a device that acts as a building block for digital circuits. They perform basic logical
functions that are fundamental to digital circuits. Most electronic devices we use today will have
some form of logic gates in them.
Page | 5
21U02023
In a circuit, logic gates will make decisions based on a combination of digital signals coming from
its inputs. Most logic gates have two inputs and one output. Logic gates are based
on Boolean algebra.
At
any
given
moment,
every
terminal
is
in
one
of
the
two binary conditions, false or true. False represents 0, and true represents 1. Depending on the
type of logic gate being used and the combination of inputs, the binary output will differ. A logic
gate can be thought of like a light switch, wherein one position the output is off -- 0, and in another,
it is on -- 1. Logic gates are commonly used in integrated circuits (IC).
There are seven basic logic gates: AND, OR, XOR, NOT, NAND, NOR, and XNOR.
AND Gate: The AND gate is an electronic circuit which gives a high output only if all its inputs
are high. The AND operation is represented by a dot (.) sign.
Figure 6
OR Gate: The OR gate is an electronic circuit which gives a high output if one or more of its inputs
are high. The operation performed by an OR gate is represented by a plus (+) sign.
Figure 7
NOT Gate: The NOT gate is an electronic circuit which produces an inverted version of the input
at its output. It is also known as an Inverter.
Page | 6
21U02023
NAND Gate: The NOT-AND (NAND) gate which is equal to an AND gate followed by a NOT
gate. The NAND gate gives a high output if any of the inputs are low. The NAND gate is
represented by a AND gate with a small circle on the output. The small circle represents inversion.
Figure 8
NOR Gate: The NOT-OR (NOR) gate which is equal to an OR gate followed by a NOT gate. The
NOR gate gives a low output if any of the inputs are high. The NOR gate is represented by an OR
gate with a small circle on the output. The small circle represents inversion.
Figure 9
XOR Gate: The 'Exclusive-OR' gate is a circuit which will give a high output if one of its inputs
is high but not both of them. The XOR operation is represented by an encircled plus sign.
Page | 7
21U02023
Figure 10
XNOR Gate: The 'Exclusive-NOR' gate is a circuit that does the inverse operation to the XOR
gate. It will give a low output if one of its inputs is high but not both of them. The small circle
represents inversion.
Figure 11
Flip-Flop:
A circuit that has two stable states is treated as a flip flop. These stable states are used to store
binary data that can be changed by applying varying inputs. The flip flops are the fundamental
building blocks of the digital system. Flip flops and latches are examples of data storage
elements. In the sequential logical circuit, the flip flop is the basic storage element. The latches
and flip flops are the basic storage elements but different in working. There are the following
types of flip flops:
SR Flip Flop
The S-R flip flop is the most common flip flop used in the digital system. In SR flip flop, when
the set input "S" is true, the output Y will be high, and Y' will be low. It is required that the
Page | 8
21U02023
wiring of the circuit is maintained when the outputs are established. We maintain the wiring until
set or reset input goes high, or power is shutdown.
Figure 12 : SR Flip Flop
The S-R flip flop is the simplest and easiest circuit to understand.
Truth Table:
J-K Flip-flop
The JK flip flop is used to remove the drawback of the S-R flip flop, i.e., undefined states. The
JK flip flop is formed by doing modification in the SR flip flop. The S-R flip flop is improved in
order to construct the J-K flip flop. When S and R input is set to true, the SR flip flop gives an
inaccurate result. But in the case of JK flip flop, it gives the correct output.
Figure 13 : JK Flip Flop
Page | 9
21U02023
In J-K flip flop, if both of its inputs are different, the value of J at the next clock edge is taken by
the output Y. If both of its input is low, then no change occurs, and if high at the clock edge, then
from one state to the other, the output will be toggled. The JK Flip Flop is a Set or Reset Flip
flop in the digital system.
Truth Table:
D Flip Flop
D flip flop is a widely used flip flop in digital systems. The D flip flop is mostly used in shiftregisters, counters, and input synchronization.
Figure 14 : D Flip Flop
Truth Table:
T Flip Flop
Page | 10
21U02023
Just like JK flip-flop, T flip flop is used. Unlike JK flip flop, in T flip flop, there is only single
input with the clock input. The T flip flop is constructed by connecting both of the inputs of JK
flip flop together as a single input.
Figure 15 : T Flip Flop
The T flip flop is also known as Toggle flip-flop. These T flip-flops are able to find the
complement of its state.
Truth Table:
Register:
Registers are a type of computer memory used to quickly accept, store, and transfer data and
instructions that are being used immediately by the CPU. The registers used by the CPU are often
termed as Processor registers.
A processor register may hold an instruction, a storage address, or any data (such as bit sequence
or individual characters).
The computer needs processor registers for manipulating data and a register for holding a memory
address. The register holding the memory location is used to calculate the address of the next
instruction after the execution of the current instruction is completed.
Following is the list of some of the most common registers used in a basic computer:
Register
Symbol
Number of bits
Function
Data register
DR
16
Holds memory operand
Address register
AR
12
Holds address for the memory
Page | 11
21U02023
Accumulator
AC
16
Processor register
Instruction register
IR
16
Holds instruction code
Program counter
PC
12
Holds address of the instruction
Temporary register
TR
16
Holds temporary data
Input register
INPR
8
Carries input character
Output register
OUTR
8
Carries output character
•
The Memory unit has a capacity of 4096 words, and each word contains 16 bits.
•
The Data Register (DR) contains 16 bits which hold the operand read from the memory
location.
•
The Memory Address Register (MAR) contains 12 bits which hold the address for the
memory location.
•
The Program Counter (PC) also contains 12 bits which hold the address of the next
instruction to be read from memory after the current instruction is executed.
o
The Accumulator (AC) register is a general purpose processing register.
o
The instruction read from memory is placed in the Instruction register (IR).
o
The Temporary Register (TR) is used for holding the temporary data during the
processing.
o
The Input Registers (IR) holds the input characters given by the user.
o
The Output Registers (OR) holds the output after processing the input data.
Page | 12
21U02023
ASSIGNMENT 2
Question2 – Study and explore about online digital logic simulator Circuit Verse. Briefly
explain its features, components and user directions.
CircuitVerse is an easy to use digital logic circuit simulator which aims at providing a platform to
create, share and learn digital circuits. CircuitVerse is an open source project provides a platform
where circuits can be designed and simulated using a web-based graphical user interface (UI). The
logic simulator can be used to design up to complete CPU implementations, although it is designed
primarily for educational use. It can run on almost any device without the need for installing any
software. The platform has been designed for use by students, professionals and hobbyists alike.
Benefit of circuit simulation with CircuitVerse is providing: Simulating a circuit's behavior before actually building it can greatly improve design efficiency by
making faulty designs known as such, and providing insight into the behavior of electronics circuit
designs. Circuit simulation is cost effective as well as time-saving. We can quickly design
complicated circuits with the help of the software. This can save design engineers and businesses
a significant amount both time and cash.
Features of CircuitVerse: •
•
•
•
•
•
Export High-Resolution Images – CircuitVerse can export high-resolution images in
multiple formats including SVG.
Combinational Analysis - Automatically generate circuit based on truth table data. This is
great to create complex logic circuits and can be easily be made into a sub circuit.
Embed in Blogs - Since CircuitVerse is built in HTML5, an iFrame can be generated for
each project allowing the user to embed it almost anywhere.
Multi Bit Buses and components - Circuit Verse supports multi bit-wires; this means
circuit design is easier, faster, and uncluttered.
Use Sub Circuit - Create sub circuits once and use them repeatedly. This allows easier and
more structured design.
Anywhere working feature - It can run on almost any device without the need for installing
any software.
Some
components
of
CircuitVerse:
-
Example - Logic Gates: A logic gate is a device that acts as a building block for digital circuits.
Page | 13
21U02023
Figure 16
•
•
•
•
•
•
AND Gate: Here we have two inputs and an AND Gate. We connect two inputs via wire
and gate will produce 1iff both the inputs are 1.
OR Gate: Here we have two inputs and a OR Gate. We connect two inputs via wire and
gate will produce 0 iff both the inputs are 0.
NAND Gate: It works just opposite of AND Gate it will produce 0 iff both the inputs are 1.
NOR Gate: It works just opposite of OR Gate it will produce 1 iff both the inputs are 0.
XOR Gate: It will produce 1 only if both the inputs are different.
NOT Gate: It will give the output which is just the flip of the input.
User Directions in CircuitVerse: Consider the AND gate, if we see the diagram of the gate we observe there are two square box in
the input side of the AND gate and if we click on these, they flip their values and depending upon
this input it will produce the desired output (mentioned in the above points). Square box denotes
the inputs and square box on the right side of the diagram denotes the corresponding output. And
in between these inputs there is a symbol of logic gate AND. These all things are contained within
a very interactive environment and on clicking of the box; it will change the background color to
yellow.
Note: For gates like NOT there is only one input
Page | 14
21U02023
ASSIGNMENT 3
Q - Implement half adder and full adder circuit using basic gates in circuit verse for some
specified input values. Also simulate predefined full adder and half adder in circuit verse
for the same values.
Ans –
Full Adder Implementation using gates
Case I -
Figure 17 : Demonstration of circuit with a = 0, b = 0 and c = 0 and sum = 0 and carry
=0
Case II –
Figure 18 : Demonstration of circuit with a = 0, b = 0 and c = 1 and sum = 1 and carry
=0
Case III –
Page | 15
21U02023
Figure 19 : Demonstration of circuit with a = 0, b = 1 and c = 0 and sum = 1 and carry =
0
Case IV –
Figure 20 : Demonstration of circuit with a = 0, b = 1 and c = 0 and sum = 1 and carry = 0
Case V –
Figure 21 : Demonstration of circuit with a = 1, b = 0 and c = 0 and sum = 1 and carry = 0
Case VI –
Page | 16
21U02023
Figure 22 : Demonstration of circuit with a = 1, b = 0 and c = 1 and sum = 0 and carry = 1
Case VII –
Figure 23 : Demonstration of circuit with a = 1, b = 1 and c = 0 and sum = 0 and carry = 1
Case VIII –
Figure 24 : Demonstration of circuit with a = 1, b = 1 and c =1 and sum = 1 and carry = 1
Half Adder Implementation Using Gates
Page | 17
21U02023
Case I –
Figure 25 : Demonstration of half adder circuit with a = 0, b = 0 and sum = 0 and carry = 0
Case II –
Figure 26 : Demonstration of half adder circuit with a = 0, b = 1 and sum = 1 and carry = 0
Case III –
Figure 27 : Demonstration of half adder circuit with a = 1, b = 0 and sum = 1 and carry = 0
Case IV –
Figure 28 : Demonstration of half adder circuit with a = 1, b = 1 and sum = 0 and carry = 1
Full Adder Implementation predefined circuit
Page | 18
21U02023
Case I -
Figure 29 : Demonstration of circuit with a = 0, b = 0 and c = 0 and sum = 0 and carry = 0
Case II –
Figure 30 : Demonstration of circuit with a = 0, b = 0 and c = 1 and sum = 1 and carry = 0
Case III –
Figure 31 : Demonstration of circuit with a = 0, b = 1 and c = 0 and sum = 1 and carry = 0
Case IV –
Figure 32 : Demonstration of circuit with a = 0, b = 1 and c = 0 and sum = 1 and carry = 0
Page | 19
21U02023
Case V –
Figure 33 : Demonstration of circuit with a = 1, b = 0 and c = 0 and sum = 1 and carry = 0
Case VI –
Figure 34 : Demonstration of circuit with a = 1, b = 0 and c = 1 and sum = 0 and carry = 1
Case VII –
Figure 35 : Demonstration of circuit with a = 1, b = 1 and c = 0 and sum = 0 and carry = 1
Case VIII –
Figure 36 : Demonstration of circuit with a = 1, b = 1 and c =1 and sum = 1 and carry = 1
Page | 20
21U02023
ASSIGNMENT 4
Q - Implement and demonstrate functioning of a 2 X 4 Decoder by using CircuitVerse.
The combinational circuit that change the binary information into 2N output lines is known
as Decoders. The binary information is passed in the form of N input lines. The output lines define
the 2N-bit code for the binary information. In simple words, the Decoder performs the reverse
operation of the Encoder. At a time, only one input line is activated for simplicity. The produced
2N-bit output code is equivalent to the binary information.
2 X 4 DECODER USING BASIC GATES –
Figure 37 : 2 X 4 DECODER USING BASIC GATES
Page | 21
21U02023
2 X 4 DECODER USING PREBUILT COMPONENT -
Figure 38 : DECODER USING PRE-BUILT COMPONENTS IN CIRCUITVERSE
In the above example A and B are input bits where A is the most significant bit and B is least
significant bit. On giving A=0 and B=0, we get output 1 at D0 with rest as 0. Similarly, on giving
A=0 and B=1, we get output 1 at D1 and rest as 0. On giving A=1 and B=0, we get output 1 at
D2 and rest as 0. On giving A=1 and B=1, we get output 1 at D3 and rest as 0.
TRUTH TABLE OF DECODER
Page | 22
21U02023
ASSIGNMENT 5
Q - Implement and demonstrate functioning of a 4 X 1 MUX by using CircuitVerse.
A multiplexer is a combinational circuit that has 2n input lines and a single output line. Simply,
the multiplexer is a multi-input and single-output combinational circuit. The binary information
is received from the input lines and directed to the output line. On the basis of the values of the
selection lines, one of these data inputs will be connected to the output.
Unlike encoder and decoder, there are n selection lines and 2n input lines. So, there is a total of
2N possible combinations of inputs. A multiplexer is also treated as MUX.
Figure 39 – 4 X 1 MUX in CircuitVerse
In the above example we have implemented 4 to 1 MUX, where S0 and S1 are two selection bits.
In 4×1 multiplexer, there are only four inputs, i.e., I0, I1, I2 and I3, 2 selection line, i.e., S0 and
Page | 23
21U02023
S1, single outputs. On the basis of the combination of inputs which are present at the selection line
S0 and S1, one of these 4 inputs will be connected to the output.
On selecting S0=0 and S1=0, I0 will be connected to the output, similarly on selecting S0=0 and
S1=1, I1 will be connected to the output, similarly on selecting S0=1 and S1=0, I2 will be
connected to the output, similarly on selecting S0=0 and S1=1, I3 will be connected to the output.
Truth Table:
Selection Lines
Combination
S1
S0
Page | 24
Output
0
0
I0
0
1
I1
1
0
I2
1
1
I3
21U02023
ASSIGNMENT 6
Q - Implement and demonstrate functioning of single bus connecting 4 registers of 4 bit
each using circuit verse and explain steps to use this circuit.
4-bit register means that size of the register is 4 bit. These 4-bit register uses 4 multiplexers
because no. of bits in register is always equal to no. of multiplexer. This mechanism is also
known as 4×1 multiplexer. 4×1 Multiplexer means that there are four inputs to each multiplexer
form four registers and one output to the common bus.
The construction of this bus system using 4 registers is shown below. It consists of 4x1 MUX
with 4 inputs and 1 output. There are 2 selection inputs S0 and S1 which are connected to the
select inputs of MUX. The bits of Register A are (A3, A2, A1, A0). Register B is (B3, B2, B1,
and B0). Register C is (C3, C2, C1, and C0). And Register D is (D3, D2, D1, and D0).
And the first Multiplexer is (D0, C0, B0, and A0). The second Multiplexer is (D1, C1, B1, and
A1). The third Multiplexer is (D3, C3, B3, and A3). The fourth Multiplexer is (D4, C4, B4, and
A4).
Figure 40 : Single Bus System in Circuit Verse
Page | 25
21U02023
Selection table:
Selection Lines
Combination
S1
S0
0
0
Page | 26
Register Selected
A
0
1
B
1
0
C
1
1
D
21U02023
ASSIGNMENT 7
Q - Implement and demonstrate 8 bit arithmetic circuit using circuit verse.
Arithmetic circuits can perform seven different arithmetic operations using a single
composite circuit. It uses a full adder (FA) to perform these operations. A multiplexer (MUX)
is used to provide different inputs to the circuit in order to obtain different arithmetic
operations as outputs. The different operations for the inputs A and B are:
1.
2.
3.
4.
5.
6.
7.
A + B (adder)
A+B+1
A + B’
A – B (subtracter)
A
A + 1 (incrementer)
A – 1 (decrementer)
Truth Table:
S1
0
0
0
0
1
1
1
1
Select
S0
0
0
1
1
0
0
1
1
Input
Cin
0
1
0
1
0
1
0
1
A
11111111
11111111
11110100
11111111
01111111
01111111
01111111
01111111
B
11111111
11111111
11110001
11111111
10000010
10000010
10000010
10000010
Output
Cout
11111110
11111111
00000010
00000000
01111111
10000000
01111110
01111111
1
1
1
1
0
0
1
1
Microoperations
Add
Add with carry
Subtract with borrow
Subtract
Transfer A
Increment A
Decrement A
Transfer A
The basic component of an arithmetic circuit is the parallel adder. By controlling the data inputs
to the adder, it is possible to obtain different types of arithmetic operation. It has eight full adder
circuits and eight 4x1 multiplexers for choosing different operations. There are two 8 bits inputs
A and B and a 8 bit output B. The 8-bit inputs for A go directly to the inputs of the binary adder.
Each of the eight inputs from B is connected to the data inputs of the multiplexer. The multiplexer
data inputs also receive the complement of B. The other two data inputs are connected to Logic 0 and logic-1. The eight 4x1 multiplexers are controlled by two selection inputs S1 and S0. The
input carry Cin goes to the carry inputs of the full adder in the least significant position. The other
carries a connected from one stage to the next. The output of the binary adder is calculated from
the following arithmetic sum: D=A + Y + Cin . Where A is the 8-bit number at the X inputs and Y
is the 8-bit binary number at the Y inputs of the binary adder. Cin is the input carry, which can be
equal to 0 or 1. Note that the symbol + in the equation above denotes and arithmetic plus. By
Page | 27
21U02023
controlling the value of Y with two selection inputs S1 and S0 and making Cin equal to 0 or 1, it
is possible to generate the eight arithmetic microoperations.
Figure 41 : 8 bit arithmetic circuit using Circuit Verse.
Page | 28
21U02023
ASSIGNMENT 8
Q - Implement and demonstrate 8 bit logic circuit using circuit verse
Figure 42 – 8 bit logic circuit using Circuit Verse
An 8-bit logic circuit is a digital circuit that processes 8 bits of binary data using various logic
gates. The logic gates commonly used in an 8-bit circuit are AND, OR, XOR, and NOT gates, each
with a specific logic function. In addition, a 4X1 multiplexer is commonly used to select one of 4
input lines and route it to the output line based on a 2-bit control input.
These gates and multiplexer can be combined to perform various operations on the 8-bit binary
data. For example, to perform an 8-bit addition operation, an 8-bit adder circuit can be built using
a combination of XOR, AND, OR, and NOT gates, along with a 4X1 multiplexer to select the
carry bit output from the previous bit position. The result can be displayed using a set of 8 output
lines.
To perform an 8-bit multiplication operation, the circuit can use a combination of AND gates,
multiplexers, and shift registers. The multiplication process involves shifting one of the numbers
by one bit position and then performing an AND operation with the other number. The result is
then added to the previous multiplication result using a series of multiplexers and shift registers.
Page | 29
21U02023
ASSIGNMENT 9
Q – Implement and Demonstrate functioning of 8 bit combinational circular shifter using
circuitVerse.
Figure 43 : 8 bit circular shifter using Circuit Verse
An 8-bit circular shifter is a digital circuit that takes an 8-bit binary input and shifts the bits by a
fixed number of positions in a circular fashion, with the shifted bits wrapping around from the end
to the beginning of the input. The number of positions to shift can be determined by a control input
to the circuit.
The circular shifter can be implemented using a combination of multiplexers and shift registers.
The input bits are fed into the shift registers, and the control input is used to select the appropriate
bit position to output to the output line. The shifted bits are then output in a circular fashion, with
the last bit being wrapped around to the first position.
For example, if the input is 01101011 and the control input is set to shift left by 3 positions, the
output would be 01011011. The first 3 bits are shifted to the end and wrapped around, while the
last 5 bits are shifted to the left.
Circular shifters are commonly used in digital signal processing applications, such as filtering and
signal modulation. They can also be used in cryptography and data compression algorithms.
Page | 30
Download