-
Notifications
You must be signed in to change notification settings - Fork 0
/
firc.sv
142 lines (116 loc) · 2.36 KB
/
firc.sv
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// Andres Gamboa
// EE 287 Project: FIR Filter
// Spring 2023
`include "fifo.sv"
`include "counter.sv"
`include "sr.sv"
`include "demux.sv"
module firc(
input signed Clk,
input signed Reset,
input signed PushIn,
output reg signed StopIn,
input signed [23:0] SampI,
input signed [23:0] SampQ,
input signed PushCoef,
input signed [4:0] CoefAddr,
input signed [26:0] CoefI,
input signed [26:0] CoefQ,
output reg signed PushOut,
output reg signed [31:0] FI,
output reg signed [31:0] FQ
);
wire signed Read;
wire signed [23:0] FifoOutI;
wire signed [23:0] FifoOutQ;
wire signed [26:0] Coef_Re [0:14];
wire signed [26:0] Coef_Img [0:14];
fifo fifo (
.Clk(Clk),
.Reset(Reset),
.PushIn(PushIn),
.StopIn(StopIn),
.DataInI(SampI),
.DataInQ(SampQ),
.FifoOutI(FifoOutI),
.FifoOutQ(FifoOutQ),
.Read(Read)
);
counter counter(
.Clk(Clk),
.Reset(Reset),
.StopIn(StopIn),
.Read(Read)
);
sr sr(
.Clk(Clk),
.Reset(Reset),
.Read(Read),
.FifoOutI(FifoOutI),
.FifoOutQ(FifoOutQ),
.DataOutI(FI),
.DataOutQ(FQ)
);
demux demux(
.Clk(Clk),
.Reset(Reset),
.PushCoef(PushCoef),
.CoefAddr(CoefAddr),
.CoefI(CoefI),
.CoefQ(CoefQ)
);
/*
reg signed [3:0] [23:0] FIFO_Re; // Packed Array
reg signed [2:0] WrPtr;
reg signed [2:0] Count, Counter;
reg signed Count_En;
always @(*) begin
if (Count_En) begin
if (Counter != 3'b100) Counter = Count + 1;
else Counter = 0; end
else begin
Counter = Counter;
end
end
// Counter
always @(posedge Clk or posedge Reset) begin
if (Reset) Count <= 0;
else Count <= #1 Counter;
end
// FIFO Write Pointer
always @(*) begin
case(WrPtr)
3'b001 : FIFO_Re[0] <= 24'hFFFFFF;
3'b010 : FIFO_Re[1] <= 24'hFFFFFF;
3'b011 : FIFO_Re[2] <= 24'hFFFFFF;
3'b100 : FIFO_Re[3] <= 24'hFFFFFF;
default : WrPtr <= 0;
endcase
end
always @(posedge Clk or posedge Reset) begin
if (Reset) begin
FIFO_Re <= 0;
WrPtr <= 0;
Count_En <= 0;
StopIn <= 0;
PushOut <= 0;
FI <= 0;
FQ <= 0; end
else begin
if (PushIn) begin WrPtr <= WrPtr + 1; end
Count_En <= 1;
StopIn <= 0; // Need to add final signals here with thewith the push in
PushOut <= 0;
FI <= 3;
FQ <= 7;
end
end
*/
/* // FIFO Controller
always @(*) begin
case(Cycle)
2'b10 : begin
// 4 deep
// needs to be the size of the bits
*/
endmodule : firc