REGISTER TRANSFER LANGUAGE RTL Outline Register Transfer Language

  • Slides: 54
Download presentation
REGISTER TRANSFER LANGUAGE (RTL) ~ Outline ~ Register Transfer Language: v. Type of Registers

REGISTER TRANSFER LANGUAGE (RTL) ~ Outline ~ Register Transfer Language: v. Type of Registers – (5 type) v. Basic Symbols – (6 basic symbol) Microoperation in digital system v. Register Transfer v. Arithmetic Microoperations v. Logic Microoperations v. Shift Microoperations

Register Transfer Language (RTL) HIGH LEVEL LANGUAGE Example : C+, VB, JAVA ASSEMBLY LANGUAGE

Register Transfer Language (RTL) HIGH LEVEL LANGUAGE Example : C+, VB, JAVA ASSEMBLY LANGUAGE Example : u. P and u. C RTL • to represent registers • specify the operations on their contents OPCODE Mircocode (Micro-operations): Operations executed on data stored in registers, performed in one clock cycle MICROCODE Register Transfer Language (RTL): Symbolic notation used to describe micro-operations

Register Transfer Language (RTL) RTL: • Is an algebraic notation used to define machine

Register Transfer Language (RTL) RTL: • Is an algebraic notation used to define machine level operations • It is not executed by a computer • It is used to explain how the computer works. Example: In 68000 assembly language instruction ADD #3, D 2 is define in RTL as [D 2] + 3

Types of Registers 1. AR : Address Registers ◦ A register holds an address

Types of Registers 1. AR : Address Registers ◦ A register holds an address for memory unit 2. DR: Data Registers 3. PC : Program Counter 4. IR : Instruction Register 5. Rn : n indicates the Register number ◦ e. g. R 2 is Register 2

Block Diagram of Registers Bit 7 7 6 5 4 3 2 1 0

Block Diagram of Registers Bit 7 7 6 5 4 3 2 1 0 R 8 bit Register 8 bit = 1 byte 16 bit = 2 byte Bit 0 Bit 15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 16 bit Register Bit 15 H = High order byte PC(H) = PC(15: 8) 0 Bit 0 87 PC(H) 1 PC(L) L = Low order byte PC(L) = PC(7: 0)

Basic Symbols 1) R followed by a number (Rn) is referring to a register:

Basic Symbols 1) R followed by a number (Rn) is referring to a register: R 2 = second register/register no 2 2) M refers to Memory with addresses in square braces: M[memory w address] ◦ Direct Addressing ◦ Indirect Addressing

Basic Symbols Direct Addressing : M[10] = contents of memory address 10 MEMORY Address

Basic Symbols Direct Addressing : M[10] = contents of memory address 10 MEMORY Address Content 10000000 9 10 1011 11 1111 In this example, M[10] refers to 1011 In-direct Addressing : M[R 3] = content of the memory address in R 3 MEMORY Address 15 16 17 Content 10000000 1011 1111 REGISTER Address 1 2 3 Answer: M[R 3] refers to 10000000 Content 10000000110 00001111 = 15

Basic Symbols 3) Arrow pointing to the right shows transfer of data : R

Basic Symbols 3) Arrow pointing to the right shows transfer of data : R 4 Destination R 3 Source = Stores the value of R 3 into R 4 The word transfer is misleading, since it implies that data is moved from one location to another. In fact, the data is copied from one location to another since it also still resides in register R 3. Contents of the source REG do not change. Only change the contents of destination REG

Basic Symbols 4) A comma represents simultaneous transfer: R 1 R 2, R 6

Basic Symbols 4) A comma represents simultaneous transfer: R 1 R 2, R 6 R 7 Stores R 2 into R 1 and at the same time stores R 7 into R 6. 5) A colon indicates the termination of function: K : R 1 K 1 K 2’ : R 2 R 3 ; If K=1, then stores R 2 into R 1. R 2 ; If K=1 and K 2=0, then stores R 2 into ; R 3. K: control signal generated in the control unit, 0 or 1

Basic Symbols 6) Parenthesis (bracket) indicates part of the register. LSB : Least Significant

Basic Symbols 6) Parenthesis (bracket) indicates part of the register. LSB : Least Significant Bit MSB : Most Significant Bit R 8(1) = bit 1 of R 8 MSB LSB 7 6 5 4 3 2 1 0 Bit Position 1 0 1 1 1 0 0 0 Content

Basic Symbols Parenthesis indicates part of the register. R 3(7: 0) = the least

Basic Symbols Parenthesis indicates part of the register. R 3(7: 0) = the least significant byte of R 3 15 14. . 9 8 7 6 5 4 3 2 1 0 1 1 1 0 0. . 1 Note : 1 byte = 8 bit

Summary Symbol Description Example Square brackets Specifies an address for memory M[R 2] Capital

Summary Symbol Description Example Square brackets Specifies an address for memory M[R 2] Capital Letters & Numerals Denotes a register AR, IR, PC, R 2 Parentheses Denotes part of a register R 2(1), R 2(7: 0), PC(L) Arrow Denotes Transfer of data R 1 Colon Denotes termination of control function Separates simultaneous transfers K: Comma R 1 R 2, R 3 R 2

Microoperations The operations performed on data stored in registers or in memory. The functions

Microoperations The operations performed on data stored in registers or in memory. The functions built into registers are examples of microoperations ◦ Shift ◦ Load ◦ Clear ◦ Increment ◦ …

Microoperations The microoperations most often encountered in digital systems are of four types: 1)

Microoperations The microoperations most often encountered in digital systems are of four types: 1) ◦ 2) ◦ 3) ◦ 4) ◦ Register transfer microoperations Transfer binary data from one REG to another Arithmetic microoperations Perform arithmetic on data in REG Logic microoperations Perform bit manipulation on data in REG Shift microoperations Shift data in REG

(1) Register Transfer Microoperations

(1) Register Transfer Microoperations

Register Transfer Microoperations Copying the contents of one register to another is a register

Register Transfer Microoperations Copying the contents of one register to another is a register transfer. A register transfer is indicated as: R 2 R 1 ◦ In this case the contents of register R 1 are copied (loaded) into register R 2. ◦ A simultaneous transfer of all bits from the source R 1 to the destination register R 2, during one clock pulse. ◦ Note that this is a non-destructive; i. e. the contents of R 1 are not altered by copying (loading) them to R 2.

Register Transfer Microoperations A register transfer such as R 3 R 5 Implies that

Register Transfer Microoperations A register transfer such as R 3 R 5 Implies that the digital system has ◦ the data lines from the source register (R 5) to the destination register (R 3) ◦ Parallel load in the destination register (R 3) All bits are loaded simultaneously on clock pulse (same source) ◦ Control lines to perform the action Control the transfer or clock cycles

Register Transfer Microoperations Conditional Statement ◦ Using control signal to control the transfer. ◦

Register Transfer Microoperations Conditional Statement ◦ Using control signal to control the transfer. ◦ Can be symbolized by if-then statement if (K 1 = 1) then (R 2 R 1) ; K 1: control signal ◦ In RTL we can write it as: K 1 : R 2 R 1 A subscripted letter followed by a colon is a conditional The transfer operation be executed only if K 1=1

Conditional Register Transfer K 1 : R 2 R 1 Content of R 1

Conditional Register Transfer K 1 : R 2 R 1 Content of R 1 will be stored in R 2 when condition K 1 occurs (K 1=1). R 2 R 1 K 1

Conditional Register Transfer K 1 : R 2 K 1 Load control input activated

Conditional Register Transfer K 1 : R 2 K 1 Load control input activated by control signal K 1 R 1 CLK K 1 R 1 n R 2 n = no of lines = no of bits Transfer occurs in parallel Transfer occurs here

Register Transfer Microoperations Simultaneous Operations ◦ If two or more operations are to occur

Register Transfer Microoperations Simultaneous Operations ◦ If two or more operations are to occur simultaneously, they are separated with commas. K: R 3 R 5, AR IR ◦ If the control function K = 1, load the contents of R 5 into R 3, and at the same time (positive clock edge), load the contents of register IR into register AR

Register Transfer Microoperations Complex Logical Symbols ◦ Content of R 5 will be stored

Register Transfer Microoperations Complex Logical Symbols ◦ Content of R 5 will be stored in R 4 only IF both condition K 1 and condition K 2 are true: K 1 K 2 : R 4 R 5 If K 1=1 and K 2=1, then stores R 5 into R 4 ◦ Content of R 5 will be stored in R 4 IF either condition K 1 or condition K 2 were true, a + sign would be used: K 1 + K 2 : R 4 R 5 If K 1=1 or K 2=1, then stores R 5 into R 4 NOTE: In (K 1 + K 2), “+” means “OR” In R 1 ← R 1 + R 3, “+” means “plus”

Register Transfer Microoperations Complex Logical Symbols ◦ If – then – else is implemented

Register Transfer Microoperations Complex Logical Symbols ◦ If – then – else is implemented with commas and multiple colons. ◦ If K 1 true, then stores R 4 into R 6, else if K 2 true, then stores R 5 into R 6, else store R 7 into R 6. K 1: R 6 R 4, K 1 K 2: R 6 R 5, K 1 K 2 : R 6 R 7

(2) Arithmetic Microoperations

(2) Arithmetic Microoperations

Arithmetic Microoperations The basic arithmetic microoperations are ◦ Addition ◦ Subtraction ◦ Increment ◦

Arithmetic Microoperations The basic arithmetic microoperations are ◦ Addition ◦ Subtraction ◦ Increment ◦ Decrement The additional arithmetic microoperations are ◦ Add with carry ◦ Subtract with borrow ◦ Transfer/Load ◦ etc. …

Arithmetic Microoperations Addition is indicated by the + sign: Example 1: R 1 R

Arithmetic Microoperations Addition is indicated by the + sign: Example 1: R 1 R 2 + R 3 Add R 2 and R 3, stores in R 1 Example 2: R 2 R 4 + R 1 Add R 4 and R 1, stores in R 2

Arithmetic Microoperations Subtraction is handled not with the minus sign but with 2’s complement.

Arithmetic Microoperations Subtraction is handled not with the minus sign but with 2’s complement. 1’s complement : R 5 R 3+R 4 2’s complement : R 5 Note : R 3+R 4+1 R 3 minus R 4 in 2’s complement Computers use the 2’s complement for negative integer numbers in all arithmetic operations.

Arithmetic Microoperations Multiplication is indicated by the * sign: Example: R 2 R 1

Arithmetic Microoperations Multiplication is indicated by the * sign: Example: R 2 R 1 * R 2 Division is indicated by the / sign: Example: R 2 R 1 / R 2

Arithmetic Microoperations Summary of Typical Arithmetic Microoperations (Page 547) Note : Any register may

Arithmetic Microoperations Summary of Typical Arithmetic Microoperations (Page 547) Note : Any register may be specified for source 1, source 2, or destination.

(3) Logic Microoperations

(3) Logic Microoperations

Logic Microoperations Specify binary operations on the strings of bits in registers ◦ Logic

Logic Microoperations Specify binary operations on the strings of bits in registers ◦ Logic microoperations are bit-wise operations, i. e. they work on the individual bits of data ◦ useful for bit manipulations on binary data ◦ useful for making logical decisions based on the bit value The symbols for the four basic logic operations are: ◦ ◦ OR ( ), AND ( ), XOR ( ), Complement/NOT

Logic Microoperations v OR (SETS Bits) Example: ^ R 3 R 4 v R

Logic Microoperations v OR (SETS Bits) Example: ^ R 3 R 4 v R 6 AND (CLEARS Bits) Example: R 2 DR ^ R 1 XOR (Complement Bits, 2 Sources) Example: PC PC DR NOT (Complement Bits, 1 Source) Example: R 6 R 1

Logic Microoperations Example: Let R 1 = 1010 and R 2 = 11110000 After

Logic Microoperations Example: Let R 1 = 1010 and R 2 = 11110000 After the operations, R 0 becomes:

Hardware Implementation of Logic Microoperations Ai Bi 0 1 4 X 1 MUX Fi

Hardware Implementation of Logic Microoperations Ai Bi 0 1 4 X 1 MUX Fi 2 3 Select S 1 S 0 Function table S 1 0 0 1 1 S 0 0 1 Output F=A B F = A B F=A B F = A’ -operation AND OR XOR Complement

Applications of Logic Microoperations Logic microoperations can be used to manipulate individual bits or

Applications of Logic Microoperations Logic microoperations can be used to manipulate individual bits or a portions of a word in a register Logic microoperations can change bit values, clear a group of bits, or insert new bit values into a register.

Logic Microoperations AND microoperation Used for clearing one or more bits in a register

Logic Microoperations AND microoperation Used for clearing one or more bits in a register to 0. Boolean equations: X • 0=0 When ANDed with 0, binary variable X produces 0. X • 1=X When ANDed with 1, binary variable X remains unchanged.

X • 0=0 AND microoperation X • 1=X Example: R 1 ^ R 2

X • 0=0 AND microoperation X • 1=X Example: R 1 ^ R 2 10101101 10101011 0000 1111 0000 10101011 R 2 R 1 (data) (mask) R 1 : Low-order byte = Unchanged High-order byte = Clear ◦ ◦ Selectively clear bits of a register Masking out the bits

Logic Microoperations OR microoperation Used to set one or more bits in a register.

Logic Microoperations OR microoperation Used to set one or more bits in a register. Boolean equations: X+1=1 When ORed with 1, binary variable X produces a 1. X+0=X When ORed with 0, binary variable X remains unchanged.

X+1=1 OR microoperation X+0=X Example: R 1 v R 2 10101101 10101011 1111 0000

X+1=1 OR microoperation X+0=X Example: R 1 v R 2 10101101 10101011 1111 0000 1111 10101011 R 2 R 1 (data) (mask) R 1 : Low-order byte = Unchanged High-order byte = Set to 1’s ◦ Selectively set bits of a register

Logic Microoperations XOR microoperation Used to complement one or more bits in a register.

Logic Microoperations XOR microoperation Used to complement one or more bits in a register. Boolean equations: X 1=X When XORed with 1, binary variable X complemented. X 0=X When XORed with 0, binary variable X remains unchanged.

X 1=X XOR microoperation X 0=X Example: R 1 R 2 10101101 10101011 1111

X 1=X XOR microoperation X 0=X Example: R 1 R 2 10101101 10101011 1111 0000 01010010 10101011 R 2 R 1 (data) (mask) R 1 : Low-order byte = Unchanged High-order byte = Complemented ◦ Selectively complement bits of a register

(4) SHIFT MICROOPERATIONS

(4) SHIFT MICROOPERATIONS

Shift Microoperations Shift microoperations are used for: ◦ Lateral movement of data. ◦ Serial

Shift Microoperations Shift microoperations are used for: ◦ Lateral movement of data. ◦ Serial transfer of data. ◦ Manipulating the contents of registers in arithmetic, logical, and control operations.

Shift Microoperations MSB LSB 7 6 5 4 3 2 1 0 • A

Shift Microoperations MSB LSB 7 6 5 4 3 2 1 0 • A right shift operation : toward the LSB Serial input • A left shift operation: toward the MSB Serial input

Shift Microoperations In RTL, string of letters are used to specify shift operations: ◦

Shift Microoperations In RTL, string of letters are used to specify shift operations: ◦ Shift left : ◦ Shift right : sl sr 1 -bit

Shift Microoperations There are three types of shifts ◦ Logical shift ◦ Circular shift

Shift Microoperations There are three types of shifts ◦ Logical shift ◦ Circular shift ◦ Arithmetic shift What differentiates them is the information that goes into the serial input/incoming bit

Shift Microoperations Logical Shift Assume the serial input/incoming bit to the shift is a

Shift Microoperations Logical Shift Assume the serial input/incoming bit to the shift is a 0. A right shift operation: toward the LSB 0 A left shift operation : toward the MSB 0 MSB Example of Shifts: Type Symbolic Designation Source R 2 After Shift: Destination R 1 Shift Left R 1 sl R 2 100111100 Shift Right R 1 sr R 2 11100101 01110010

Shift Microoperations Example : Let R 2 = 11001001 After the Shift operation, R

Shift Microoperations Example : Let R 2 = 11001001 After the Shift operation, R 1 becomes: Note: These shifts "zero fill". Sometimes a separate flip-flop is used to provide the data shifted in, or to “catch” the data shifted out.

Exercises

Exercises

Exercise (Tutorial 2)

Exercise (Tutorial 2)

Exercise (MTE 2013/2014)

Exercise (MTE 2013/2014)

Exercise (MTE 2014/2015)

Exercise (MTE 2014/2015)

Exercise (MTE 2015/2016)

Exercise (MTE 2015/2016)

Exercise (MTE 2016/2017)

Exercise (MTE 2016/2017)