Академический Документы
Профессиональный Документы
Культура Документы
A KISS Example
Consider the following (pretty minimal) PicoBlazebased system:
KCPSM3 (PicoBlaze)
Switches
IN_PORT[7:0]
INTERRUPT
RESET
50MHz
CLK
OUT_PORT[7:0]
PORT_ID[7:0]
READ_STROBE
WRITE_STROBE
INTERRUPT_ACK
INSTRUCTION[17:0]
LEDs
ADDRESS[9:0]
Program ROM
ADDRESS[9:0]
INSTRUCTION[17:0]
CLK
http://www.xilinx.com/ipcenter/processor_central/picoblaze/picoblaze_user_resources.htm
Instantiating a PicoBlaze
The PicoBlaze is provided as a set of VHDL
files.
0);
0);
0);
0);
0);
component led_test
port (
address
: in std_logic_vector( 9 downto 0);
instruction : out std_logic_vector(17 downto 0);
clk
: in std_logic
);
end component;
ISE Behavior
Before saving, just the
model being developed
is shown.
After saving, we see
placeholders for the
components:
PicoBlaze
Program ROM
Almost Done
Weve now added the
PicoBlaze source files
to the project.
Next, we need to write
and compile the
assembly code that the
PicoBlaze will execute.
Compiler Flow
LED_TEST.PSM
Assembly
Source
Code
PicoBlaze
Assembler
Other
Files
KCPSM3.EXE
VHDL
ROM
File
LED_TEST.VHD
Add to
List of
Synthesis
Modules
Adding a UART
Similarly, we can add a simple UART to our
design to make a system that can
communicate with a PC using RS-232.
For this example, well just include the
transmit half of the UART.
Adding the receive side of the UART is done
in a similar way.
System Schematic
UART_TX
Divide by
325
en_16_x_baud
serial_out
S3-Pin 13
TX
data_in
write_buffer
buffer_full
reset_buffer
clk
buffer_half_full
KCPSM3 (PicoBlaze)
IN_PORT[7:0]
INTERRUPT
RESET
50MHz
CLK
OUT_PORT[7:0]
PORT_ID[7:0]
READ_STROBE
WRITE_STROBE
INTERRUPT_ACK
INSTRUCTION[17:0]
ADDRESS[9:0]
Program ROM
ADDRESS[9:0]
INSTRUCTION[17:0]
CLK
tx_uart
kcuart
bbfifo_16x8
downto 0);
downto 0);
downto 0);
downto 0);
downto 0);
:
:
:
:
:
:
:
:
in
in
in
in
out
out
out
in
=>
=>
=>
=>
=>
=>
=>
=>
pb_out_data,
uart_write,
'0',
en_16_x_baud,
txd,
pb_inp_data(7),
pb_inp_data(0),
clk
;ASCII "E".
;Send character.
;ASCII "E".
;Send character.
;ASCII "3".
;Send character.
;ASCII "8".
;Send character.
;ASCII "1".
;Send character.
;ASCII "0".
;Send character.
;ASCII " ".
;Send character.
;ASCII "R".
;Send character.
;ASCII "u".
;Send character.
;ASCII "l".
;Send character.
;ASCII "e".
;Send character.
s1, 73
xmit
s1, 21
xmit
s1, 21
xmit
s1, 21
xmit
s1, 20
xmit
;ASCII "s".
;Send character.
;ASCII "!".
;Send character.
;ASCII "!".
;Send character.
;ASCII "!".
;Send character.
;ASCII " ".
;Send character.
JUMP start
; Routine to transmit data via RS-232
; First check UART status.
xmit:
INPUT s0, 00
;read uart status.
AND
s0, 80
;Buffer full mask.
JUMP NZ, xmit
;Poll if buffer is full.
; Buffer is not full, transmit byte in s1
OUTPUT s1, 00
;Ship byte.
RETURN