module my_wrapper(
input In0,
input In1,
input CLK_50MHz,
input ROT_A,
input ROT_B,
input ROT_CENTER,
output [7:0] LED_ctrl
);
//----------------------------------------------------- DCM-Modul ------------------------------------------------
wire CLK_DV; // divided clock
wire CLKIN_IBUFG;
wire CLK0; // unmodified 50 MHz DCM clock output
my_dcm dcm_inst
(
.CLKIN_IN(CLK_50MHz),
.CLKDV_OUT(CLK_DV),
.CLKIN_IBUFG_OUT(CLKIN_IBUFG),
.CLK0_OUT(CLK0)
);
//------------------------------------------------ Timer --------------------------------------------------------
wire timer_done;
my_timer timer_inst (
.clock(CLK_DV),
.reset(1'b1),
.timer_start(1'b1),
.timer_done(timer_done)
);
//----------------------------------------------------------------------------------------------------------------
parameter init_state = 2'b00;
parameter idle_state = 2'b01;
parameter led_state = 2'b10;
reg [1:0] state, state_next;
reg [7:0] LEDs_next, LEDs;
always @ (posedge CLK_DV) begin
LEDs <= LEDs_next;
state <= state_next;
end
always @ (state or timer_done or LEDs) begin
case(state)
init_state:
begin
state_next = idle_state;
LEDs_next = 8'b10101010; // new value
end
idle_state:
begin
state_next = idle_state;
LEDs_next = LEDs; // keep old value
end
endcase
end
assign LED_ctrl[0] = LEDs[0];
assign LED_ctrl[1] = LEDs[1];
assign LED_ctrl[2] = LEDs[2];
assign LED_ctrl[3] = LEDs[3];
assign LED_ctrl[4] = LEDs[4];
assign LED_ctrl[5] = LEDs[5];
assign LED_ctrl[6] = LEDs[6];
assign LED_ctrl[7] = LEDs[7];
endmodule