Xilinx UG129 Answering Machine User Manual


 
76 www.xilinx.com PicoBlaze 8-bit Embedded Microcontroller
UG129 (v1.1.2) June 24, 2008
Chapter 11: Assembler Directives
R
Defining Constants
Similar to renaming registers, assign names to constant values. By defining names for
constants, it is easier to understand and document the PicoBlaze code rather than using the
constant values in the code. Similarly, assigning names to registers and constants
simplifies code maintenance. Updating the value assigned to a constant is easier if the
constant is declared just once rather than searching for each occurrence in the application
code.
Table 11-3 shows how to define a constant called myconstant and assign the value 80
hexadecimal. Both KCPSM3 and pBlazIDE formats are shown.
Naming the Program ROM Output File
The PicoBlaze assembler generates object code and formats the results for some form of
internal memory within the FPGA. In general, the internal memory is block RAM, as
described in Chapter 7, “Instruction Storage Configurations.”
KCPSM3
The output files from the KCPSM3 assembler are always named according to the source
program name. For example, an assembly program named myprog.psm produces output
files called myprog.vhd, myprog.v, etc. for the various output formats.
pBlazIDE
The pBlazIDE assembler provides a directive, using the keyword VHDL, to explicitly name
the target output file and the VHDL entity name, as shown in Figure 11-1. The
template.vhd file contains the VHDL template for the program ROM. The target.vhd
file is the output VHDL file, derived from the template.vhd file, which contains the
initialization values created by assembling the PicoBlaze code. Finally, entity_name is
the VHDL entity name used to name program ROM.
Defining I/O Ports (pBlazIDE)
To aid modeling and debugging of the interaction between the PicoBlaze microcontroller
and the remainder of the FPGA, the pBlazIDE assembler supports some additional
directives to describe and define I/O ports. These directives are particularly useful during
instruction set simulation, as shown in Figure 12-1.
Table 11-3: Assembler Directives to Name or Alias Registers
KCPSM3 pBlazIDE
CONSTANT myconstant, 80 myconstant EQU $80
Figure 11-1: pBlazIDE Directive to Name the VHDL Output File
VHDL "template.vhd", "target.vhd", "entity_name"