-
Notifications
You must be signed in to change notification settings - Fork 0
/
FILTER.v
executable file
·75 lines (67 loc) · 1.58 KB
/
FILTER.v
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
module FILTER (
iCLK,
iRST_N,
iDATA_A,
iDATA_B,
ODATA_A,
ODATA_B
);
input iCLK;
input iRST_N;
input iDATA_A;
input iDATA_B;
output reg ODATA_A;
output reg ODATA_B;
reg [15:0] FILTER_CLK_DIV;
reg FILTER_CLK;
// Clock Setting
parameter CLK_Freq = 50000000; // 50 MHz
parameter FILTER_Freq = 15000; // 15 KHz
///////////////////// FILTER Clock ////////////////////////
always@(posedge iCLK or negedge iRST_N)
begin
if(!iRST_N)
begin
FILTER_CLK <= 0;
FILTER_CLK_DIV <= 0;
end
else
begin
if( FILTER_CLK_DIV < (CLK_Freq/FILTER_Freq/8) )
FILTER_CLK_DIV <= FILTER_CLK_DIV+1;
else
begin
FILTER_CLK_DIV <= 0;
FILTER_CLK <= ~FILTER_CLK;
end
end
end
always@(posedge FILTER_CLK or negedge iRST_N)
begin
if(!iRST_N)
begin
ODATA_A <= 0;
end
else
begin
if(iDATA_A)
ODATA_A <= 1;
else
ODATA_A <= 0;
end
end
always@(posedge FILTER_CLK or negedge iRST_N)
begin
if(!iRST_N)
begin
ODATA_B <= 0;
end
else
begin
if(iDATA_B)
ODATA_B <= 1;
else
ODATA_B <= 0;
end
end
endmodule