CA Practical
CA Practical
CA Practical
4. Synthesis of Flip-Flop
6. Booth’s Algorithm
8. CPU Design
Experiment :01
Theory:
A] Full adder : Full adder is a digital circuit used to calculate the
sum of three binary bits. Full adders are complex and difficult to
implement when compared to half adders. Two of the three bits are
same as before which are A, the augend bit and B, the addend bit.
The additional third bit is carry bit from the previous stage and is
called 'Carry' – in generally represented by CIN. It calculates the
sum of three bits along with the carry. The output carry is called
Carry – out and is represented by Carry OUT.
The block diagram of a full adder with A, B and CIN as inputs and S,
Carry OUT as outputs is shown below.
D = A ⊕ B ⊕ Bin
Bout = A' Bin + A' B + B Bin
Half Adders can be used to add two one bit binary numbers. It is also
possible to create a logical circuit using multiple full adders to add N-bit
binary numbers. Each full adder inputs a Cin, which is the Cout of the
previous adder. This kind of adder is a Ripple Carry Adder, since each
carry bit "ripples" to the next full adder. The first (and only the first) full
adder may be replaced by a half adder. The block diagram of 4-bit
RippleCarry Adder is shown here below -
sum = A+B
carry = A . B
Procedure:
1. Start the simulator as directed.This simulator supports 5-valued logic.
2. To design the circuit we need 3 full adder, 1 half adder, 8 Bit switch(to
give input), 3 Digital display(2 for seeing input and 1 for seeing output
sum), 1 Bit display(to see the carry output), wires.
3. The pin configuration of a component is shown whenever the mouse is
hovered on any canned component of the palette or press the 'show
pin config' button. Pin numbering starts from 1 and from the bottom
left corner(indicating with the circle) and increases anticlockwise.
4. For half adder input is in pin-5,8 output sum is in pin-4 and carry is
pin-1, For full adder input is in pin-5,6,8 output sum is in pin-4 and
carry is pin-1
5. Click on the half adder component(in the Adder drawer in the pallet)
and then click on the position of the editor window where you want to
add the component(no drag and drop, simple click will serve the
purpose), likewise add 3 full adders(from the Adder drawer in the
pallet), 8 Bit switches, 3 digital display and 1 bit Displays(from Display
and Input drawer of the pallet,if it is not seen scroll down in the
drawer)
6. To connect any two components select the Connection menu of
Palette, and then click on the Source terminal and click on the target
terminal. According to the circuit diagram, connect all the
components, connect 4 bit switches to the 4 terminals of a digital
display and another set of 4 bit switches to the 4 terminals of another
digital display. connect the pin-1 of the full adder which will give the
final carry output. connect the sum(pin-4) of all the adders to the
terminals of the third digital display(according to the circuit diagram
shown in screenshot). After the connection is over click the selection
tool in the pallete.
7. To see the circuit working, click on the Selection tool in the pallet then
give input by double clicking on the bit switch, (let it be 0011(3) and
0111(7)) you will see the output on the output(10) digital display as
sum and 0 as carry in bit display.
Observation:
Procedure:
1. Start the simulator as directed.This simulator supports 5-valued logic.
2. To design the circuit we need 7 half adders, 3 OR gates, 1 V+(to give 1
as input), 3 Digital displays(2 for seeing input and 1 for seeing output
sum), 1 Bit display(to see the carry output), and wires.
3. The pin configuration of a component is shown whenever the mouse is
hovered on any canned component of the palette or press the 'show
pin config' button. Pin numbering starts from 1 and from the bottom
left corner(indicating with the circle) and increases anticlockwise.
4. For half adder input is in pin-5,8 output sum is in pin-4 and carry is
pin-1
5. Click on the half adder component(in the Adder drawer in the pallet)
and then click on the position of the editor window where you want to
add the component(no drag and drop, simple click will serve the
purpose), likewise add 6 more full adders(from the Adder drawer in
the pallet), 3 OR gates(from Logic Gates drawer in the pallete), 1 V+, 3
digital display and 1 bit Displays(from Display and Input drawer of the
pallet,if it is not seen scroll down in the drawer)
6. To connect any two components select the Connection menu of
Palette, and then click on the Source terminal and click on the target
terminal. According to the circuit diagram connect all the components,
connect V+ to the upper input terminals of 2 digital displays according
to your input. connect the OR gates according to the diagram shown
in the screenshot connect the pin-1 of the half adder which will give
the final carry output. connect the sum(pin-4) of those adders to the
terminals of the third digital display which will give output sum. After
the connection is over click the selection tool in the pallete.
7. See the output, in the screenshot diagram we have given the value
0011(3) and 0111(7) so get 10 as sum and 0 as carry.you can also use
many bit switches instead of V+ to give input and by double clicking
those bit switches can give different values and check the result.
Observation:
3.
Master slave JK flip-flop overcome this race around condition. The following
figure depicts the circuit diagram.
However, the master slave circuit, though handles race around condition, it
may work improperly initially, if it has inconsistent initialization. Ideally,
initially the master and the slave should have the same value, but if it does
not, then it leads to inconsistent initialization, for which the circuit behaves
improperly. Bellow is a case showing the improper output for an inconsistent
initialization. Here, at clock=1, the master is supposed to change its state
acordingly, but.......
The problem occured due to the inconsistent initialization in the master slave
JK flip-flop can be avoided by asynchronously presetting or clearing the flip-
flop. The circuit diagram is shown bellow.
D flip-flop The D flip-flop is used to transfer data to the flip-flop. It is
basically the JK flip-flop where the the K input is inverted. The circuit diagram
of the D flip-flop is shown below,
There are various different kind of Flip-Flops. Some of the common flip-flops
are: R-S Flip-Flop, D Flip-Flop, J-K Flip-Flop, T Flip-Flop. The block diagram of
different flip-flops are shown here -
Procedure :
1. Start the simulator as directed.This simulator supports 5-valued logic.
2. To design a 4 bit shift register (right shift), we need 4 MSD flipflop, 1
free running clock, 1 Bit switch (which will act as input to the left most
flipflop), 4 Bit display(to see the output of individual flipflops so that
the shifting can be seen with the clock input), wires.
3. The MSD flip flop component is in the sequential circuit drawer in the
pallet. The pin configuration is shown whenever the mouse is hovered
on any canned component of the palette or press the 'show pinconfig'
button. Pin numbering starts from 1 and from the bottom left
corner(indicating with the circle) and increases anticlockwise.
4. For MSD flip flop input is in pin-5, output(Q) is in pin-4, clock is in
pin-8
5. click on the MSD flip flop component in the pallet and then click on
the position of the editor window where you want to add the
component(no drag and drop, simple click will serve the purpose),
likewise add 4 MSD flipflops, 1 free running clock, 1 Bit switche and 4
bit Displays(from Display and Input drawer of the pallet,if it is not
seen scroll down in the drawer)
6. To connect any two components select the Connection menu of
Palette, and then click on the Source terminal and click on the target
terminal. connect all the components, connect the clock to the pin-8
of all the MSD flip flops, connect a bit switch to the pin-5(Q) of the left
most MSD flip flop, connect 4 bit displays to the pin-4 of 4 MSD flip
flops, connect the Q output of the previous flip flop to the D(pin-5)
input of the next flip flop.
7. To see the circuit working, click on the Selection tool in the pallet then
give input by double clicking on the bit switch, to the left most D flip
flop at pi-5(let it be 1), start the clock now check the output and see
how the 1 is shifting from left to right.
Observation:
The multiplicand and multiplier are placed in the m and Q registers respectively.
A 1 bit register is placed logically to the right of the LSB (least significant bit) Q0
of Q register. This is denoted by Q-1. A and Q-1 are initially set to 0. Control logic
checks the two bits Q0 and Q-1. If the two bits are the same (00 or 11) then all
of the bits of A, Q, Q-1 are shifted 1 bit to the right. If they are not the same and
if the combination is 10 then the multiplicand is subtracted from A and if the
combination is 01 then the multiplicand is added with A. In both the cases
results are stored in A, and after the addition or subtraction operation, A, Q, Q-1
are right shifted. The shifting is the arithmetic right shift operation where the
left most bit, namely, An-1 is not only shifted into An-2 but also remains in An-1.
This is to preserve the sign of the number in A and Q. The result of the
multiplication will appear in the A and Q.
Procedure:
1. Start the simulator as directed.This simulator supports 5-valued logic.
3. Instantiating the controller: A control unit can be seen as a finite state machine,
so its behavior can be represented in a state table. The controller of the
simulator accepts the Moore type state chart and must contain an end state.
State names will automatically be generated in the form of S<sub<n< sub="">. In
the left pane of the simulator, click on the ASM chart button in the controller
subsection. Give the required informations in the appeared form as follows:
o Number of states: 7
o Number of inputs: 3
o Number of outputs: 5
The controller will generate 5 output control signals. After entering this information,
the second form will appear where you can set the names of the inputs and outputs.
Here inputs are the Q0, Q-1, count. Outputs control signals are load, add, sub, shift, dc.
The order of given input/outputs are maintained while creating terminals of the
controller. For example, the first output signal will appear in the leftmost output
terminal (lower terminals), second output will appear in the second left most bit and so
on. In case of input terminals, the leftmost bit is for clock input, so the first input
appears in the second terminal, and then the order is maintained. Then the third form
will appear where you actually specify the state chart i.e. state, outputs of that state and
transition conditions . The fields of the chart will be generated dynamically according
to previously given information on states, inputs and outputs.After entering the
following state chart, click on the controller component in the palette of the simulator
then click on the position of the design editor where you want to put the component
(no drag and drop, simple click will serve the purpose).
4. Instantiate the Booth's multiplier datapath from the sequential ckt drawer in the
palette (by clicking as mentioned previously).
o Result: FQ0 to FA3, at end state (here it is S6). These are the content of
A(4bit) and Q(4bit) register, total 8 bit (FQ0 is LSB, FA3 is MSB)
o I/P:
o O/P: FQ-1 is output of Q-1 bit register, similarly FQ0 to FQ3 are for Q
register and FA0 to FA3 are for A register.
7. To connect any two components select the Connection menu of Palette, and then
click on the Source terminal and click on the target terminal. According to the
following diagram connect all the components. Connect the controller outputs
to the specified control input terminals of the datapath, specified datapath
outputs to the inputs of the controller, the clock input, Bit switches with the
inputs and Bit displays component with the outputs (from Display and Input
drawer of the pallet,if it is not seen scroll down in the drawer). After the
connection is over click the selection tool in the pallete.
8. At first initialize the multiplier by giving the specified inputs specified earlier, this
will load the multiplier and multiplicand, then start the multiplication operation
by giving the specified inputs specified earlier. At the end state (S6), the
multiplication result will be seen through ports FQ0 to FA3 (FQ0 is LSB, FA3 is
MSB). The current state of the controller is shown in the left pane as it transits
from one state to another. The controller can be reset by clicking the reset
controller button in the top toolbar, to start with a new input.
Observation:
Procedure:
1. Start the simulator as directed. This simulator supports 5-valued logic.
2. To design the circuit we need 4 1-bit ALU, 11 Bit switch (to give
input,which will toggle its value with a double click), 5 Bit displays (for
seeing output), wires.
3. The pin configuration of a component is shown whenever the mouse is
hovered on any canned component of the palette. Pin numbering
starts from 1 and from the bottom left corner (indicating with the
circle) and increases anticlockwise.
4. For 1-bit ALU input A0 is in pin-9,B0 is in pin-10, C0 is in pin-11 (this
is input carry), for selection of operation, S0 is in pin-12, S1 is in
pin-13, output F is in pin-8 and output carry is pin-7
5. Click on the 1-bit ALU component (in the Other Component drawer in
the pallet) and then click on the position of the editor window where
you want to add the component (no drag and drop, simple click will
serve the purpose), likewise add 3 more 1-bit ALU (from the Other
Component drawer in the pallet), 11 Bit switches and 5 Bit Displays
(from Display and Input drawer of the pallet,if it is not seen scroll
down in the drawer), 3 digital display and 1 bit Displays (from Display
and Input drawer of the pallet, if it is not seen scroll down in the
drawer)
6. To connect any two components select the Connection menu of
Palette, and then click on the Source terminal and click on the target
terminal. According to the circuit diagram, connect all the
components. Connect the Bit switches with the inputs and Bit displays
components with the outputs. After the connection is over click the
selection tool in the pallete.
7. See the output, in the screenshot diagram we have given the value of
S1 S0=11 which will perform add operation and two number input as
A0 A1 A2 A3=0010 and B0 B1 B2 B3=0100 so get output F0 F1 F2
F3=0110 as sum and 0 as carry which is indeed an add operation.you
can also use many other combination of different values and check the
result. The operations are implemented using the truth table for 4 bit
ALU given in the theory.
Observation:
● describing the external behavior of each component i.e the data and the
control signals that or exchanges with other components
We are considering the Von Neumann architecture. Some of the basic features of
this architecture are as follows:
● CPU exchanges data with memory. For this CPU uses two internal resistors.
Following is a block diagram of a basic computer system:
o Memory address register (MAR) which specifies the address for the
next read or write
o Memory buffer register (MBR) which contains the data to be written
into memory or receives the data read from memory
o I/O buffer (I/O BR) register is used for the exchange of data between
an I/O module and the CPU
● An I/O module transfers data from external devices to CPU and memory and
vise versa
Procedure:
1.
2. Start the simulator as directed.This simulator supports 5-valued logic.
3. To perform the experiment on the given modules, we need the CPU,
the working memory with a program and data loaded, a clock input,
Bit switch(to give input,which will toggle its value with a double click),
Bit displays(for seeing output), wires.
4. Load memory: click on the load memory button in the left pane. you
can either load the memory by filling the form or you can directly load
the program form a text file. The memory provides 4-bit address
space and 12 bit data word, thus providing 16 memory addresses
starting from 0000 to 1111. For loading from file, the file should
contain only binary values, it must contain 16 lines, each line
containing the content to be stored in the corresponding memory
address. For example, the content of the first line will be loaded to the
0000 address of the memory, similarly, the second line will
correspond to the 0001 address and so on, finally the content of the
last line will be fed to the 1111 address. The program should use self
loop for halting, for example, the instruction stored at address 1010
will cause self loop execution, if it content of a has -1 in binary format
(in 2's complement), the content of b has 0 and c is 1010, then once
the execution reaches to this 1010 address, it will finally point to
itself.
5. Instantiating the memory: after loading the memory, click on the
memory component from the computer design drawer in the palette of
the simulator then click on the position of the design editor where you
want to put the component(no drag and drop, simple click will serve
the purpose).
6. The pin configuration of the component is shown whenever the mouse
is hovered on any canned component of the palette or pressing
the show pin configuration button on the toolbar will show it
constantly in the left pane. Pin numbering starts from 1 and from the
bottom left corner(indicating with the circle) and increases
anticlockwise.
7. Pin configuration of the memory module:
o Input pins (upper terminals): memory enable : 30, R/W' : 29,
address : 25-28, data : 13-24 (13 is LSB)
o Output pins(lower terminals): data output : 1-12 (1 is MSB)
8. Instantiate the CPU from the computer design drawer in the palette of
the simulator then click on the position of the design editor where you
want to put the component.
9. Pin configuration of the CPU:
o Input pins (upper terminals): data input : 20-31 (20 is MSB)
,clock input : 19
o Output pins(lower terminals): memory enable : 1, R/W' : 2,
address : 3-6( 3 is MSB), data output : 7-18 (7 is MSB)
10. To connect any two components select the Connection menu of
Palette, and then click on the Source terminal and click on the target
terminal. According to the following diagram connect all the
components. Connect the memory outputs to the input terminals of
the CPU, specified datapath outputs to the inputs of the controller, the
clock input, Bit switches with the inputs and Bit displays component
with the outputs (from Display and Input drawer of the pallet,if it is
not seen scroll down in the drawer). After the connection is over click
the selection tool in the pallete.
11. Start clock and observe the behavior of the CPU.See the content of
memory by clicking show memory button in the left pane. Observe
how the program is executing sequentially and modify the data
content as per the program.
Observation: