There is a very nice IDE for programming and simulating the Xilinx PicoBlaze available for free from Macromedia: pBlazIDE. It's available in http://www.mediatronix.com/pBlazeIDE.htm.
There are some slight differences from the original kcpsm3 assembler, but the IDE can import original kcpsm3 code.
I tried it and really liked it, but I had some problems when I tried to JTAG-download the program to the BRAM. pBlazIDE has a Settings/JTAG form for introducing the JTAG chain data; there is also a JTAG-download enabled ROM template in http://www.mediatronix.com/Templates.htm.
But unfortunately I could not figure out how to actually assemble and download the program to the FPGA BRAM.
I tried to get some help, but as it didn´t come, I found my own workaround.
The workaround
_______________
I use the EXEC directive in the source file to invoke a batch file.
###### *.psm ######
; ------------------------------------------------------------------------------
; Code generation to VHDL file
; ------------------------------------------------------------------------------
VHDL "jtag_loader_rom_form.vhd", "pblaze3_prog.vhd", "pblaze3_prog"
; ------------------------------------------------------------------------------
; Code generation to MEM file for use of JTAG loader
; ------------------------------------------------------------------------------
MEM "pblaze3_prog.mem"
EXEC "jtag_load.cmd"
@ First step:
The ROM template for JTAG configuration available in the mediatronix site ("ROM_blank_JTAG.vhd") did not work for me, and therefore I used the one provided in the PicoBlaze distribution ("jtag_loader_rom_form.vhd").
@ Second step: generate a .HEX file for input to the "standard" flow
The batch file which is listed below performs four steps. The last 3 are the same as the "standard procedure" when using kcpsm3 assembler. The first one is to convert the .MEM file to a .HEX file, as I could not find any directive in pBlazIDE for doing so.
###### jtag_load.cmd ######
REM ----------------------------------------------------------------------------
REM
REM loads a pBlazIDE generated picoblaze program to BRAM via JTAG
REM use the MEM "pblaze3_prog.mem" directive in pBlazIDE
REM
REM ----------------------------------------------------------------------------
pblazide_mem2hex.exe pblaze3_prog.mem pblaze3_prog.hex
hex2svf pblaze3_prog.hex pblaze3_prog.svf
svf2xsvf -d -i pblaze3_prog.svf -o pblaze3_prog.xsvf
playxsvf pblaze3_prog.xsvf
REM pause
The conversion program is very simple C code:
###### pblazide_mem2hex.c ######
/*! $RCSfile$
* \file plazide_mem2hex.cpp
* \brief create a HEX file from a pBlazIDE generated MEM file, so as to be
* able to use dynamic JTAG loader
* \version $Revision$
* \author $Author$
* \date $Date$
*/
#include <stdio.h>
#include <stdlib.h>
typedef unsigned long uint32_t; ///< 32 bits unsigned
typedef signed long int32_t; ///< 32 bits signed
/*!
* \brief the program entry point
* \param[in] argc argument count
* \param[in] argv pointer to pointers to argument strings
* \return error code, 0 if ok
*/
int main( int32_t argc, char_t **argv )
{
int32_t ec = 0;
uint32_t addr;
uint32_t data[16];
char *fname_in, *fname_out;
argc--;
argv++;
if ( argc != 2 )
{
fprintf( stderr,
"Usage: pblazide_mem2hex *.mem *.hex\n"
" converts mem file to hex file\n" );
return -1;
}
fname_in = (char*) argv[0];
fname_out = (char*) argv[1];
printf( "converting MEM file to HEX file...\n" );
FILE *fin, *fout;
fin = fopen( fname_in, "r" );
fout = fopen( fname_out, "w" );
if ( fin != NULL && fout != NULL )
{ // successfully opened
// parse input file. format per line is @nnnn nnnnnnnn nnnnnnnn ... nnnnnnnn (16 cols of data)
while ( 17 == fscanf( fin, "@%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x",
&addr,
&data[0],
&data[1],
&data[2],
&data[3],
&data[4],
&data[5],
&data[6],
&data[7],
&data[8],
&data[9],
&data[10],
&data[11],
&data[12],
&data[13],
&data[14],
&data[15]
) )
{ // valid line: print HEX format : one value per line, in 5 chars
fprintf( fout, "%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n%05X\n",
data[0],
data[1],
data[2],
data[3],
data[4],
data[5],
data[6],
data[7],
data[8],
data[9],
data[10],
data[11],
data[12],
data[13],
data[14],
data[15]
);
}
fclose( fin );
fclose( fout );
}
else
{ // can't open files
printf( " ERROR opening file(s) %s and/or (%s)!\n", fname_in, fname_out );
ec = -1;
}
return ec;
}
/*
* $Log$
*
* End of $RCSfile$
*/
Conclusion
__________
I am able to use the wonderful pBlazIDE with the indispensable tool of automatic JTAG downloading; I achieve it with just a single button click.
However, I'm sure that pBlazIDE supports the same functionallity without this workaround. But I wasn´t able to figure it out.
If you have any experience on this please let us know.