R

Appendix : Example Program Templates

pBlazIDE Syntax

Figure B-2provides a code template for creating PicoBlaze applications using the pBlazIDE assembler.

<name> EQU sX ; Rename register sX with <name>

<name> EQU $00 ; Define constant <name>, assign value

;name ROM output file generated by pBlazIDE assembler VHDL “template.vhd”, “target.vhd”, “entity_name”

<name> DSIN <port_id> ; Create input port, assign port address <name> DSOUT <port_id>; Create output port, assign port address <name> DSIO <port_id> ; Create readable output port,

; assign port address

ORG 0; Programs always start at reset vector 0

EINT

; If using interrupts, be sure to enable

 

;

the INTERRUPT input

BEGIN:

 

 

; <<< your code here >>>

 

JUMP BEGIN

; Embedded applications never end

ISR:

; An Interrupt Service Routine (ISR) is

 

;

required if using interrupts

 

; Interrupts are automatically disabled

 

;

when an interrupt is recognized

 

; Never re-enable interrupts during the ISR

RETI ENABLE

; Return from interrupt service routine

 

;

Use RETURNI DISABLE to leave interrupts

 

;

disabled

ORG $3FF

; Interrupt vector is located at highest

 

;

instruction address

JUMP ISR

; Jump to interrupt service routine, ISR

Figure B-2:PicoBlaze Application Program Template for KCPSM3 Assembler

90

www.xilinx.com

PicoBlaze 8-bit Embedded Microcontroller

 

 

UG129 (v1.1.2) June 24, 2008

Page 90
Image 90
Xilinx UG129 manual PBlazIDE Syntax, Appendix Example Program Templates