Microoperations and RTL
A microoperation is an elementary operation performed on the data in a register: incrementing it, swapping the data of two registers, shifting its bits. The result may replace the value in the register itself or be transferred into another register, leaving the first unchanged. The language used to write them is the Register Transfer Language (RTL), similar to HDL statements but not identical to VHDL.
Notation. Registers have upper-case names, often with numbers (AR address register, PC program counter, R1, R2). Bits are indicated in parentheses after the name: . Little endian puts bit index (LSB) on the right, big endian on the left; a long register can be divided into most significant (H) and least significant (L) byte.
Types of microoperations
Definition (transfer). : the content of (source) is copied into (destination); by definition only the destination changes. In the circuit the output bits of are connected to the inputs of and control signal drives the of . A transfer is conditional if it occurs only when a control signal is 1: (the condition precedes the colon). The clock does not appear in the statement: everything is assumed to happen on the active edge. Simultaneous transfers are separated by a comma: swaps the contents at the clock edge where (both read the old values).
Example. with , : if at the clock edge, and stays .
Transfer from several sources. A destination register may receive data from several sources. As an if-then-else controlled by : If , goes to whatever is (priority to ); if and , goes to ; if both are 0, holds. A multiplexer chooses the source register and enables loading. With sources use an -to-1 MUX; if the controls are one-hot lines, an encoder turns them into the binary select code.
Formula (arithmetic microoperations). Addition (), subtraction (), increment (), decrement (), complement. Multiplication and division are not elementary: they are sequences of basic microoperations. An adder-subtractor with control signals (0 add, 1 subtract) and :
Example. , , : if , ; if , , i.e. (two's complement subtraction).
Property (masks to clear, set and complement bits). Bitwise operations: each register bit is a binary variable (NOT, AND, OR, XOR). In RTL the symbol may be arithmetic addition or logical OR: the context tells (inside a Boolean function it is OR). They are also used to modify some bits with a mask:
purpose operation mask clear some bits AND on the bits to clear, elsewhere set to 1 some bits OR on the bits to set, elsewhere complement some bits XOR on the bits to complement, elsewhere
Example. : AND with gives ; OR with gives ; XOR with gives .
With : clear the first 8 bits with mask gives ; set them with OR and mask gives ; complement them with XOR and the same mask gives .
Why it works: and (AND); and (OR); and (XOR).
Definition (shift microoperations). They move the bits of a register sideways. Shift left (): bits move towards the MSB; the bit leaving is the leftmost of the source, the bit entering is in the rightmost position of the destination. Shift right (): bits move towards the LSB; the bit leaving is on the right, the one entering on the left. Here the entering bit is and the leaving bit is discarded. multiplies by (if no overflow), divides unsigned by .
Example. (): () and .
A microoperation may belong to several types: the one's complement is both logic and arithmetic. Registers that implement shifts are in Shift Registers and CountersA shift register is a chain of D flip-flops, each output feeding the next input, so bits move one position per clock edge; it has serial input and output, optional parallel load (Shift has priority over Load) and a bidirectional version with a 4-to-1 MUX per stage (S1S0: 00 hold, 01 shift left, 10 shift right, 11 load). Uses: serial/parallel conversion, serial interfaces, delay lines, pseudo-random generators. Counters step through a sequence of states: the ripple (asynchronous) counter clocks each flip-flop with the previous output and accumulates delay, the synchronous counter uses one clock for all flip-flops and is faster, with EN and CO for cascading.Shift Registers and Counters →; microoperations as control-signal combinations are in Datapath and Control UnitA register cell is a flip-flop with logic for microoperations, shared across the n cells of a register. In a programmable system (CPU) the control unit executes instructions fetched from memory using a program counter; in a non-programmable system the control unit decides the microoperations only from inputs and datapath status signals. Complete example: summing five values with start, res and busy; the datapath has ACC_REG, OUT_REG and CNT_REG (decrementer, MUX, status signal zero); microoperations are combinations of control signals; the control unit is a 3-state Mealy machine (ready, acc, init).Datapath and Control Unit →.
Versione ripasso
- Microoperation: elementary operation on register data, written in RTL. Registers upper case (AR, PC, R1), bits , little endian = LSB on the right.
- Transfer: changes only the destination; the clock is implicit; simultaneous transfers separated by commas, swaps (both read old values). Example: , , gives .
- Several sources: , ; priority to , hold if both 0; MUX plus ; encoder for one-hot controls.
- Arithmetic: , . With , : or . Multiplication and division are sequences.
- Masks: AND with 0 clears, OR with 1 sets, XOR with 1 complements. AND gives ; XOR gives .
- Shifts: towards MSB (times 2), towards LSB (divide by 2); entering bit 0, leaving bit lost. : , .
- Mistakes: thinking changes ; swapping the masks; reading always as addition (in Boolean functions it is OR); confusing and .