Xilinx UG129 Answering Machine User Manual


 
PicoBlaze 8-bit Embedded Microcontroller www.xilinx.com 55
UG129 (v1.1.2) June 24, 2008
OUTPUT Operations
R
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.
Figure 6-7: Simple Address Decoding for Designs with Few Output Destinations
Figure 6-8: Use CONSTANT Directives to Declare Output Port Addresses
IN_PORT[7:0] OUT_PORT[7:0]
PORT_ID[7:0]
READ_STROBE
WRITE_STROBE
PicoBlaze Microcontroller
[0]
EN
DQ
PORT_A
[1]
EN
DQ
PORT_B
[2]
EN
DQ
PORT_C
UG129_c6_07_052004
; 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