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
| module band_pass_filter(
input clk,
input reset,
input in_strobe,
input out_strobe,
input [31:0] Xinput,
output reg [31:0] Youtput
);
wire [31:0] out_FIFO; // to store and split the signal as inphase,quadrant
wire is_full, is_empty;
// declaring input inphase and quadrature components
wire signed [15:0] i_input=out_FIFO[31:16];
wire signed [15:0] q_input=out_FIFO[15:0];
// declaring output inphase and quadrature components
wire signed [31:0] i_output;
wire signed [31:0] q_output;
reg clock_enable;
reg s_clr;
fifo_bpf fifo_generator (
.rst(reset), // input rst
.wr_clk(clk), // input wr_clk
.rd_clk(clk), // input rd_clk
.din(Xinput), // input [31 : 0] din
.wr_en(1'b1), // input wr_en
.rd_en(1'b1), // input rd_en
.dout(out_FIFO), // output [31 : 0] dout
.full(is_full), // output full
.empty(is_empty) // output empty
);
fircompiler my_fir_compiler (
.sclr(s_clr), // input sclr
.clk(clk), // input clk
.ce(clock_enable), // input ce
.rfd(1'b1), // output rfd
.rdy(1'b1), // output rdy
.din(i_input), // input [15 : 0] din
.dout(i_output)); // output [32 : 0] dout
fircompiler_q my_fir_compiler_q (
.sclr(s_clr), // input sclr
.clk(clk), // input clk
.ce(clock_enable), // input ce
.rfd(1'b1), // output rfd
.rdy(1'b1), // output rdy
.din(q_input), // input [15 : 0] din
.dout(q_output)); // output [32 : 0] dout
always @(posedge clk) begin
if(reset) begin
Youtput <= 0;
end
else if (out_strobe) begin
Youtput <= {i_output[30:15], q_output[30:15]};
clock_enable <= 1;
s_clr <= 1;
end
end
endmodule |