OUTPUT Operations

R

PicoBlaze Microcontroller

IN_PORT[7:0] OUT_PORT[7:0]

PORT_ID[7:0]

READ_STROBE

WRITE_STROBE

[2]

[1]

[0]

PORT_C

DQ

EN

PORT_B

DQ

EN

PORT_A

DQ

EN

UG129_c6_07_052004

Figure 6-7:Simple Address Decoding for Designs with Few Output Destinations

As shown in Figure 6-8, use CONSTANT directives in the program make the code readable and help ensure that the correct ports are decoded. Because the PORT_ID addresses use “one-hot” encoding, it is also possible to create a single address that incorporates all the individual addresses. This way, the PicoBlaze microcontroller can send a broadcast message to all of the output destinations—in this case, a single instruction clears all destinations.

;Use CONSTANT declarations to define output port addresses CONSTANT Port_A, 01

CONSTANT Port_B, 02 CONSTANT Port_C, 04

CONSTANT Port_D, 08 CONSTANT Broadcast, FF

;Use assigned port names for better readability

OUTPUT s0, Port_A

OUTPUT s1, Port_B

OUTPUT s2, Port_C

OUTPUT s4, Port_D

;

;Send broadcast message to all addresses to clear all output registers LOAD s0, 00

OUTPUT s0, Broadcast

Figure 6-8:Use CONSTANT Directives to Declare Output Port Addresses

PicoBlaze 8-bit Embedded Microcontroller

www.xilinx.com

55

UG129 (v1.1.2) June 24, 2008

Page 55
Image 55
Xilinx UG129 manual 8Use Constant Directives to Declare Output Port Addresses