R

Chapter 11

Assembler Directives

Both the KCPSM3 and pBlazIDE assemblers include directives that provide advanced control.

Locating Code at a Specific Address

In some cases, application code must be assigned to a specific instruction address.

Examples include the code located at the reset vector, 0, and the interrupt vector, 3FF.

As an example, Table 11-1shows the PicoBlaze™ processor assembler directive to locate code at the interrupt vector for both the KCPSM3 and pBlazIDE formats.

Table 11-1:Assembler Directives to Locate Code

KCPSM3

pBlazIDE

ADDRESS 3FF

ORG $3FF

Naming or Aliasing Registers

The PicoBlaze microcontroller has 16 general-purpose registers named s0 through sF. To improve code clarity and to enable easy code re-use, re-name or alias the PicoBlaze register with a variable name. Naming registers also prevents unintended use of a register and the associated data corruption, both improving code quality and reducing debugging efforts.

Table 11-2shows how to alias a register, s5 in this case, to a variable name, myregname. Both KCPSM3 and pBlazIDE formats are shown.

Table 11-2:Assembler Directives to Name or Alias Registers

KCPSM3

pBlazIDE

NAMEREG s5, myregname

myregname EQU s5

In the KCPSM3 assembler, the NAMEREG directive is applied in-line with the code. Before the NAMEREG directive, the register is named using the ‘sX’ style. Following the directive, only the new name applies. It is also possible to rename a register again (i.e., NAMEREG old_regname, new_regname) and only the new name applies in the subsequent program lines.

PicoBlaze 8-bit Embedded Microcontroller

www.xilinx.com

75

UG129 (v1.1.2) June 24, 2008

Page 75
Image 75
Xilinx UG129 manual Assembler Directives, Locating Code at a Specific Address, Naming or Aliasing Registers