COA Lab Manual
COA Lab Manual
COA Lab Manual
LABORATORY MANUAL
EXPERIMENT-1
1.Input Unit
2.Output Unit
3.Storage Unit
4.Central Processing Unit (CPU)
5.Arithmetic and Logic Unit (ALU)
6.Control Unit
Input Unit
Data and instructions must enter the computer system before any computation can be performed on the
supplied data. The input unit that links the external environment with the computer system performs this
task. Data and instructions enter input units in forms that depend upon the particular device used. For
example, data is entered from a keyboard in a manner similar to typing, and this differs from the way in
which data is entered through a mouse, which is another type of input device. However, regardless of the
form in which they receive their inputs, all input devices must provide a computer with data that are
transformed into the binary codes that the primary memory of the computer is designed to accept. This
transformation is accomplished by units that called input interfaces. Input interfaces are designed to
match the unique physical or electrical characteristics of input devices to the requirements of the
computer system.
1. It accepts (or reads) the list of instructions and data from the outside world.
2. It converts these instructions and data in computer acceptable format.
3. It supplies the converted instructions and data to the computer system for further processing.
Output Unit
The job of an output unit is just the reverse of that of an input unit. It supplied information and results of
computation to the outside world. Thus it links the computer with the external environment. As computers
work with binary code, the results produced are also in the binary form. Hence, before supplying the
results to the outside world, it must be converted to human acceptable (readable) form. This task is
accomplished by units called output interfaces.
1. It accepts the results produced by the computer which are in coded form and hence cannot be easily
understood by us.
2. It converts these coded results to human acceptable (readable) form.
3. It supplied the converted results to the outside world.
Storage Unit
The data and instructions that are entered into the computer system through input units have to be stored
inside the computer before the actual processing starts. Similarly, the results produced by the computer
after processing must also be kept somewhere inside the computer system before being passed on to the
output units. Moreover, the intermediate results produced by the computer must also be preserved for
ongoing processing. The Storage Unit or the primary / main storage of a computer system is designed
to do all these things. It provides space for storing data and instructions, space for intermediate results and
also space for the final results.
The specific functions of the storage unit are to store:
1. All the data to be processed and the instruction required for processing (received from input devices).
2. Intermediate results of processing.
3. Final results of processing before these results are released to an output device.
The main unit inside the computer is the CPU. This unit is responsible for all events inside the computer.
It controls all internal and external devices, performs “Arithmetic and Logical operations”. The
operations a Microprocessor performs are called “instruction set” of this processor. The instruction set is
“hard wired” in the CPU and determines the machine language for the CPU.
The more complicated the instruction set is, the slower the CPU works. Processors differed from one
another by the instruction set. If the same program can run on two different computer brands they are said
to be compatible. Programs written for IBM compatible computers will not run on Apple computers
because these two architectures are not compatible.
The control Unit and the Arithmetic and Logic unit of a computer system are jointly known as the Central
Processing Unit (CPU). The CPU is the brain of any computer system. In a human body, all major
decisions are taken by the brain and the other parts of the body function as directed by the brain.
Similarly, in a computer system, all major calculations and comparisons are made inside the CPU and the
CPU is also responsible for activating and controlling the operations of other units of a computer system.
The arithmetic and logic unit (ALU) of a computer system is the place where the actual execution of the
instructions take place during the processing operations. All calculations are performed and all
comparisons (decisions) are made in the ALU. The data and instructions, stored in the primary storage
prior to processing are transferred as and when needed to the ALU where processing takes place. No
processing is done in the primary storage unit. Intermediate results generated in the ALU are temporarily
transferred back to the primary storage until needed at a later time. Data may thus move from primary
storage to ALU and back again as storage many times before the processing is over. After the completion
of processing, the final results which are stored in the storage unit are released to an output device.
The arithmetic and logic unit (ALU) is the part where actual computations take place. It consists of
circuits that perform arithmetic operations (e.g. addition, subtraction, multiplication, division over data
received from memory and capable to compare numbers (less than, equal to, or greater than).
All activities in the computer system are composed of thousands of individual steps. These steps should
follow in some order in fixed intervals of time. These intervals are generated by the Clock Unit. Every
operation within the CPU takes place at the clock pulse.. The clock rate is measured in megahertz (Mhz)
or Gigahertz (Ghz). Larger systems are even faster.
Control Unit
By selecting, interpreting, and seeing to the execution of the program instructions, the control unit is able
to maintain order and directs the operation of the entire system. Although, it does not perform any actual
processing on the data, the control unit acts as a central nervous system for the other components of the
computer. It manages and coordinates the entire computer system. It obtains instructions from the
program stored in main memory, interprets the instructions, and issues signals that cause other units of the
system to execute them.
The control unit directs and controls the activities of the internal and external devices. It interprets the
instructions fetched into the computer, determines what data, if any, are needed, where it is stored, where
to store the results of the operation, and sends the control signals to the devices involved in the execution
of the instructions.
EXPERIMENT-2
Procedure:
Step 1:
1. Take Inventory: Before start, take inventory of parts. Make sure we have the following
components and tools.
o Motherboard
o CPU
o Heat Sink and CPU Fan
o SMPS
o Hard disk drive
o CD/ DVD drive
o RAM
o CMOS Battery
o Case/ Tower/Cabinet
o A good screwdriver sets
2. Make Space, Make Time: Building a PC take space – about a dining room table worth. So, make sure
you have plenty of working room and a few hours to proceed with minimal interruption.
3. Have the Drivers Ready: Motherboard comes bundled with a CD containing all the drivers. Make sure
that CD is available before start assembling. In case the CD is missing and assuming we have another
PC with internet connection, download the latest drivers from the vendors’ websites for each
component installing.
1. Great care should be taken when installing the motherboard. First, take the board out of its packaging
and put it on top of the antistatic bag it came in. Before you secure the motherboard onto the PC
case/chassis, inspect it carefully for any visible defects.
2. Next, review the motherboard manual, to make sure we should familiar with the motherboard layout
and understand which socket is which. Manuals are extremely helpful, usually easy to read, and
include illustrations instructions.
1. Some PC cases have a removable motherboard tray. If yours does, remove the screws holding it in
place and pull it out of the case.
2. Note the pattern of the holes in your motherboard, and screw brass standoffs into the motherboard tray
or into the PC case in the correct locations (ALWAYS check the manual and follow their instructions
to the letter).
3. Check the layout of the sockets on the motherboard, and confirm that the ports on the motherboard’s
back panel match the holes on the case’s Input/output (I/O) shield that is installed in your case. If
necessary, remove the old I/O shield by tapping it firmly a few times with the butt-end of a
screwdriver, and then replace it with the shield that came with the new motherboard.
4. Carefully position the motherboard on top of the brass standoffs, line up all the holes, and use the
screws that accompanied the case to fasten down the motherboard
1. In order to install the memory modules, insert them into the proper sockets and push down firmly but
evenly until the clips on both sides of the socket pop into place. If the motherboard supports dual-
channel memory, consult the user manual to determine which pairs of RAM sockets should use.
1. First, plug the large ATX power connector from power supply into the matching port on the
motherboard.
2. Locate the smaller, square processor power connector and attach it to the motherboard.
3. Attach each of the tiny leads from the power and reset switches, the hard-disk activity lights, the PC
speaker, and any front-panel USB and FireWire ports to the corresponding pin on the motherboard.
1. Connect a keyboard, mouse, monitor, and power cable to the computer and turn it on.
2. If the internal fans begin to whir, the system beeps, and see the machine starting to boot, power down
by holding the power button for 5 seconds and continue building.
3. If nothing happens, back up a step and recheck all the connections. Make sure that both the processor
and the memory are properly seated, and recheck those minuscule leads connecting the motherboard to
the power and reset switches.
4. If it performs as expected, shut down the PC, unplug it, and open the case.
1. Use the included screws to attach the drives to the rails or cage, and slide them into the case. For
externally accessible drives such as a DVD recorder, save time by installing one drive rail and sliding
the drive in for a test fitting to make sure that its front is even with the case.
2. When the drives are installed, connect power and data cables to each one. Parallel ATA drives use
wide, flat data cables that can be installed only in the correct way. SATA drives use a thin, 1cm ¬wide
data cable. SATA drives use a new type of power connector that many power supplies don’t come
with.
EXPERIMENT-3
The working of SMPS is simply understood by knowing that the transistor used in LPS is used to control
the voltage drop while the transistor in SMPS is used as a controlled switch.
Working
The working of SMPS can be understood by the following figure.
Input Stage
The AC input supply signal 50 Hz is given directly to the rectifier and filter circuit combination without
using any transformer. This output will have many variations and the capacitance value of the capacitor
should be higher to handle the input fluctuations. This unregulated dc is given to the central switching
section of SMPS.
Switching Section
A fast switching device such as a Power transistor or a MOSFET is employed in this section, which
switches ON and OFF according to the variations and this output is given to the primary of the
transformer present in this section. The transformer used here are much smaller and lighter ones unlike
the ones used for 60 Hz supply. These are much efficient and hence the power conversion ratio is higher.
Output Stage
The output signal from the switching section is again rectified and filtered, to get the required DC
voltage. This is a regulated output voltage which is then given to the control circuit, which is a feedback
circuit. The final output is obtained after considering the feedback signal.
Control Unit
This unit is the feedback circuit which has many sections.
The above figure explains the inner parts of a control unit. The output sensor senses the signal and joins
it to the control unit. The signal is isolated from the other section so that any sudden spikes should not
affect the circuitry. A reference voltage is given as one input along with the signal to the error amplifier
which is a comparator that compares the signal with the required signal level.
By controlling the chopping frequency the final voltage level is maintained. This is controlled by
comparing the inputs given to the error amplifier, whose output helps to decide whether to increase or
decrease the chopping frequency. The PWM oscillator produces a standard PWM wave fixed frequency.
.
The SMPS is mostly used where switching of voltages is not at all a problem and where efficiency of the
system really matters. SMPS circuit is operated by switching and hence the voltages vary continuously.
The output voltage is controlled by the switching time of the feedback circuitry.
The efficiency of SMPS is high because, instead of dissipating excess power as heat, it
continuously switches its input to control the output.
Disadvantages
Types of SMPS
SMPS is the Switched Mode Power Supply circuit which is designed for obtaining the regulated DC
output voltage from an unregulated DC or AC voltage. There are four main types of SMPS such as
DC to DC Converter
AC to DC Converter
Fly back Converter
Forward Converter
EXPERIMENT-4
Aim: Study of different troubleshooting of a dot matrix printer using LX 1050+ printer trainer module
Most problems associated with the printer can be traced to improper setup, installation, or cabling.
The following table will assist you in identifying and correcting some of the more common problems.
Ink smears
Possible cause: Head gap lever is not in the proper position
Solution: Move the lever toward the (+) position until ink does not smear
Printout is faint
Head gap lever is not in the proper position
Adjust the lever the proper position
Out of paper
Install new paper
Cut Sheet Feeder option (KX-P38) is installed but does not work
CSF MODE is OFF
Set CSF MODE to ON
Set paper feed selector to " " and rotate platen knob to easily remove jammed paper.
Reinstall paper correctly into tractor
EXPERIMENT-5
AIM: Write a C/C++ program for IEEE 754 floating point representation and perform addition and
subtraction.
//
#include <stdio.h>
typedef union {
float f;
struct
{
// Order is important.
// Here the members of the union data structure
// use the same memory (32 bits).
// The ordering is taken
// from the LSB to the MSB.
unsigned int mantissa : 23;
unsigned int exponent : 8;
unsigned int sign : 1;
} raw;
} myfloat;
// Driver Code
int main()
{
return 0;
}
Output:
int msb_length(long l) {
int cnt = 0;
while (l >= 1) {
l >>= 1;
cnt++;
}
return cnt;
}
long* get(long x) {
long* arr;
arr = new long[3];
arr[SIGN] = (x & 0x80000000) >> 31;
arr[EXP] = (x & 0x7F800000) >> 23;
arr[FRAC] = (x & 0x7FFFFF);
return arr;
}
int main() {
ifstream inputStream;
inputStream.open("src/input.txt");
int r = 0, w = 0;
long i = 0;
while (!inputStream.eof()) {
long a;
long b;
long c;
inputStream >> dec >> i;
inputStream >> hex >> a;
inputStream >> hex >> b;
inputStream >> hex >> c;
if (c == add(a, b)) {
r++;
cout << "Test " << i << " PASSED" << endl;
} else {
w++;
cout << "Test " << i << " FAILED" << endl;
}
}
inputStream.close();
cout << "Total " << r << " " << "PASSED " << w << " FAILED." << endl;
}
EXPERIMENT-6
AIM: Write a C/C++ program to perform signed bit multiplication using Booth's algorithm
Program Code:
disp_binary(acq);
printf("%d",q_1);
}
printf("\nProduct = ");
disp_binary(acq);
getch();
}
Output :
0000000000000011 0
0000001110000001 1
0000000111000000 1
1111110101100000 1
1111111010110000 0
1111111101011000 0
1111111110101100 0
1111111111010110 0
1111111111101011 0
Product = 1111111111101011
EXPERIMENT-7
THEORY:
To understand what is a half adder you need to know what is an adder first. Adder circuit is a
combinational digital circuit that is used for adding two numbers. A typical adder circuit produces a
sum bit (denoted by S) and a carry bit (denoted by C) as the output. Typically adders are realized for
adding binary numbers but they can be also realized for adding other formats like BCD (binary coded
decimal, XS-3 etc. Besides addition, adder circuits can be used for a lot of other applications in digital
electronics like address decoding, table index calculation etc. Adder circuits are of two types:
1. Half adder
2. Full adder.
Half adder circuit:
Half adder is a combinational arithmetic circuit that adds two numbers and produces a sum bit
(S) and carry bit (C) as the output. If A and B are the input bits, then sum bit (S) is the X-OR of A and B
and the carry bit (C) will be the AND of A and B. From this it is clear that a half adder circuit can be
easily constructed using one X-OR gate and one AND gate. Half adder is the simplest of all adder
circuit, but it has a major disadvantage. The half adder can add only two input bits (A and B) and has
nothing to do with the carry if there is any in the input. So if the input to a half adder have a carry, then it
will be neglected it and adds only the A and B bits. That means the binary addition process is not
complete and that’s why it is called a half adder.
NAND gates or NOR gates can be used for realizing the half adder in universal logic and the relevant
circuit diagrams are shown in the figure below.
Here is the truth table description of a half adder. We denote the sum A + B.
A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
We need equations for each of the Sum and Carry. Because we have used a truth table to
specify these functions, we consider Boolean expressions.
The carry is the logical AND of the two inputs: Carry = A·B.
Adder(7483). THEORY:
Introduction:
This type of adder is a little more difficult to implement than a half-adder. The main difference between
a half-adder and a full-adder is that the full-adder has three inputs and two outputs. The first two inputs are
A and B and the third input is an input carry designated as CIN. When a full adder logic is designed we
will be able to string eight of them together to create a byte-wide adder and cascade the carry bit from one
adder to the next.
The output carry is designated as COUT and the normal output is designated as S. Take a look at the truth-
table.
Full-adder logic diagram with truth-table
From the above truth-table, the full adder logic can be implemented. The output S is an EXOR between
the input A and the half-adder SUM output with B and CIN inputs. The COUT will only be true if any of
the two inputs out of the three are HIGH.
Thus, implementation a full adder circuit with the help of two half adder circuits. The first will half
adder will be used to add A and B to produce a partial Sum. The second half adder logic can be used to
add CIN to the Sum produced by the first half adder to get the final S output. If any of the half adder logic
produces a carry, there will be an output carry. Thus, COUT will be an OR function of the half-adder
Carry outputs.
EXPERIMENT-9
Aim: Design of digital circuits (MUX,DEMUX &ALU) in VHDL using Active VHDl.
A multiplexer allows digital signals from several sources to be routed onto a single bus or line. A 'select'
input to the multiplexer allows the source of the signal to be chosen. The first multiplexes two 4-bit input
buses to a single 4-bit output bus, the second example multiplexes four single input lines to a single
output line.
VHDL Code
The VHDL code for implementing the 4-bit 2 to 1 multiplexer
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity mux_2to1_top is
Port ( SEL : in STD_LOGIC;
A : in STD_LOGIC_VECTOR (3 downto 0);
B : in STD_LOGIC_VECTOR (3 downto 0);
X : out STD_LOGIC_VECTOR (3 downto 0));
end mux_2to1_top;
Library ieee;
use ieee.std_logic_1164.all;
entity demux is
end demux;
begin
end data;
Library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use ieee.NUMERIC_STD.all;
-----------------------------------------------
---------- ALU 8-bit VHDL ---------------------
-----------------------------------------------
entity ALU is
generic (
constant N: natural := 1 -- number of shited or rotated bits
);
Port (
A, B : in STD_LOGIC_VECTOR(7 downto 0); -- 2 inputs 8-bit
ALU_Sel : in STD_LOGIC_VECTOR(3 downto 0); -- 1 input 4-bit for selecting function
ALU_Out : out STD_LOGIC_VECTOR(7 downto 0); -- 1 output 8-bit
Carryout : out std_logic -- Carryout flag
);
end ALU;
architecture Behavioral of ALU is
begin
process(A,B,ALU_Sel)
begin
case(ALU_Sel) is
when "0000" => -- Addition
ALU_Result <= A + B ;
when "0001" => -- Subtraction
ALU_Result <= A - B ;
when "0010" => -- Multiplication
ALU_Result <= std_logic_vector(to_unsigned((to_integer(unsigned(A)) * to_integer(unsigned(B))),8))
;
when "0011" => -- Division
ALU_Result <= std_logic_vector(to_unsigned(to_integer(unsigned(A)) / to_integer(unsigned(B)),8)) ;
when "0100" => -- Logical shift left
ALU_Result <= std_logic_vector(unsigned(A) sll N);
when "0101" => -- Logical shift right
ALU_Result <= std_logic_vector(unsigned(A) srl N);
when "0110" => -- Rotate left
ALU_Result <= std_logic_vector(unsigned(A) rol N);
when "0111" => -- Rotate right
ALU_Result <= std_logic_vector(unsigned(A) ror N);
when "1000" => -- Logical and
ALU_Result <= A and B;
when "1001" => -- Logical or
ALU_Result <= A or B;
when "1010" => -- Logical xor
ALU_Result <= A xor B;
when "1011" => -- Logical nor
ALU_Result <= A nor B;
when "1100" => -- Logical nand
ALU_Result <= A nand B;
when "1101" => -- Logical xnor
ALU_Result <= A xnor B;
when "1110" => -- Greater comparison
if(A>B) then
ALU_Result <= x"01" ;
else
ALU_Result <= x"00" ;
end if;
when "1111" => -- Equal comparison
if(A=B) then
ALU_Result <= x"01" ;
else
ALU_Result <= x"00" ;
end if;
when others => ALU_Result <= A + B ;
end case;
end process;
ALU_Out <= ALU_Result; -- ALU out
tmp <= ('0' & A) + ('0' & B);
Carryout <= tmp(8); -- Carryout flag
end Behavioral;
EXPERIMENT-10
8086 Assembly programming means develop programs in 8086 assembly programming language. 8086
Assembly is a low level programming language. The developer have to deal with object of the
processor like segment and register..
A program written in assembly language must be converted to machine language before the CPU
can execute it
A program called an assembler translates each assembly language statement into a single
machine language instruction
JUMP operation is an operation that stop the linear execution of the code and indicate the next instruction
to execute. It is more complex because it can be unconditional or conditional on the result of some
previous operations or on flag value.
Operands
Operands are the parameters of the operation in the instruction. They can be use in 3 way:
Immediate
This means a direct access of a variable that have been declared in the program.
Register
Here we use the content of a register to be a parameter.
Memory
Here we access to the content of a specific part of the memory using a pointer.
Special instructions
DECLARATION
In 8086, we need to declare the name of the variable, the size of the variable and it value.
Structure:
INTERRUPT
Interrupt calls a sub routine of the system to be executed. we will see 2 simple interrupt:
MOV AH,01h
INT 21h
MOV AH,02h
INT 21h
Assembly Language Program