System Registers
4-3
Assembly Language Instructions
or by 2 for double word instructions) each execution cycle and points to the
next program memory location to fetch. During a maskable interrupt, the next
PC address is stored in the TOS register and is reloaded from TOS after the
interrupt encounters an IRET instruction. Call and jump instructions also store
the next instruction address by adding PC+2 and then storing the result in the
TOS register. Upon encountering a RET instruction, the TOS value is reloaded
to the PC. Call instructions may not precede RET instructions. Similarly, a RET
instruction may not immediately follow another RET instruction. In these
conditions, pipeline operations breaks down and the PC never recovers its re-
turn address from the TOS register. The processor stalls, and the only solution
is to reset the device. On the other hand, RET can be safely replaced by IRET
eliminating processor stalls in all conditions. However, IRET takes one more
cycle than RET.
4.2.5
Top of Stack, (TOS)
The top of stack (TOS) register holds the value of the stack pointed by the stack
register (R7). The MSP50P614/MSP50C614 hardware uses TOS register for
very efficient returns from CALL instructions. Figure 4-1 shows the operation
of the TOS register. When call instructions are executed, the old TOS register
value is pushed into the stack by pre-incrementing R7. The current PC value
is incremented by 2 to compute the final return address and is then stored in
the TOS register. Thus, the TOS register holds the next PC value pointing to
the next instruction. When the subroutine reaches the RET instruction, the
program counter (PC) is loaded with the TOS register. Next, the TOS is loaded
with the value pointed to by R7. Finally, the stack register (R7) is decremented.
Figure 4–1. Top of Stack (TOS) Register Operation
Program counter (PC)
+2
Data memory stack area
Stack register (R7)
Top of stack register (TOS)
Read before
incrementing R7
Increment R7 then
store TOS value
Preincrement
during write (+2)
Postdecrement
during read (+2)
The MSP50P614/MSP50C614 development tools use the TOS register for
parameter passing. The TOS register must be used with caution inside user
programs. If the TOS register and stack register (R7) are not restored to their
previous values after using the TOS register in an application, the program can
hang the processor or cause the program to behave in an unpredictable way.
Summary of Contents for MSP50C614
Page 1: ...MSP50C614 Mixed Signal Processor User s Guide SPSU014 January 2000 Printed on Recycled Paper ...
Page 6: ...vi ...
Page 92: ...3 22 ...
Page 300: ...Instruction Set Summay 4 208 Assembly Language Instructions ...
Page 314: ...Software Emulator 5 14 Figure 5 13 Project Menu Figure 5 14 Project Open Dialog ...
Page 325: ...Software Emulator 5 25 Code Development Tools Figure 5 25 EPROM Programming Dialog ...
Page 331: ...Software Emulator 5 31 Code Development Tools Figure 5 31 Context Sensitive Help System ...
Page 368: ...5 68 ...
Page 394: ...7 12 ...
Page 402: ...A 8 ...
Page 412: ...Packaging B 10 ...