blob: 1324afb15defaa9ee81b3f417e3fb463005882b4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
`timescale 1ns / 1ps
module eim_indicator
(
sys_clk, sys_rst,
eim_active,
led_out
);
//
// Ports
//
input wire sys_clk;
input wire sys_rst;
input wire eim_active;
output wire led_out;
//
// Parameters
//
localparam CNT_BITS = 24; // led will be dim for 2**(24-1) = 8388608 ticks, which is ~100 ms @ 80 MHz.
//
// Counter
//
reg [CNT_BITS-1:0] cnt;
always @(posedge sys_clk)
//
if (sys_rst) cnt <= {CNT_BITS{1'b0}};
else if (cnt > {CNT_BITS{1'b0}}) cnt <= cnt - 1'b1;
else if (eim_active) cnt <= {CNT_BITS{1'b1}};
assign led_out = ~cnt[CNT_BITS-1];
endmodule
|