Professional Documents
Culture Documents
→ These are numericals for converting decimal to binary etc that's why I haven't
added any theory for it
2. Binary codes/ Weighted and non weighted codes with example.
→ In the coding, when numbers, letters or words are represented by a specific group of
symbols, it is said that the number, letter or word is being encoded. The group of symbols
is called as a code. The digital data is represented, stored and transmitted as group of
binary bits. This group is also called as binary code. The binary code is represented by
the number as well as alphanumeric letter.
Weighted Codes
Weighted binary codes are those binary codes which obey the positional weight principle.
Each position of the number represents a specific weight. Several systems of the codes
are used to express the decimal digits 0 through 9. In these codes each decimal digit is
represented by a group of four bits.
Non-Weighted Codes
In this type of binary codes, the positional weights are not assigned. The examples of
non-weighted codes are Excess-3 code and Gray code.
Excess-3 code
The Excess-3 code is also called as XS-3 code. It is non-weighted code used to express
decimal numbers. The Excess-3 code words are derived from the 8421 BCD code words
adding (0011)2 or (3)10 to each code word in 8421. The excess-3 codes are obtained as
follows −
Example
3. Write note on Gray code/excess code
→ It is the non-weighted code and it is not arithmetic codes. That means there are no
specific weights assigned to the bit position. It has a very special feature that, only one bit
will change each time the decimal number is incremented as shown in fig. As only one bit
changes at a time, the gray code is called as a unit distance code. The gray code is a
cyclic code. Gray code cannot be used for arithmetic operation.
NOR Gate
The truth table and symbol of the NOR gate is as shown below.
NOR Gate as NOT Gate
The above diagrams makes it clear that the combination of NAND and NOR Gates can
result into any of the basic gates (AND, OR and NOT Gates). Hence, NAND and NOR
Gates are called as Universal Gates
Commutative law
Any binary operation which satisfies the following expression is referred to as
commutative operation.
Commutative law states that changing the sequence of the variables does not have any
effect on the output of a logic circuit.
Associative law
This law states that the order in which the logic operations are performed is irrelevant as
their effect is the same.
Distributive law
Distributive law states the following condition.
AND law
These laws use the AND operation. Therefore they are called as AND laws.
OR law
These laws use the OR operation. Therefore they are called as OR laws.
INVERSION law
This law uses the NOT operation. The inversion law states that double inversion of a
variable results in the original variable itself.
Registers
Registers are high speed storage areas in the CPU. All data must be stored in a
register before it can be processed.
MAR Memory Address Register Holds the memory location of data that needs
to be accessed
MDR Memory Data Register Holds data that is being transferred to or from
memory
AC Accumulator Where intermediate arithmetic and logic results are stored
PC Program Counter Contains the address of the next instruction to be executed
CIR Current Instruction Register Contains the current instruction during
processing
Buses
Buses are the means by which data is transmitted from one part of a computer to
another, connecting all major internal components to the CPU and memory.
A standard CPU system bus is comprised of a control bus, data bus and address bus.
Address BusCarries the addresses of data (but not the data) between the processor
and memory
Data Bus Carries data between the processor, the memory unit and the
input/output devices
Control Bus Carries control signals/commands from the CPU (and status signals
from other devices) in order to control and coordinate all the activities within the
computer
Memory Unit
The memory unit consists of RAM, sometimes referred to as primary or main
memory. Unlike a hard drive (secondary memory), this memory is fast and also
directly accessible by the CPU.
RAM is split into partitions. Each partition consists of an address and its contents
(both in binary form).
The address will uniquely identify every location in the memory.
Loading data from permanent memory (hard drive), into the faster and directly
accessible temporary memory (RAM), allows the CPU to operate much quicker.
→
9. Explain Booth’s algorithm with example
5. A 1-bit register Q-1 is placed right of the least significant bit Q0 of the register Q.
i. If Q0 and Q-1 are 11 or 00 then the bits of AC, Q and Q-1 are shifted to the right
by 1 bit.
ii. If the value is shown 01 then multiplicand is added to AC. After addition, AC, Q0,
Q- 1
iii. If the value is shown 10 then multiplicand is subtracted from AC. After
subtraction AC,
EXAMPLE
10. Draw flowchart of Booth’s algorithm for two’s complement
multiplication.
11. Explain restoring method of binary division with algorithm.(both
signed and unsigned)
→
12. Explain Non-Restoring division with algorithm
→
13. Explain IEEE-754 floating point representation format for 32 and 64 bit.
→ IEEE Standard 754 floating point is the most common representation today for
real numbers on computers, including Intel-based PC’s, Macs, and most Unix
platforms.
There are several ways to represent floating point number but IEEE 754 is the
most efficient in most cases. IEEE 754 has 3 basic components:
1. The Sign of Mantissa –
This is as simple as the name. 0 represents a positive number while 1
represents a negative number.
2. The Biased exponent –
The exponent field needs to represent both positive and negative
exponents. A bias is added to the actual exponent in order to get the
stored exponent.
3. The Normalised Mantissa –
The mantissa is part of a number in scientific notation or a floating-point
number, consisting of its significant digits. Here we have only 2 digits, i.e.
O and 1. So a normalised mantissa is one with only one 1 to the left of
the decimal.
IEEE 754 numbers are divided into two based on the above three
components: single precision and double precision.
5r
14. Numericals on floating point representation
→
15.Design a full adder using half adders.
→ The full adder can be thought of as two half adders connected together, with the
first half adder passing its carry to the second half adder as shown.
Sum = A ⊕ B ⊕ C
Carry = AB + (A ⊕ B). C
= AB + ( A. B + A. B). C
= AB + A. BC + A. B. C
= B (A + A. C) + A. B. C
= B [(A+ A) (A + C)] + A. B. C
= AB + AC + A. B. C
= AB + C (B + A. B)
= AB + C [(B + A) (B + B)]
= AB + BC + AC
→
Half Adder Full Adder
S.No.
Half Adder is a
Full adder is a combinational logical
combinational logic
circuit that performs an addition
circuit which adds two
1 operation on three one-bit binary
1-bit digits. The half adder
numbers. The full adder produces a sum
produces a sum of the two
of the three inputs and carry value.
inputs.
In Half adder there are In full adder there are three input bits (A,
3
two input bits ( A, B). B, C-in).
Logical Expression for
Logical Expression for Full adder is :
half adder is :
4
S=a⊕b⊕Cin; Cout=(a*b)+(Cin*(a⊕b)).
S=a⊕b ; C=a*b.
It is used in Calculators,
It is used in Multiple bit addition, digital
6 computers, digital
processors etc.
measuring devices etc.
→ A demultiplexer is a device that takes a single input line and routes it to one of
several digital output lines.
• A demultiplexer of 2n outputs has n select lines, which are used to select which
output line to send the input.
• We have 1x2,1x4,….Demultiplexers.
A 1-to-4 demultiplexer has a single input (D), two selection lines (S1 and S0) and
four outputs (Y0 to Y3). The input data goes to any one of the four outputs at a given
time for a particular combination of select lines.
This demultiplexer is also called as a 2-to-4 demultiplexer which means that two
select lines and 4 output lines. The block diagram of 1:4 DEMUX is shown below.
The truth table of this type of demultiplexer is given below. From the truth table it is
clear that, when S1=0 and S0= 0, the data input is connected to output Y0 and when
S1= 0 and s0=1, then the data input is connected to output Y1.
Similarly, other outputs are connected to the input for other two combinations of
select lines.
The truth table of this type of demultiplexer is given below. From the truth table it is
clear that, when S1=0 and S0= 0, the data input is connected to output Y0 and when
S1= 0 and s0=1, then the data input is connected to output Y1.
Similarly, other outputs are connected to the input for other two combinations of
select lines.
From the table, the output logic can be expressed as min terms and are given below.
Where D is the input data, Y0 to Y3 are output lines and S0 & S1 are select lines.
From the above Boolean expressions, a 1-to-4 demultiplexer can be implemented by
using four 3-input AND gates and two NOT gates as shown in figure below. The two
selection lines enable the particular gate at a time.
So depends on the combination of select inputs, input data is passed through the
selected gate to the associated output.
Demultiplexers are also called data distributors, since they transmit the same data
which is received at the input to different destinations.
18. Differentiate between multiplexer and demultiplexer
→
Demultiplexer
Multiplexer
→
ENCODER DECODER
S.No.
7
The encoder circuit is installed at The decoder circuit is installed at the
the transmitting end. receiving side.
OR gate is the basic logic element AND gate along with NOT gate is the
8
used in it. basic logic element used in it.
Gates like NOR, NOT, AND, NAND These are also made up of
4
are building blocks of flip flops. gates.
They are classified into asynchronous There is no such classification
5
or synchronous flip flops. in latches.
8 Flip-flop can be build from Latches Latches can’t build from gates
23. Draw the logic diagram of JK flip flop. Describe its working.( Same type of
question for SR, D and T flip flops can be asked)
→
JK Flip Flop :
• Also when both the J and the K inputs are at logic level ―1
state, or vice-versa.
replaced by two inputs called the J and K inputs. Then this equates to: J = S
and K = R.
• The two 2-input NAND gates of the gated SR bistable have now been
replaced by two3-input NAND gates with the third input of each gate
• This cross coupling of the SR flip-flop allows the previously invalid condition
flop toggles.
Truth table:
→SR CLOCKED Flip-Flop
• This simple flip-flop is basically a one-bit memory bistable device that has two
inputs, one which will ―SET the device (meaning the output = 1), and is labelled S
and one which will ―RESET the device (meaning the output = 0), labelled R.
• The reset input resets the flip-flop back to its original state with an output Q.
• Abasic NAND gate SR flip-flop circuit provides feedback from both of its outputs
back to its opposing inputs and is commonly used in memory circuits to store a
single data bit.
• Then the SR flip-flop actually has inputs, Set, Reset and its current output Q.
→ D Flip Flop
• One of the main disadvantages of the basic SR NAND Gate Bistable circuit is that
the indeterminate input condition is forbidden when both S and R inputs are 1. This
state will force both outputs to be at logic 1
• But in order to prevent this from happening an inverter can be connected between
the―SET‖ and the ―RESET‖ inputs to produce another type of flip flop circuit
known as a Data Latch, Delay flip flop, D-type Bistable, D-type Flip Flop or just
simply a D Flip Flop as it is more generally called the D Flip Flop
• D flip flop is by far the most important of the clocked flip-flops as it ensures that
inputs S and R are never equal to one at the same time.
• The D-type flip flops are constructed from a gated SR flip-flop with an inverter
added between the S and the R inputs to allow for a single D (data) input.
• Then this single data input, labelled ―D‖ and is used in place of the ―Set‖ signal,
and the inverter is used to generate the complementary ―Reset‖ input.
• The D'Flip flop will store and output whatever logic level is applied to its data
terminal so long as the clock input is HIGH. Once the clock input goes LOW the
―set and ―reset inputs of the flip-flop are both held at logic level ―1 so it will not
change state and store whatever data was present on its output before the clock
transition occurred. In other words the output is ―latched at either logic ―0 or logic
―1.
D Qn Qn+1
0 X 0 RESET
1 X 1 SET
→ Toggle Flip Flop / T Flip Flop
Toggle flip flop is basically a JK flip flop with J and K terminals permanently
connected together. It has only input denoted by T .
We can construct a T flip flop by any of the following methods. Connecting the
output
feedback to the input, in SR flip flop. Connecting the XOR of T input and Q
PREVIOUS
output to the Data input, in D flip flop. Hard – wiring the J and K inputs together and
connecting it to T input, in JK flip – flop.
the lower NAND gate is in disable condition. This allows the trigger to
pass the inputs to make the flip – flop in SET state i.e. Qn+1 = 1.
the lower NAND gate is in enable condition. This allows the trigger to
pass the inputs to make the flip – flop in RESET state i.e. Qn+1 =0.
24. Describe register organization within the CPU
→ Registers are the smaller and the fastest accessible memory units in the central
processing unit (CPU).
as a part of itself.
Register Organization is the arrangement of the registers in the processor.
registers
indirect, indexed)
address registers.
Data Registers
an operand address.
Address Registers
• Address registers may themselves be somewhat
instruction to be fetched
Status Register
information
• PSW contains :
interrupts
mode.
– Immediate
– Register
– Direct
– Indirect
– Register Indirect
– Displacement/ Indexed
Immediate Addressing
– 5 is operand
• Adv:
– Fast
• Disadv:
• EA = R
• Adv:
instruction
• Disadv:
operand
• e.g. ADD A
• Adv:
– Single memory reference to access data
address
Indirect Addressing
• Memory location pointed to by address field
operand.
operand
A to accumulator
• Adv:
• Register relative
• Base indexed
contents of register R
Addressing mode.
Addressing mode.
Displacement/Indexed Addressing
• EA = A + (R)
– A = base value
Displacement Addressing
instruction
Example: MOV CL, [ BX+ 05H]
CL ←[ BX+ 05H]
= base
Example:
to 2040.
• Example:
processor.
• Example:
• 0 (zero) addresses
– All addresses implicit
– Example: stack
• push a
• push b
• pop c
One-address instruction
• 1 address
– Implicit second address : Usually a register
(accumulator)
– E.g. Add C // C=C+A(accumulator)
Two-address instruction
• 2 addresses
– To store result
–a=a+b
– Reduces length of instruction
– Requires temporary storage to hold some results
Three-address instruction
• 3 addresses
– Operand 1, Operand 2, Result
– a = b + c;
– Not common
– Needs very long words to hold everything
• The Instruction Cycle
– Basic View
– Intermediate View
– Exceptions
– Operation - the operation code does
not denote a valid operation
– Execution - the instruction logic fails,
typically due to the input data
• divide by zero
• integer addition/subtraction
overflow
• floating point underflow/overflow
27. Explain role of different registers.
This register holds the memory addresses of data and instructions. This register is used to access
data and instructions from memory during the execution phase of an instruction. Suppose CPU
wants to store some data in the memory or to read the data from the memory. It places the
address of the-required memory location in the MAR.
Program Counter
The program counter (PC), commonly called the instruction pointer (IP) in Intel x86
microprocessors, and sometimes called the instruction address register, or just part of the
instruction sequencer in some computers, is a processor register
It is a 16 bit special function register in the 8085 microprocessor. It keeps track of the the next
memory address of the instruction that is to be executed once the execution of the current
instruction is completed. In other words, it holds the address of the memory location of the
next instruction when the current instruction is executed by the microprocessor.
Accumulator Register
This Register is used for storing the Results those are produced by the System. When the CPU
will generate Some Results after the Processing then all the Results will be Stored into the AC
Register.
Memory Data Register (MDR)
MDR is the register of a computer’s control unit that contains the data to be stored in the
computer storage (e.g. RAM), or the data after a fetch from the computer storage. It acts like
a buffer and holds anything that is copied from the memory ready for the processor to use it.
MDR holds the information before it goes to the decoder.
MDR which contains the data to be written into or readout of the addressed location. For example,
to retrieve the contents of cell 123, we would load the value 123 (in binary, of course) into the
MAR and perform a fetch operation. When the operation is done, a copy of the contents of cell
123 would be in the MDR. To store the value 98 into cell 4, we load a 4 into the MAR and a 98
into the MDR and perform a store. When the operation is completed the contents of cell 4 will
have been set to 98, by discarding whatever was there previously.
The MDR is a two-way register. When data is fetched from memory and placed into the MDR, it
is written to in one direction. When there is a write instruction, the data to be written is placed into
the MDR from another CPU register, which then puts the data into memory.
The Memory Data Register is half of a minimal interface between a micro program and computer
storage, the other half is a memory address register.
Index Register
A hardware element which holds a number that can be added to (or, in some cases, subtracted
from) the address portion of a computer instruction to form an effective address. Also known as
base register. An index register in a computer’s CPU is a processor register used for modifying
operand addresses during the run of a program.
Memory Buffer Register
MBR stands for Memory Buffer Register. This register holds the contents of data or instruction
read from, or written in memory. It means that this register is used to store data/instruction coming
from the memory or going to the memory.
Data Register
Control unit can be designed by two methods which are given below:
Alternate :
• Consider an instruction that is fetched from the main memory into the instruction
register.
• The processor uses its unique opcode to identify the address of the first micro
instruction.
• This address is decoded to identify the corresponding micro instruction from the
control memory.
• There is a big improvement over Wilke’s design, to reduce the size of micro
instructions.
• Instead the microprogram counter(micro PC) will simply get incremented after
every micro instruction.
• If the branch is unconditional, the branch address will be directly loaded into
CMAR.
• For conditional branches, the branch condition will check the appropriate flag.
branch address.
→ • Micro programs for all instructions are stored in a small memory called
control memory.
• Consider an instruction that is fetched from the main memory into the instruction
register.
• The processor uses its unique opcode to identify the address of the first micro
instruction.
• The decoder identifies the corresponding micro instruction from the control
memory.
• A micro instruction has two fields: a control field and an address field.
• This address is further loaded into CMAR to fetch the next micro instruction.
• This is because the address of the next micro instruction depends on the condition.
• Any change in the control unit can be performed by simply changing the micro
instruction.
• This makes modifications and upgradation of the control unit very easy.
Disadvantages :
• Control memory has to be present inside the processor, increasing its size.
• The address field in every micro-instruction adds more space to the control
memory. This can be avoided by proper micro-instruction sequencing.
33. Explain microinstruction sequencing.
• Thereafter each micro instruction gives the address of the next micro instruction.
The multiplexer will decide the address to be loaded into the control
• The IR gives the address of the first micro –instruction into CMAR.
• Hence every microinstruction need not carry the address of the next instruction.
• For unconditional branches, the micro instruction contains the branch address. This
address will be loaded into CMAR.
• For a conditional branch, micro instruction contains the branch address for true
condition.
• If the condition is false the current address in CMAR, will be simply incremented.
• This means even in the worst case the micro instruction will carry only one
address. Hence it is called Single address field.
• The multiplexer will decide the address to be loaded into the control memory
address register(CMAR) based on the status flags
be easily modified.
execute.
• Seven types of memory devices are used in the computer forming a Memory
Hierarchy.
• Each plays a specific role, contributing to the speed, cost effectiveness, portability
etc.
The memory in a computer can be divided into five hierarchies based on the speed as
well as use. The processor can move from one level to another based on its
requirements. The five hierarchies in the memory are registers, cache, main memory,
magnetic discs, and magnetic tapes. The first three hierarchies are volatile memories
which mean when there is no power, and then automatically they lose their stored
data. Whereas the last two hierarchies are not volatile which means they store the
data permanently.
1) Registers
Usually, the register is a static RAM or SRAM in the processor of the computer
which is used for holding the data word which is typically 64 or 128 bits. The
program counter register is the most important as well as found in all the processors.
Most of the processors use a status word register as well as an accumulator. A status
word register is used for decision making, and the accumulator is used to store the
data like mathematical operation. Usually, computers like complex instruction set
computers have so many registers for accepting main memory, and RISC- reduced
2) Cache Memory
Cache memory can also be found in the processor, however rarely it may be another
IC (integrated circuit) which is separated into levels. The cache holds the chunk of
data which is frequently used from main memory. When the processor has a single
core then it will have two (or) more cache levels rarely. Present multi-core processors
will be having three, 2-levels for each one core, and one level is shared.
3) Main Memory
The main memory in the computer is nothing but the memory unit in the CPU that
communicates directly. It is the main storage unit of the computer. This memory is
fast as well as large memory used for storing the data throughout the operations of
4) Magnetic Disks
The magnetic disks in the computer are circular plates fabricated of plastic otherwise
metal by magnetized material. Frequently, two faces of the disk are utilized as well
as many disks may be stacked on one spindle by read or write heads obtainable on
every plane. All the disks in the computer turn jointly at high speed. The tracks in the
computer are nothing but bits which are stored within the magnetized plane in spots
next to concentric circles. These are usually separated into sections which are named
as sectors.
5) Magnetic Tape
magnetizable covering on an extended, plastic film of the thin strip. This is mainly
used to back up huge data. Whenever the computer requires access to a strip, first it
will mount to access the data. Once the data is allowed, then it will be unmounted.
The access time of memory will be slower within the magnetic strip as well as it will
→ Memory Characteristics :
1) Location Based on its physical location, memory is classified into three types.
• On-Chip: This memory is present inside the CPU. E.g.:: Internal Registers and L1
Cache.
2) Storage Capacity This indicates the amount of data stored in the memory.
Obviously it should be as large as possible.
3) Transfer Modes : Data can be transferred from memory in two different ways.
• Word Transfer: Here, if CPU needs some data, it will transfer only that amount of
data. E.g.:: Data accessed from L1 Cache.
• Block Transfer: Here, if the CPU needs some data, it will transfer an entire block
containing that data. This makes further access to remaining data of this block much
faster. This is based on the Principle of Spatial Locality. A processor is most likely to
access data near the current location being accessed. E.g.:: On a cache miss, the
processor goes to main memory and copies a block containing that data.
4) Access Modes : Memories can allow data to be accessed in two different ways.
• Serial Access: Here locations are accessed one by one in a sequential manner. The
access time depends on how far the target location is, from the current location.
Farther the location, more will be its access time. E.g.:: Magnetic tapes.
• Random Access: Here all locations can be directly accessed in any random order.
This means all locations have the same access time irrespective of their address.
E.g.:: Most modern memories like RAM.
• Volatile: Contents of the memory are lost when power is switched off. E.g.:: RAM
• Non-Volatile: Contents of the memory are retained when power is switched off.
E.g.:: ROM. Most secondary memories like hard disk are writable as well as
non-volatile.
6) Access Time : It is the time taken between placing the request and completing the
data transfer. It should be as little as possible. It is also known as latency.
7) Reliability : It is the time for which the memory is expected to hold the data
without any errors. It is measured as MTTF: Mean Time To Failure. It should be
as high as possible.
8) Cost : This indicates the cost of storing data in the memory. It is expressed as
Cost/bit. It must be as low as possible.
9) Average Cost : It is the total cost per bit, for the entire memory storage. Consider
a system having two memories M1 (RAM) & M2 (ROM) If C1 is the cost of
memory M1, of size S1 & C2 is the cost of memory M2 of size S2
• Then the average cost of the memory is be calculated as: C(AVG) = (C1 S1 + C2
S2)/ (S1 + S2)
• Small sizes of expensive memory and large size of cheaper memory lowers the
average cost.
10) Hit Ratio (H) : Consider two memories M1 and M2. M1 is closer to the
processor
E.g.:: RAM, than M2 E.g.:: Hard disk. If the desired data is found in M1, then it is
called a Hit, else it is a Miss. Let N1 be the number of Hits and N2 the number of
Misses. The Hit Ratio H is defined as the number of hits divided by total attempts.
• No single memory can satisfy all the characteristics, hence we need a hierarchy of
memories.
• Cache memories are the fastest but also the most costly.
• Hard disk is writable as well as non volatile and is also very inexpensive, but is
much slower.
• DRAM is writable, faster than hard disk and cheaper than SRAM hence forms most
part of Main Memory.
→
39. Numericals based on cache mapping techniques.
→
40. Explain cache coherence problem
→
41. Explain memory interleaving techniques.
→
42. What is associative memory?
→
43. Explain six stage instruction pipeline with diagram
→
44. What is instruction pipelining?
→
45. Explain different types of pipeline hazards.
→
46. What is branch prediction and delayed branch?
→
47. Write short on performance measures such as cpu time, throughput.
Multiple.
Flynn Matrix
Flynn
• Deterministic execution
mainframes
• Single instruction: All processing units execute the same instruction at any given
clock
cycle
• Multiple data: Each processing unit can operate on a different data element
• Examples:
• Processor Arrays: Connection Machine CM-2, Maspar MP-1, MP-2
• Vector Pipelines: IBM 9000, Cray C90, Fujitsu VP, NEC SX-2, Hitachi S820
message.
instruction stream
stream
deterministic
PCs.
49. What is bus arbitration? Explain.
→ In a Loosely coupled system all processors can use their local bus
simultaneously.
The material in this presentation belongs to St. Francis Institute of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
• All bus masters use the same line for Bus Request.
• If the Bus Busy line is inactive, the Bus Controller gives the Bus
Grant signal.
• Bus Grant signal is propagated serially through all masters
starting from nearest one.
• The bus master, which requires the system bus, stops this
signal, activates the Bus Busy line and takes control of the
system bus.
B) Polling Method
Here also all bus masters use the same line for Bus Request.
• Here the controller generates binary address for the master. Eg: To connect 8 bus
masters we need 3 address lines.
• In response to a Bus Request, the controller "polls" the bus masters by sending a sequence of
bus master addresses on the address lines.Eg: 000,010,100,011 etc
• The selected master activates the Bus Busy line and takes control of the bus.
→
52. Numericals on Amdahl’s law