Saturday, August 20, 2016

FPGA design step by step using Zed board 1 - A simple project to use SW0 to control LED0

Lets start with a simplest example to use switch 0 to control LED 0 using Zedboard.

1. Create a new project of led_ctrl using vivado.

2. Find the SW0 and LD0 in master xdc file of Zedboard and create a constraint file accordingly below. And add the constraint to the project

# ----------------------------------------------------------------------------
# User LEDs - Bank 33
# ---------------------------------------------------------------------------- 
set_property PACKAGE_PIN T22 [get_ports {LD0}];  # "LD0"


# ----------------------------------------------------------------------------
# User DIP Switches - Bank 35
# ---------------------------------------------------------------------------- 
set_property PACKAGE_PIN F22 [get_ports {SW0}];  # "SW0"

set_property IOSTANDARD LVCMOS33 [get_ports {LD0}]
set_property IOSTANDARD LVCMOS33 [get_ports {SW0}]

The master xdc file for Zedboard can be downloaded at Ref[1]

3. Create a simple verilog file of led_ctrl.v with contents below and added to the project.

`timescale 1ns / 1ps
//led_ctrl.v

module led_ctrl(
       input wire SW0,
       output wire LD0
    );

assign LD0 = SW0;

endmodule

4. Run synthesis and implementation and generate bit file.
5. Download the bitfile to Zedboard.

After that, we can change SW0 positions to turn on and off LED0.

References
--------------
1. master XDC file for Zedboard,  http://zedboard.org/sites/default/files/documentations/zedboard_master_XDC_RevC_D_v3.zip

No comments:

Post a Comment