B.Tech CSE Semester I Assignment
B.Tech CSE Semester I Assignment
Semester:I
Subject: CPLT (DCO 013A)
Assignment #1
The Control Unit is the part of the computer’s central processing unit (CPU), which
directs the operation of the processor. It was included as part of the Von Neumann
Architecture by John von Neumann. It is the responsibility of the control unit to tell
the computer’s memory, arithmetic/logic unit, and input and output devices how to
respond to the instructions that have been sent to the processor. It fetches internal
instructions of the programs from the main memory to the processor instruction
register, and based on this register contents, the control unit generates a control
signal that supervises the execution of these instructions. A control unit works by
receiving input information which it converts into control signals, which are then
sent to the central processor. The computer’s processor then tells the attached
hardware what operations to perform. The functions that a control unit performs are
dependent on the type of CPU because the architecture of the CPU varies from
manufacturer to manufacturer.
Examples of devices that require a CU are:
• Control Processing Units(CPUs)
• Graphics Processing Units(GPUs)
(b) (701)₈=(?)₂
(c) (1024.50)₁₀=(?)₂
3. (a)Explain BCD code with example? (3)
(b) Explain primary and secondary memory with suitable examples? (4)
Computer Memory– Memory is storage part in computer. It is store the data, information, programs during processing
in computer. It stores data either temporarily or permanent basis. Memory used to important role in saving and retrieving
data.
1. Primary Memory / Volatile Memory– Primary memory is internal memory of the computer. It is also known as
main memory and Temporary memory .Primary Memory holds the data and instruction on which computer is currently
working. Primary Memory is nature volatile. It means when power is switched off it lost all data.
Types of Primary Memory– Primary memory is generally of two types.
1. RAM
2. ROM
1. RAM (Random Access Memory) – It stands for Random Access Memory.RAM is known as read /writes memory. It
generally refereed as main memory of the computer system. It is a temporary memory. The information stored in this
memory is lost as the power supply to the computer is switched off. That’s why RAM is also called “Volatile Memory”
Types of RAM– RAM is also of two types:
a) Static RAM- Static RAM also known as SRAM ,retain stored information as long as the power supply is ON. SRAM
are of higher coast and consume more power .They have higher speed than Dynamic RAM
b)Dynamic RAM– Dynamic RAM also known as DRAM, its stored information in a very short time (a few
milliseconds) even though the power supply is ON. The Dynamic RAM are cheaper and moderate speed and also they
consume less power.
2. ROM (Read Only Memory) – It stands for Read Only Memory.ROM is a Permanent Type memory. Its content are
not lost when power supply is switched off. Content of ROM is decided by the computer manufacturer and permanently
stored at the time of manufacturing. ROM cannot be overwritten by the computer. It is also called “Non-Volatile
Memory”.
1. PROM(Programmable Read Only Memory)-PROM chip is programmable ROM.it is PROM chips to write data
once and read many.once chip has been programmed ,the recorded information cannot be changed. PROM is also
nonvolatile memory.
2. EPROM (Erasable Programmable Read Only Memory)- EPROM chip can be programmed time and again by
erasing the information stored earlier in it. Information stored in EPROM exposing the chip for some time
ultraviolet light .
3. EEPROM (Electrically Erasable Programmable Read Only Memory)-The EEPROM is programmed and
erased by special electrical waves in millisecond. A single byte of a data or the entire contents of device can be
erased.
2. Secondary Memory / Non Volatile Memory– Secondary Memory is external memory of the computer. It is also
known as Auxiliary memory and permanent memory. It is used to store the different programs and the information
permanently. Secondary Memory is nature non volatile. It means data is stored permanently even if power is switched
off.
The secondary storage devices are:
1. Floppy Disks
2. Magnetic (Hard) Disk
3. Magnetic Tapes
4. Pen Drive
5. Winchester Disk
6. Optical Disk(CD,DVD)
Procedure
Two's complement is achieved by:
Step 1: +6 in decimal is 0110 in binary; the leftmost significant bit (the first 0) is the sign (just 110 in
binary would be -2 in decimal).
Step 2: flip all bits in 0110, giving 1001.
Step 3: add the place value 1 to the flipped number 1001, giving 1010.
Gray Code
The Gray Code is a non-weighted code and is cyclic as well. It is referred to as cyclic because successive
code words in this code differ by only one bit-position i.e., it is a unit distance code. It is also reflective. In
many practical applications such as analog to digital conversion, unit distance codes are used.
To convert Binary Code into Gray Code, one should have knowledge of truth table of XOR Gate which is
as,
Now, the MSB of the binary number is copied as it is and then we perform XOR operation for consecutive
bits in a pair of two.
The relationship between decimal numbers, binary numbers, and XS-3 numbers can be given as,
0 0000 0011
1 0001 0100
2 0010 0101
3 0011 1100
4 0100 0111
5 0101 1000
6 1010 1001
7 0111 1010
8 1000 1011
9 1001 1100
(b) Convert the following binary code into its equivalent gray code : (2+2+2)
(i) 1111
To convert a binary number to Gray code, you can use the following algorithm:
1. Keep the leftmost (most significant) bit of the Gray code the same as the leftmost bit of the binary number.
2. For each subsequent bit, calculate it as the XOR (exclusive OR) of the corresponding binary bit and the bit to
its left.
• Binary: 1 1 1 1
• Gray: 1 (1⊕1) (1⊕1) (1⊕1)
•
• The leftmost bit remains the same: 1.
• For the second bit, 1 ⊕ 1 = 0.
• For the third bit, 1 ⊕ 1 = 0.
• For the fourth bit, 1 ⊕ 1 = 0.
So, the Gray code for the binary number 1111 is 1100.
(ii) 1010
To convert a binary number to Gray code, you can follow the rules:
1. The leftmost (most significant) bit of the Gray code remains the same as the leftmost bit of the binary number.
2. For each subsequent bit, calculate it as the XOR (exclusive OR) of the corresponding binary bit and the
previous Gray code bit.
So, the Gray code for the binary number 1010 is 1101.
(iii) 11100001010
To convert the binary number 11100001010 to Gray code, you can follow these rules:
1. The leftmost (most significant) bit of the Gray code remains the same as the leftmost bit of the binary number.
2. For each subsequent bit, calculate it as the XOR (exclusive OR) of the corresponding binary bit and the
previous Gray code bit.
Binary: 1 1 1 0 0 0 0 1 0 1 0
Gray: 1 (1⊕1) (1⊕1) (0⊕0) (0⊕0) (0⊕0) (0⊕1) (1⊕0) (0⊕1) (1⊕0) (0⊕1)
Gray Result: 1 0 0 0 0 0 1 1 1 1 1
• The leftmost bit remains the same: 1.
• For the second bit, 1 ⊕ 1 = 0.
• For the third bit, 1 ⊕ 1 = 0.
• For the fourth bit, 0 ⊕ 0 = 0.
• For the fifth bit, 0 ⊕ 0 = 0.
• For the sixth bit, 0 ⊕ 0 = 0.
• For the seventh bit, 0 ⊕ 1 = 1.
• For the eighth bit, 1 ⊕ 0 = 1.
• For the ninth bit, 0 ⊕ 1 = 1.
• For the tenth bit, 1 ⊕ 0 = 1.
• For the eleventh bit, 0 ⊕ 1 = 1.
So, the Gray code for the binary number 11100001010 is 10000011111.
3. (a) Explain fixed point number system and floating point number system with suitable example?
(5)
Fixed and Floating-Point Number: In digital technology, data is stored in memory registers with binary
bits 0’s and 1’s because the computer only understands binary language. When we enter data in the
system, it is converted into binary bits, and it is processed and used in the CPU in different
ways. Memory registers have a format and a specific range to store data. Scientists have designed a real
number representation method in memory registers of 8 bit, 16 bit, 32bit.
There two types of approaches that are developed to store real numbers with the proper method.
Sign bit -The fixed-point numbers in binary uses a sign bit. A positive number has a sign bit 0, while a
negative number has a sign bit 1.
Integral Part – The integral part is of different lengths at different places. It depends on the register's
size, like in an 8-bit register, integral part is 4 bits.
Fractional part – Fractional part is also of different lengths at different places. It depends on the
register's size, like in an 8-bit register, integral part is of 3 bits.
8 bits = 1Sign bit + 4 bits(integral) + 3bits (fractional part)
16 bits = 1Sign bit + 9 bits(integral) +6 bits (fractional part)
32 bits = 1Sign bit + 15 bits(integral) + 9 bits (fractional part)
How to write the number in Fixed-point notation?
Number is 4.5
Step 1:- Convert the number into binary form.
4.5 = 100.1
Step 2:- Represent binary number in Fixed point notation
Scientific notation – Method of representing binary numbers into a x be form. Scientific notation is
further converted into floating-point notation because floating-point notation only accepts scientific
notation. For example:-
Number = 376.423 ( its not scientific notation)
Number in scientific = 36.4423 x 101 or 3.64423 x 102
• Zero (0) cannot be represented or normalized because the representation set starts from 0.1, so
how can we normalize zero. It’s not possible.
• If the most significant bit of mantissa is a non zero, then such a representation is
called normalized floating-point.
1. Sign of Mantissa
2. Sign of Exponent
3. Magnitude of Mantissa
4. Magnitude of Exponent
Binary subtraction follows similar rules to decimal subtraction but with just two possible digits (0 and 1). Here
are the basic rules for binary subtraction:
(ii)101010×11=(?)₂
(iii) 10100010÷101=(?)₂