Impress
CMPSC-F353
Architecture of Comp Systems
Data Representation, RTL
For a number system in base r system, we have r’s complement and (r-1)’s complement.
For number N in base r with n digits, the (r-1)’s complement is
e.g. decimal number
The 9’s complement of 546700 is
999999 – 546700 = 453299
For binary number N, 1’s complement is
In simple terms, the 1’s complement of a binary number is formed by flipping every bit.
e.g. The 1’s complement of 1011001 is 0100110
Complements
2
The r’s complement of an n-digit number N in base r is defined as for
In simple terms, r’s complement is obtained by adding 1 to the (r-1)’s complement
e.g. decimal number
The 10’s complement of 2389 is 7610+1=7611
e.g. binary number
The 2’s complement of 101100 is 010011 + 1= 010100
Complements
3
sign-and-magnitude representation
MSB represents the sign, other bits represent the magnitude.
Example:
+14 = 0000 1110
-14 = 1000 1110
The leftmost bit is 0 for + numbers and 1 for –numbers.
Representation of Integer Numbers
signed 1’s complement representation
1’s complement of each bit of positive numbers, even the signed bit
Example:
+14 = 0000 1110
-14 = 1111 0001
signed 2’s complement representation
two’s complement of positive number, including the signed bit.
Example:
+14 = 0000 1110
-14 = 1111 0001 + 1 = 1111 0010
Representation of Integer Numbers
Arithmetic Addition
Signed-magnitude:
Example: addition of +25 and -37
Compare signs
If same, add the two numbers
If different
Compare magnitudes
Subtract smaller from larger and give result the sign of the larger magnitude
+25 + -37 = – (37-25) = -12
computer system requires comparator, adder, and subtractor
Arithmetic Addition
2’s complement numbers: only addition is required
Add two numbers including the sign bit
Discard any carry
Result is in 2’s complement form
Example: addition of +25 and -37
0001 1001 (+25)
+ 1101 1011 (-37)
1111 0100 (-12)
Arithmetic Subtraction
2’s complement numbers:
only addition and complementation is required
Take 2’s complement of B and add it to A:
Discard any carry, result is in 2’s complement form
Example: (-6) – (-13) = -6 + 13
1111 1010 (-6)
+ 0000 1101 (+13)
1 0000 0111 (+7)
Overflow
When sum of two n digit numbers is a (n+1) digit number
Overflow may occur when numbers have the same sign
Overflow occurs when carry into sign bit is not equal to carry out of sign bit
e.g.
0 100 0110 (+70) 1 011 1010 (-70)
+ 0 101 0000 (+80) + 1 011 0000 (-80)
0 1 001 0110 (+150) 1 0 110 1010 (-150)
9
Register Transfer Language
Microoperation
The operations executed on data stored in registers(shift, clear, load, count)
Internal H/W Organization(best defined by specifying)
1. The set of registers
2. The sequence of microoperations
3. The control that initiates the sequence of microoperations
Register Transfer Language
The symbolic notation used to describe the microoperation transfer among registers
The use of symbols instead of a narrative explanation provides an organized and concise manner
A convenient tool for describing the internal organization of digital computers in concise and precise manner
Register Transfer
Registers
Designated by Capital Letter(sometimes followed by numerals) :
MAR(Memory Address Register), PC(Program Counter), IR(Instruction Register), R1(Processor Register)
The individual F/Fs in an n-bit register : numbered in sequence from 0(rightmost position) through n-1
The numbering of bits in a 16-bit register : marked on top of the box
A 16-bit register partitioned into two parts : bit 0-7(symbol “L” Low byte), bit 8-15(symbol “H” High byte)
15 8 7 0
PC(H) PC(L)
Information transfer from one register to another
e.g. transfer of the content of register R1 into register R2(note that R1 does not change after the transfer)
Control Function :
The transfer occurs only under a predetermined control condition
The transfer operation is executed by the hardware only if P=1 :
A comma is used to separate two or more operations (executed at the same time)
=
Register Transfer
Basic Symbols for Register Transfer:
Register Transfer
What’s next?
HW3 is due Monday 9/30
Exam 1 is on Wednesday 10/2
Reading:
Chapter 3:
Section 3.1 to 3.4
Chapter 4:
Section 4.1 and 4.2
1
2
R
R
¬
1
2
:
)
1
2
(
)
1
(
R
R
P
R
R
then
P
if
¬
¬
=
2
1
,
1
2
:
R
R
R
R
T
¬
¬
Sheet1
Symbol Description Examples
Letters(and numerals) Denotes a register MAR, R2
Parentheses ( ) Denotes a part of a register R2(0-7), R2(L)
Arrow <-- Denotes transfer of information R2 <-- R1
Comma , Separates two microoperations R2 <-- R1, R1 <-- R2