Register Transfer Language

Definitions | Basic Symbols


Definitions

Register Transfer Language (RTL) is a concise way of specifying microcode instructions. Microcode is a level below assembly language, which is itself a level below high level languages like C and C++. For more on assembly language, see the page on opcode decoding.

This can be explained more clearly with the diagram below.

High-level languages
                     are compiled into
Assembly language
                     which compiles to
Opcodes
                     which evaluates at runtime to
Microcode
                     which directly runs hardware circuits.
Actually, this is a slight blurring of the truth. Compiler technology is good enough that high-level languages are no longer converted to assembly language when compiled. If you are interested in this kind of thing, CMSC 430 is a good course to take when you get a chance.

What this really boils down to is that microcode is what lets programs actually run. It is extremely rare to program in microcode these days, because most microcode is already written for the popular computer architectures. Nonetheless, an understanding of microcode is important, since an analysis of microcode allows a greater understanding of the instruction set.


Symbols

The following notation is often used when specifying microcode.

Basic Symbols

An R followed by a number refers to a register. R2 therefore means the second register.

M typically refers to memory, with memory addresses written inside square braces. As an example, M[R4] refers to the contents of the memory address in R4. M[42] refers to the contents of memory address 42.

An arrow pointing to the left is used for a transfer of data. R6 <- R1 stores the value of R1 into R6.

A comma represents simultaneous transfers. R1 <- R3, R2 <- R4 means "store R3 into R1 and at the same time, store R4 into R2."

Parentheses indicate part of a register. R8(1) is the second least significant bit of R8. R3(7:0) is the least significant byte of R3.

Mathematical and Logical Symbols

A subscripted letter followed by a colon is a conditional. That is, K1: R2 <- R1 means "if K1 is true, then store R1 into R2." Actually, K1 can refer to any boolean function, such as the output of a circuit or a control line from a timer.

Addition is indicated by the + sign. R1 <- R2 + R3 means "Add R2 and R3, and store them into R1."

Subtraction is handled not with the minus sign but with complementing. A one's complement subtraction is a simple complement. A two's complement subtraction is a complement and an addition of 1. Since the format of these pages prevents the display of the complementation symbol (a bar over the value to be complemented), we shall use a single quote. Note that this is not standard RTL, and on exams and homeworks you should use a bar. To subtract (on a one's complement machine) R4 from R3, and put the result into R5, the RTL is "R5 <- R3 + R4'", while on a two's complement machine, it would be "R5 <- R3 + R4' + 1".

This implies that complementing is easily specified in RTL, which is correct. Both one's complement and two's complement can be specified - the details are just as stated above.

Addition of constants is also possible, again as stated above. Note that subtraction of constants does use a minus sign, since a constant cannot be complemented without knowing the size of the other operand, and since it is much clearer to write "R9 <- R3 - 1" instead of "R9 <- R3 + 65534" (for a 16-bit machine). [Also note that if the same microcode specification is used for different machines - for instruction set compatability, for example - and the register size is different on each machine, the second example will produce an incorrect result!]

Complex Logical Symbols

Conditionals can have more than one test value. If R5 will be stored in R4 only when both K1 and K2 are true, the RTL would be written as "K1K2: R4 <- R5". On the other hand, if R5 were to be stored when either K1 or K2 were true, a + sign would be used: (K1+K2): R4 <- R5. Note that this is a little confusing, since + means addition on the right hand side of the colon. If a + is on the left, it means OR, while on the right, it means PLUS.

ANDing and ORing (on a bit by bit basis) of registers uses the same AND and OR symbols used in CMSC 150. To store R3 AND R2 into R1, the RTL would be written as "R1 <- R3 and R2", while storing R3 OR R2 into R1 is "R1 <- R3 and R2". Exclusive OR works the same way, but uses the XOR symbol ().

Shift left and shift right are unary operators. (See Shift Registers and Ripple Counters for a review of shifting.) They only shift one place left or right per instruction. "R1 <- sr R1" is a typical RTL shift instruction.

If-then-else (and if-then-elseif-then and so forth) is implemented with commas and multiple colons. "If K1, then store R4 into R6, else if K2, then store R5 into R6, else store R7 into R6" is written as: K1: R6 <- R4, K1'K2: R6 <- R5, K1'K2': R6 <- R7.


Back to the Table of Contents.