Btech Co - Unit2
Btech Co - Unit2
AND ARCHITECTURE
NAAC A+
GAURAV GUPTA
Computer Science & Engineering
TULA’S INSTITUTE DEHRADOON
WINTER-2024
Computer Organization and
Architecture
Computer Organization and Architecture is used to
design
computer systems.
Computer Architecture is considered to be those
attributes of a system that are visible to the user like
addressing techniques, instruction sets, and bits used for
data, and have a direct impact on the logic execution of a
program, It defines the system in an abstract manner, It
deals with What does the system do.
Whereas, Computer Organization is the way in which a
system has to structure and It is operational units and the
interconnections between them that achieve the
architectural specifications, It is the realization of the
abstract model, and It deals with How to implement the
system.
Lecture #00: © GAURAV
CST-007 : COMPUTER ORGANISATION & 2
ARCHITECTURE GUPTA
Different ways to represent Signed Integer
A signed integer is an integer with a positive ‘+’ or negative sign ‘-‘ associated with it. Since the computer
only understands binary, it is necessary to represent these signed integers in binary form.
In binary, signed Integer can be represented in three ways:
1.Signed bit.
2.1’s Complement.
3.2’s Complement.
Signed bit Representation
In the signed integer representation method the following rules are followed:
1. The MSB (Most Significant Bit) represents the sign of the Integer.
2. Magnitude is represented by other bits other than MSB i.e. (n-1) bits where n is the no. of bits.
3. If the number is positive, MSB is 0 else 1.
4. The range of signed integer representation of an n-bit number is given as –(2^{n-1}-1) to (2)^{n-1}-1.
Let n = 4
Range:
–(2^{4-1}-1) to 2^{4-1}-1
= -(2^{3}-1) to 2^{3}-1
= -(7) to+7
For 4 bit representation, minimum value=-7 and maximum value=+7
Example:
(-5) in 4-bit representation
2^4-5=11 -→1011(unsigned)
To take 2’s complement simply take 1’s complement and add 1 to it.
Example:
(-5) in 2’s complement
(+5) = 0101
1’s complement of (+5) = 1010
Add 1 in 1010: 1010+1 = 1011
Therefore (-5) = 1011
Real numbers have a fractional component. This article explains the real number representation
method using fixed points. In digital signal processing (DSP) and gaming applications, where
performance is usually more important than precision, fixed point data encoding is extensively used.
The Binary Point: Fractional values such as 26.5 are represented using the binary point concept. The
decimal point in a decimal numeral system and a binary point are comparable. It serves as a divider
between a number’s integer and fractional parts.
For instance, the weight of the coefficient 6 in the number 26.5 is 10 0, or 1. The weight of the
coefficient 5 is 10-1 or (5/10 = 1/2 = 0.5).
2 * 101 + 6 * 100 + 5 * 10-1 = 26.5
A “binary point” can be created using our binary representation and the same decimal point concept.
A binary point, like in the decimal system, represents the coefficient of the expression 2 0 = 1. The
weight of each digit (or bit) to the left of the binary point is 2 0, 21, 22, and so forth. The binary point’s
rightmost digits (or bits) have weights of 2 -1, 2-2, 2-3, and so on.
11010.12
= 1 * 24 + 1 * 23 + 0 * 22 + 1 * 21 + 0* 20 + 1 * 2-1
= 16 + 8 + 2 + 0.5
= 26.5
CST-007: COMPUTER ORGANISATION Lecture #00: © GAURAV
5
AND ARCHITECTURE GUPTA
Fixed Point Representation
Shifting Pattern:
When an integer is shifted right by one bit in a binary system, it is comparable to being
divided by two. Since we cannot represent a digit to the right of a binary point in the case of
integers since there is no fractional portion, this shifting operation is an integer division.
•A number is always divided by two when the bit pattern of the number is shifted to the right
by one bit.
•A number is multiplied by two when it is moved left one bit.
How to write Fixed Point Number?
Understanding fixed point number representation requires knowledge of the shifting process
described above. Simply by implicitly establishing the binary point to be at a specific place
of a numeral, we can define a fixed point number type to represent a real number in
computers (or any hardware, in general). Then we will just use this implicit standard to
express numbers.
Two arguments are all that are required to theoretically create a fixed point type:
1.Width of the number representation.
2.Binary point position within the number.
the notation fixed<w, b>, where “w” stands for the overall amount of bits used (the width of
a number) and “b” stands for the location of the binary point counting from the least
significant bit (counting from 0).
Unsigned representation:
For example, fixed<8,3> signifies an 8-bit fixed-point number, the rightmost 3 bits of which
are fractional.
Representation of a real number:
00010.1102
= 1 * 21 + 1 * 2-1 + 1 * 2-2
=CST-007:
2 + 0.5COMPUTER
+ 0.25 ORGANISATION Lecture #00: © GAURAV
6
=AND
2.75
ARCHITECTURE GUPTA
Fixed Point Representation
Shifting Pattern:
When an integer is shifted right by one bit in a binary system, it is comparable to being
divided by two. Since we cannot represent a digit to the right of a binary point in the case of
integers since there is no fractional portion, this shifting operation is an integer division.
•A number is always divided by two when the bit pattern of the number is shifted to the right
by one bit.
•A number is multiplied by two when it is moved left one bit.
How to write Fixed Point Number?
Understanding fixed point number representation requires knowledge of the shifting process
described above. Simply by implicitly establishing the binary point to be at a specific place
of a numeral, we can define a fixed point number type to represent a real number in
computers (or any hardware, in general). Then we will just use this implicit standard to
express numbers.
Two arguments are all that are required to theoretically create a fixed point type:
1.Width of the number representation.
2.Binary point position within the number.
the notation fixed<w, b>, where “w” stands for the overall amount of bits used (the width of
a number) and “b” stands for the location of the binary point counting from the least
significant bit (counting from 0).
Unsigned representation:
For example, fixed<8,3> signifies an 8-bit fixed-point number, the rightmost 3 bits of which
are fractional.
Representation of a real number:
00010.1102
= 1 * 21 + 1 * 2-1 + 1 * 2-2
=CST-007:
2 + 0.5COMPUTER
+ 0.25 ORGANISATION Lecture #00: © GAURAV
7
=AND
2.75
ARCHITECTURE GUPTA
SIGNED MAGNITUDE ADDITION AND SUBTRACTION
HARDWARE REPRESENTATION
FLOW CHART
EXAMPLE
Multiplicand = 10111
Multiplier = 10011
N M A Q Operation
4 00011 00000 1011 Initialize
1.Dividend = 11 00011 00001 011_ Shift left AQ
2.Divisor = 3
00011 11110 011_ A=A-M
00011 00001 0110 Q[0] = 0 And
restore A
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.
85.125 85 = 1010101
0.125 = 001
85.125 = 1010101.001 =1.010101001 x 2^6 sign = 0
OPERAND FETCH:
IMMEDIATE AM:
IR[add] ALU
DIRECT AM:
IR[add] MAR MDR ALU
REGISTER AM:
IR[add] R ALU
REGISTER INDIRECT AM:
IR[add] R MAR MDR ALU
INDIRECT AM:
READ OPERATION:
1. MAR M[R1]
2. Start Read Operation on memory bus
3. Wait for MFC(memory function
complete) response from memory
4. Load MDR from memory Bus
5. R2 MDR
CONTROL SIGNAL
R1OUT,MARIN, READ
MDRMIN,WMFC
MDRPOUT, R2IN
WRITE OPERATION:
1. MAR M[R1]
2. Copy the content of R2 in MDR
3. Inform the memory for write operation
4. Wait for WMFC
CONTROL SIGNAL
R1OUT,MARIN
MDRMIN,R2OUT, WRITE
MDRMOUT, WMFC
EXECUTION OF COMPLETE
INSTRUCTION