• 0

Basys 3 XDC clock usage


Go to solution Solved by JColvin,

Question

I'm learning how to generate clocks with XDC files, using the .xdc from the Basys 3 github repository as a starting point.

I'd like to change the clock to a very low frequency of 1 Hz, or once per second, so that a LED blinks on and off once a second.

The portion of the .xdc file that generates the clock looks like this:

## Clock signal
set_property PACKAGE_PIN W5 [get_ports clk]
set_property IOSTANDARD LVCMOS33 [get_ports clk]
create_clock -add -name sys_clk_pin -period 1000000000.00 [get_ports clk]

And the code for blinking the LED looks like this:

module oneclock (
    input clk,
    output led[15:0]
);
    assign led[0] = clk;
endmodule

I can synthesize, etc but the LED appears constantly lit, although dimmer than normal if I'm not mistaken. Is there a minimum to the generated clock? Apologies for the newbie question, any documentation or things to help me learn would be greatly appreciated.

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
  • Solution

Hi @White Horse Software,

A couple of things. The first is that you don't actually create a clock within the xdc (despite the naming convention of the "create_clock" constraint); it just formally defines the existing clock on the board so that the tools can properly handle the design. You will need to keep this create_clock as defined in the Basys 3 xdc (available here: https://github.com/Digilent/digilent-xdc/blob/master/Basys-3-Master.xdc).

What you can do though is create a counter and clock divider to update the state of the LED after a set number of clock cycles. How you might do this is explained more here: https://learn.digilentinc.com/Documents/262.

Let me know if you have any questions about this.

Thanks,
JColvin

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now