For details on programming the FPGA with Xilinx ISE and SDK, see youtube video at beginning of page.
Verilog code (top.v)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module top( | |
input clk_fpga, | |
input reset, | |
input rx, | |
output tx, | |
input [7:0] switch, | |
output [7:0] leds | |
); | |
microblaze_mcs mcs_0 ( | |
.Clk(clk_fpga), // input Clk | |
.Reset(reset), // input Reset | |
.UART_Rx(rx), // input UART_Rx | |
.UART_Tx(tx), // output UART_Tx | |
.GPO1(leds), // output [7 : 0] GPO1 | |
.GPI1(switch), // input [7 : 0] GPI1 | |
.GPI1_Interrupt() // output GPI1_Interrupt | |
); | |
endmodule |
C code for microblaze core hello_world
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "platform.h" | |
#include "xparameters.h" | |
#include "xiomodule.h" | |
void print(char *str); | |
int main() | |
{ | |
init_platform(); | |
u32 data; | |
XIOModule gpi; | |
XIOModule gpo; | |
print("Hello World\n\r"); | |
data = XIOModule_Initialize(&gpi, XPAR_IOMODULE_0_DEVICE_ID); | |
data = XIOModule_Start(&gpi); | |
data = XIOModule_Initialize(&gpo, XPAR_IOMODULE_0_DEVICE_ID); | |
data = XIOModule_Start(&gpo); | |
while (1) | |
{ | |
print("Hello World\n\r"); | |
data = XIOModule_DiscreteRead(&gpi, 1); | |
XIOModule_DiscreteWrite(&gpo, 1, data); | |
} | |
cleanup_platform(); | |
return 0; | |
} |