OpenCores
URL https://opencores.org/ocsvn/lpffir/lpffir/trunk

Subversion Repositories lpffir

[/] [lpffir/] [trunk/] [rtl/] [lpffir_core.sv] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 vladimirar
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Low Pass Filter FIR IP Core                                 ////
4
////                                                              ////
5
////  This file is part of the LPFFIR project                     ////
6
////  https://opencores.org/projects/lpffir                       ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Implementation of LPFFIR IP core according to               ////
10
////  LPFFIR IP core specification document.                      ////
11
////                                                              ////
12
////  To Do:                                                      ////
13
////  -                                                           ////
14
////                                                              ////
15
////  Author:                                                     ////
16
////  - Vladimir Armstrong, vladimirarmstrong@opencores.org       ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19
////                                                              ////
20
//// Copyright (C) 2019 Authors and OPENCORES.ORG                 ////
21
////                                                              ////
22
//// This source file may be used and distributed without         ////
23
//// restriction provided that this copyright statement is not    ////
24
//// removed from the file and that any derivative work contains  ////
25
//// the original copyright notice and the associated disclaimer. ////
26
////                                                              ////
27
//// This source file is free software; you can redistribute it   ////
28
//// and/or modify it under the terms of the GNU Lesser General   ////
29
//// Public License as published by the Free Software Foundation; ////
30
//// either version 2.1 of the License, or (at your option) any   ////
31
//// later version.                                               ////
32
////                                                              ////
33
//// This source is distributed in the hope that it will be       ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36
//// PURPOSE.  See the GNU Lesser General Public License for more ////
37
//// details.                                                     ////
38
////                                                              ////
39
//// You should have received a copy of the GNU Lesser General    ////
40
//// Public License along with this source; if not, download it   ////
41
//// from http://www.opencores.org/lgpl.shtml                     ////
42
////                                                              ////
43
//////////////////////////////////////////////////////////////////////
44
 
45
module lpffir_core (
46 7 vladimirar
                    input               clk_i,
47
                    input               rstn_i,
48
                    input               en_i,
49
                    input [15:0]        x_i,
50
                    output logic [15:0] y_o
51
                    );
52 2 vladimirar
 
53 7 vladimirar
   reg [15:0]                           x1;
54
   reg [15:0]                           x2;
55
   reg [15:0]                           x3;
56
   reg [15:0]                           x4;
57
   reg [15:0]                           x5;
58 2 vladimirar
 
59 7 vladimirar
   logic [15:0]                         h0;
60
   logic [15:0]                         h1;
61
   logic [15:0]                         h2;
62
   logic [15:0]                         h01;
63 2 vladimirar
 
64 7 vladimirar
   logic                                co0;
65
   logic                                co1;
66
   logic                                co2;
67
   logic                                co3;
68
   logic                                co4;
69 2 vladimirar
 
70
   // Linear-phase FIR structure
71
   rca rca_inst0 (.a(x_i),.b(x5),.ci(0),.co(co0),.s(h0));
72
   rca rca_inst1 (.a(x1),.b(x4),.ci(0),.co(co1),.s(h1));
73
   rca rca_inst2 (.a(x2),.b(x3),.ci(0),.co(co2),.s(h2));
74
   rca rca_inst3 (.a(h0),.b(h1),.ci(0),.co(co3),.s(h01));
75
   rca rca_inst4 (.a(h01),.b(h2),.ci(0),.co(co4),.s(y_o));
76
 
77 7 vladimirar
   always_ff @(posedge clk_i or posedge rstn_i)
78
     if(!rstn_i)
79
       begin
80
          x1 <= 0;
81
          x2 <= 0;
82
          x3 <= 0;
83
          x4 <= 0;
84
          x5 <= 0;
85
       end
86
     else if (en_i)
87
       begin
88
          x1 <= x_i;
89
          x2 <= x1;
90
          x3 <= x2;
91
          x4 <= x3;
92
          x5 <= x4;
93
       end
94 2 vladimirar
 
95
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.