Stack Exchange
Push button link with blink LED
I'm very new to HDL coding. I'm using Xilinx verilog for HDL coding. 
I'm trying to implement a push btn to activate the LED blinking code below and when button is released, blinking stops. Below is the blinking LED code
`timescale 1ns / 1ps
module blinkyslow(
    input CLOCK, SW,
    output LED
    );
    reg [24:0] COUNT = 25'b0000000000000000000000000;
    reg LED=1;
    always @(posedge CLOCK) begin
    COUNT <= COUNT + 1;
    LED <= (COUNT == 25'b0000000000000000000000000)?~LED:LED;
    end
endmodule

I'm using basys 3 board and i'm trying to link variable SW as the switch 

Is there a question?

What is the problem, you are facing?

You can use this code: 
`timescale 1ns / 1ps  
module blinkyslow(  
    input CLOCK, SW,reset,  
    output reg LED  
    );  
    reg [24:0] COUNT;  
    always @(posedge CLOCK) begin  
      if ( reset ==1'b1)  
        LED <= 1'b0;
        COUNT <= 0;
      else  
        begin  
    COUNT <= COUNT + 1;  
    LED <= SW & ((COUNT == 25'b0)?~LED:LED);  
        end  
      end  
endmodule  

Since the always block is only sensitive to the rising edge of the CLOCK signal, the reset signal is a synchronous reset.

Please format your code and describe what it is doing.

this worked perfectly fine, what I do not understand is "if (reset == 1'b1) " part. I set my constraints of reset to a push button.
So what I'm guessing is since I'm not pressing on the push button therefore it is open circuit and its always returning a "1" therefore my LED doesnt light up.
right?

it's very simple. before reseting the circuit, LED has a unknown value ( 1'bx). if you want to use this circuit, you should press "reset" button. It's supposed that the "reset" is ACTIVE_HIGH with pull down structure.

For example, you can implement it by having the counter increment only if the button is pressed.
(Strictly speaking, this is not good because if COUNT stays zero, LED will be toggled at evely clock. Toggling LED only if the button is pressed will solve this)
`timescale 1ns / 1ps
module blinkyslow(
    input CLOCK, SW,
    output LED
    );
    reg [24:0] COUNT = 25'b0000000000000000000000000;
    reg LED=1;
    always @(posedge CLOCK) begin
        if (SW) begin
            COUNT <= COUNT + 1;
            LED <= (COUNT == 25'b0000000000000000000000000)?~LED:LED;
        end
    end
endmodule

(not tested, assuming SW = 1 means the switch on the board is pressed)

@Nicholas Chan. In your original code, you have defined the following line not in initial block. Hence, LED is hardwired to zero.
reg LED=1;
so either define a reset signal for LED and COUNT (as in earlier answer )or you can try using the following code using initial block
timescale 1ns / 1ps
module blinkyslow(
    input CLOCK, SW,
    output LED
    );
    initial:begin
        reg [24:0] COUNT = 25'b0000000000000000000000000;
        reg LED=1;
    end
    always @(posedge CLOCK) begin
    COUNT <= COUNT + 1;
    LED <= (COUNT == 25'b0000000000000000000000000)?~LED:LED;
    end
endmodule
