/* * LED_control_RDWR.v * Author: S. Klewin * * The light up of the RD and WR LEDs have to be slightly * different compared to the other LEDs. If there is some * communication with the device, the corresponding LED (RD or * WR) will flash and turn off again after a short time. So it is * easier to recognize if the write or read process is executed * properly. */ module LED_control_RDWR( input clk, input STROBE, input WRITE, output reg LED_RD, output reg LED_WR); reg STROBE_local; reg WRITE_local; reg RD_en; reg WR_en; reg RD_clr; reg WR_clr; wire [19:0] RD; wire [19:0] WR; time_counter_RDWR counter_RD( .clock(clk), .cnt_en(RD_en), .sclr(RD_clr), .q(RD)); time_counter_RDWR counter_WR( .clock(clk), .cnt_en(WR_en), .sclr(WR_clr), .q(WR)); initial begin LED_RD <= 1; LED_WR <= 1; RD_clr <= 1; WR_clr <= 1; RD_en <= 1; WR_en <= 1; end always @(posedge clk) begin STROBE_local <= STROBE; WRITE_local <= WRITE; RD_clr <= 0; WR_clr <= 0; if (STROBE_local) begin if (WRITE_local) begin WR_en <= 1; LED_WR <= 1; end else begin RD_en <= 1; LED_RD <= 1; end end if (RD == 20'b1111_1111_1111_1111_1111) begin LED_RD <= 0; RD_en <= 0; RD_clr <= 1; end if (WR == 20'b1111_1111_1111_1111_1111) begin LED_WR <= 0; WR_en <= 0; WR_clr <= 1; end end endmodule