Microblaze MCS Hardware and Software Tutorial

The Microblaze is a Soft microprocessor core designed for Xilinx FPGAs from Xilinx. As a soft-core processor, MicroBlaze is implemented entirely in the general-purpose memory and logic fabric of Xilinx FPGAs. It is popular and flexible as well as easy to implement as well as to develop software for it.

This tutorial is about the Microcontroller version of Microblaze, the little brother of the processor with the same name. While less flexible, it can perform very well without the hassle of a full fledge processor.

Xilinx provides the Software Development Kit (SDK) to develop software applications, compile and download to the FPGA with the same standard FPGA programming cable.

Operating systems like Linux or the Xilinx-provided Xilkernel are also available to base the software upon, but we will not deal with OSes in this tutorial!

 

Tutorial road map. What is needed. what will I learn?

For this tutorial you will need:

  • An SP605 board, its power supply and two USB cables (A - mini B)
  • Xilinx PlanAhead and Xilinx SDK
  • A communications program like Hyperterminal, PuTTY, TeraTerm, etc.

 

And you will learn:

  • How to create and configure a Microblaze MCS IP
  • (Bonus) How to create and configure a PLL to change the clock frequency
  • How to set up constraints for this project
  • How to create a top HDL file to connect the MCS to the external World
  • How to bind the microcntroller memory to the configuration file
  • How to create a software project with its Board Support Package
  • How to create and use interrupts
  • How to download configuration and code into the SP605

 

Start!

Launch your PlanAhead. I'm using v14.7 but you may find your way with slightly different ones.
﷯
Click on Create New Project. Click Next and type MicroblazeTutorial as Project name and set the Project location to C:\Akteevy:
﷯
Click Next. On the next screen leave the option RTL project selected and tick Do not specify sources at this time.
﷯
Click Next. Now on the Default Part screen, click on Boards, in Family select Spartan-6 then select the Spartan-6 SP605 Evaluation Platform:
﷯
Click Next. Review the summary and click Finish. You have just started the project:
﷯
As this project is done in VHDL let's change the project settings to that language. Click on Project Settings in the Project Manager and change the Target Language to VHDL:
﷯
Click OK. Now you will add a constraints file and customize it for this project. Constraints files have essential information to bind each signal to the right pin in the physical circuit. They also specify the I/O standard for each pin and other directions for the synthesis.
Being the SP605 board provided by Xilinx they also provide a starting constraints file (can be found here). Download the zip file, extract the file SP605_Master_UCF.txt and copy it to our project folder C:\Akteevy\MicroblazeTutorial. Rename it as constraints.ucf (ucf is the standard extension for Xilinx constraints files).
Go back to PlanAhead and Click File > Add Sources (or ALT + A) so the Add Sources window pops up:
﷯
Select the Add or Create Constraints option if it wasn’t and click Next. Then click on the Add Files button and browse for the file you just copied.
﷯
Click OK. It will be added to the project. Leave the option Copy constraints files into the Project ticked.
﷯
Click Finish then check in the Sources panel that it has been added. Double click on it to open and edit it.
﷯
In the constraints file, delete all the signals we won’t use in this tutorial and leave just these: NET "CPU_RESET" LOC = "H8"; ## 2 on SW6 pushbutton (active-high)
##
NET "GPIO_BUTTON0" LOC = "F3"; ## 2 on SW4 pushbutton (active-high)
NET "GPIO_BUTTON1" LOC = "G6"; ## 2 on SW7 pushbutton (active-high)
NET "GPIO_BUTTON2" LOC = "F5"; ## 2 on SW5 pushbutton (active-high)
NET "GPIO_BUTTON3" LOC = "C1"; ## 2 on SW8 pushbutton (active-high)
##
NET "GPIO_LED_0" LOC = "D17"; ## 2 on DS3 LED
NET "GPIO_LED_1" LOC = "AB4"; ## 2 on DS4 LED
NET "GPIO_LED_2" LOC = "D21"; ## 2 on DS5 LED
NET "GPIO_LED_3" LOC = "W15"; ## 2 on DS6 LED
##
NET "USB_1_RX" LOC = "B21"; ##
NET "USB_1_TX" LOC = "H17"; ##
##
NET "USER_CLOCK" LOC = "AB13"; ## The sign ‘##’ starts a comment, use them for your notes. So our microblaze will interact with the outer World via the following pins:
- The four pushbuttons GPIO_BUTTON0 to GPIO_BUTTON3 as inputs
- The four LEDs GPIO_LED_0 to GPIO_LED_3 as outputs
- The reset button CPU_RESET.
- The clock from the 27 MHz crystal

Our commitments:

  • Deliver value
  • Be excellent
  • Outperform

Contact us:

Phone: +44 (0) 7462 148 989

E-mail:

Address: Galloway close,

RG22 6SX Basingstoke, UK