FPGA Center



 * Project Definition

 * Create A New Project (1)

 * Create A New Project (2)

 * Add GPIO to the System

 * Pin Assignment

  * Download To FPGA

Project Definition

In this example we will cerate a soft processor using Xilinx Platform Studio  software. We will program the processor with C language and finally we will download the processor to FPGA on the development board.

What will we do in this example

Project Introduction

Before begining the project, letÔÇÖs take a quick look at MicroBlaze and its tools.

MikroBlaze

MicroBlaze is a virtual processor that is constructed by combining the blocks called cores in Xilinx FPGAs. Because MicroBlaze is a virtual processor , It can be created more than one processor in a FPGA and it can also be added any number of core to the processor .

Processor is created in Xilinx Platform Studio Software.The processor design is automotically created by using (BBW) Base System Builder Wizard In Xilinx Platform Studio

Furthermore a processor which is creaded in XPS can be added to any project in ISE and can be simulated it by using ModelSim or ISE Simulator.  

C Program

We will write a simple C program. C language is used for programing Microblaze has includes special C commands belongs to MicroBlaze's cores in addition to the conventional C language. In this example we will use only a few commands of GPIOs

The C program includes a simple binary counter. We will define two IO variables named led and button. Led variable provide the connection between the counter to 8 led  placed on board for showing the counter value. The button which is connected to a external switch on board increases or decreases the counting speed of counter.

#include<xparameters.h>
#include<xgpio.h>

int main()
{
    XGpio led, button; // two variables are defined named led and button
    volatile long int delay;// defined a variable for delay
   long int ust_limit;
   int i=0;


XGpio_Initialize(&led, XPAR_LEDS_DEVICE_ID);
XGpio_SetDataDirection(&led,1,0); // set Leds as output ports
XGpio_Initialize(&button, XPAR_BUTTON_DEVICE_ID);
XGpio_SetDataDirection(&button,1,1); //set button as input port 

while(1)
{
     for(i=0;i<255;i++)
        {
              if(XGpio_DiscreteRead(&button, 1)==1)
                     ust_limit=600000;
              else
                     ust_limit=999999;
             XGpio_DiscreteWrite(&led, 1, i);
             for(delay=0;delay<ust_limit;delay++){};

}
}
}

                                                                                                                                                                                  Vhdl_Code

 

Home | Fpga | VHDL | VHDL Dictionary | Digital Design | Simulation | PCB | Examples | Contact Us
Copyright © 2010 - 2013 FPGAcenter. All Rights Reserved.