Architecture of the MSP430 Processor. Central Processing Unit. Program Counter (PC ) - C ontains the address of the next instruction to be executed . T he lsb of the PC is hardwired to 0
PowerPoint Slideshow about 'Architecture of the MSP430 Processor' - kalyca
Download NowAn Image/Link below is provided (as is) to download presentation
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Program Counter (PC) - Contains the address of the next instruction to be executed. The lsb of the PC is hardwired to 0
Stack Pointer (SP) - The stack is heavily used for temporary variables,passing parameters to subroutines and returning the result, particularly for compiled languages. The stack pointer holds the address of the top of the stack. The lsb of the stack pointer is hardwired to 0 in the MSP430, which guarantees that it always points to valid words.
The remaining 12 registers R4–R15 have no dedicated purpose and may be used as generalworking registers. They may be used for either data or addresses because both are 16-bitvalues, which simplifies the operation significantly.
Double operand (Format I): Arithmetic and logical operations with two operandssuch as add.w src, dst. accumulator-based architectures, where an accumulator or working register is used automatically as the destination and one operand.
Single operand (Format II): instructions for control or to manipulate a single operand.
Jumps: The jump to the destination rather than its absolute address, in other words theoffset that must be added to the program counter.
The “return from interrupt” instruction reti is unique in requiring no operands. Thiswould usually be described as inherent addressing but TI classifies it as Format II without data.
This uses one or two of the registers in the CPU. It is the most straightforward addressingmode and is available for both source and destination.
The registers are specified in the instruction word; no further data are needed. It is alsothe fastest mode and this instruction takes only 1 cycle. Any of the 16 registers can be usedfor either source or destination.
For byte instructions,
Operands are taken from the lower byte; the upper byte is not affected.
The result is written to the lower byte of the register and the upper byte is cleared.
The upper byte of a register in the CPU cannot be used as a source. If this is needed, the2 bytes in a word must first be swapped with swpb.
Shown by the symbol @ in front of aregister with a + sign after it, such as @R5+. It uses the value in R5 as a pointer andautomatically increments it afterward by 1 if a byte has been fetched or by 2 for a word.
Suppose that R5 contains the value 4,
A word is loaded from address 4 into R6 and the value in R5 is incremented to 6 because aword (2 bytes) was fetched.
Autoincrement is usually called postincrement addressing because many processorshave a complementary predecrement addressing modebut theMSP430 does not.
An important feature of the addressing modes is that all operations on the first address arefully completed before the second address is evaluated.
The move itself might be done by a line,
Suppose that R5 initially contains the value 4. The contents of address 4 is readand R5 is double-incremented to 6 because a word is involved. The address forthe destination calculated as 0x0100 + 0x0006=0x0106. Thus a word is copied fromaddress 0x0004 to 0x0106; the offset is not just the value of 0x0100 used as the baseaddress for the destination. The compiler takes care of these details if you write inC, but you are on your own with assembly language.
The chosen values are frequentlyused in comparison, arithmetic, and logic operations and for masks to pick out bits 0–3.
Direct (register) addressing of R3/CG2 returns the value 0, so mov.w R3,R5clears R5. Similarly, mov.w @R2,R5 uses indirect addressing on R2/SR/CG1, whichreturns the value 8 and this will be stored in R5.
These constants are combined with many of the 27 native instructions to provide a further24 emulated instructions.
Both br and call can use the full range of addressing modes for a source.
The most common use of call is for a subroutine that begins at a particularlabel. This label is translated by the assembler to the address of the first instruction in thesubroutine: direct addressing. This is the value that should be loaded into the PC to call thesubroutine and is therefore like immediate data. It must consequently be given the prefix #like any other immediate value. For example, call #DelayTenths.
Jump instructions useoffsets rather than full addresses and the compiler or assemblercalculates theseautomatically.
jmp fits in a single word, including the offset, but its range is limited to about±1KB from the current location.
br can go anywhere in the address space and use any addressing mode but isslower and requires an extra word of program storage.
The symbol $ stands for the current value ofthe program counter in the assembler so jmp $ is a concise way of getting an empty,infinite loop.
The conditional jumps are the “decision-making” instructions and test certain bits orcombinations in the status register. It is not possible to jump according to the value of anyother bits in SR or those in any other register. Typically a bit test instruction bit is used todetect the bit(s) of interest and set up the flags in SR before a jump.