In my previous column I introduced the PicoBlaze 8-bit soft core processor, and I questioned whether or not this was a real choice as a useful microprocessor/microcontroller inside an FPGA. (See: Why PicoBlaze? Introducing This 8-Bit Soft Processor Core .)
Well, talking about things is relatively easy, but I wanted to really use this core to see if it was any good. I'm sorry to admit that, when I write blogs or reviews, I don't always have sufficient time to really test every aspect of the item in question. In the case of All Programmable Planet, however, I want my contributions to provide an in-depth understanding of what is possible. On this basis, I really want to come to grips with the PicoBlaze, so as part of this article I'm going to compile the core for the very first time.
The first step is to locate any required resources. The obvious place to start is the Xilinx home page. You will need to sign up and register with them first (if you have not done so already) and then bounce over to the PicoBlaze Lounge. Here you will discover a number of different downloads that are available. These are chip-dependent, so look carefully at the list and download the ZIP file that is appropriate for your needs.
Once I had downloaded the correct ZIP file, I expanded it into my FPGA project working area so I could easily access the files and tools. Your download will include the core in both VHDL and Verilog (I'll be using the VHDL version). You will also have access to a JTAG tool and the PicoBlaze code compiler -- sorry, assembler! You will also see there are some files for a UART and some PDFs. Have a read of the Manual, but ignore the UART stuff for now, because I'll be covering this material in a future column. Also, another really good read is the Xilinx PicoBlaze User Guide.
Now, I have to be honest and say I got carried away and immediately attempted to compile the core into a project. My enthusiasm actually ended up slowing me down, however, because I did not have a ROM. It turns out that there isn't a ROM in the PicoBlaze code folder, because you are supposed to create this module yourself. Personally, I would recommend not writing one in full immediately, but instead create only a very basic one to start with.
Another point I have to warn you about is that fact that the Xilinx assembler will not work under Windows 7. Unfortunately, it seems the operating system will not let the assembler run due to Microsoft Signature / 64-bit machine issues, and Xilinx has not released a new assembler as yet.
There are a lot of workarounds available, and I wish you good luck with all of them, but I ended up using the OpenPIC tool, which worked really well for me. OpenPIC is not just a command-line assembler; it's an IDE and simulator all-in-one. So I downloaded this and then entered and assembled the following simple program. This program waggles an output pin, which is as close to a blinky LED as I could get!
OpenPIC is easy to use. I'd already copied the original PicoBlaze VHDL files into a new PicoBlaze project folder, so as soon as I generated my ROM file, which I called "prog_rom.vhd," I copied this over into my PicoBlaze folder.
This meant that when I re-started the ISE and generated a project, I had to bring in three files: "embedded_kcpsm3.vhd," "kcpsm3.vhd," and "prog_rom.vhd." The "embedded_kcpsm3" file is the top-level file that calls the ROM image ("prog_rom.vhd") and the main PicoBlaze soft core ("kcpsm3.vhd"). As far as I am concerned, this organization is a good idea because it allows you to maintain a simple block-level view of the core and its associated ROM.
Once in the project, and having set the "embedded_kcpsm3" file as the top-level in the hierarchy, all I had to do was instruct the ISE to perform the compilation. I have to say that things really were just this easy! I did receive a number of warnings, but I'm not worried about those at this stage -- the important point as far as I'm concerned is that there were no errors.
So, my next challenge is to add some RAM and then test my core in a real FPGA to see if I can manage to get a LED to blink. Watch this space...