always@(posedge SW1_LED_CLK0)
begin
if(SYS_Reset == 1'b0 || Software_Reset_OUT == 1'b0)
begin
Link48 <= 2'b0;
Link49 <= 2'b0;
state <= IDLE;
cycle0 <= 8'b0;
end
else
begin
if(SW1_LED_STB0==0)
begin
case(state)
IDLE:
if(SW1_LED_CLK0==1)
state<=HIGH;
else
state <= IDLE;
HIGH:
if(SW1_LED_CLK0==0)
state<=LOW;
else
state <= IDLE;
LOW:
if(SW1_LED_CLK0==1)
begin
state <= IDLE;
case(cycle0)
8'b0:
Link48<=SW1_LED_Data0;
8'b1:
Link48<=SW1_LED_Data0;
8'b10:
Link49<=SW1_LED_Data0;
8'b11:
Link49<=SW1_LED_Data0;
endcase
end
else
state <= LOW;
default:
state <= IDLE;
endcase
end
else
cycle0 <= 0;
end
end