Plasma
soft processor on the Spartan board
Overview
The Plasma processor is a public domain 32-bit soft processor
designed by Steve Rhoads which implements most of the MIPS
I (TM) instruction set. It contains a DDR SDRAM controller and a
UART core. Because it has the same instruction set as a MIPS
processor, it uses the same GNU toolchain. Additionally, a small
RTOS with a TCP/IP stack is available in the opencores.org
package, but it is not used here. The Plasma project overview is
available from the opencores.org
website
here.
The design provided here simply instantiates the CPU module, links it
to the LCD display. A small application is provided that initializes
the LCD display and writes a few characters to it.
The plasma will synthetise as is for the Spartan 3E Starter Kit board.
About this design
To use the LCD, it is necessary to connect the LCD pins to the
processor's GPIO out registers (this design only does LCD writes). This is done by simply adding the following
code in the architecture of the top level module:
LCD_D <= gpio0_out(14 downto 11);
LCD_RS <= gpio0_out(10);
LCD_RW <= gpio0_out(9);
LCD_E <= gpio0_out(8);
Provided as a tool in the Plasma package is a serial
communication program, ethermip, which dynamically loads a
program executable by the Plasma CPU in memory and then listens
on the serial interface, and additionally is also able to
support Ethernet traffic over UART. I found it problematic to
use as it will not run without WinPCAP or compile with GCC, so I
wrote another version (without the Ethernet capability) which
can be found
here.
The sample program
lcd_leds
initializes the LCD, writes a few characters to it, and also flashes
a few LEDS on the boards. It can be compiled with the following
addition in the plasma provided makefile:
lcd_leds:
$(AS_MIPS) -o boot.o boot.asm
$(GCC_MIPS) lcd_leds.c
$(GCC_MIPS) no_os.c
$(LD_MIPS) -Ttext 0x10000000 -eentry -Map test.map -s -N -o test.axf \
boot.o lcd_leds.o no_os.o
-$(DUMP_MIPS) --disassemble test.axf > test.lst
convert_bin.exe
$(CP) code.txt $(VHDL_DIR)
A few miscellaneous tips
C and assembler programs are compiled differently depending on
how the program will run. If the program is intended to be put
in RAM during synthesis, then the entry point specified will be
0. If the program is intended to be downloaded to DDR SDRAM
(with the plasma CPU running the bootldr application) then the
entry point must be specified as 0x100000000, which is the
memory entry point.
A program is put in RAM during
synthesis as described in this comment that can be found in the
plasma file ram_image.vhd:
-- Compile the MIPS C and assembly code into "test.axf".
-- Run convert.exe to change "test.axf" to "code.txt" which
-- will contain the hex values of the opcodes.
-- Next run "ram_image ram_xilinx.vhd code.txt ram_image.vhd",
-- to create the "ram_image.vhd" file that will have the opcodes
-- correctly placed inside the INIT_00 => strings.
-- Then include ram_image.vhd in the simulation/synthesis.
---------------------------------------------------------------------
In the makefile, look at the -Ttext option for the various test
programs that can be built in order to know how they are
supposed to run. "count" for example is compiled so as to be
put in ram_image.vhd, whereas "count2" is intented to be loaded
via the serial port when the plasma processor is synthetized with
the ram_image.vhd application "bootldr".
Design files
spartan_plasma.zip
Author:
<lsilvestri@psilv.net>
2008/03/19 10:54:00 AM