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

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [rtl/] [vhdl/] [WISHBONE_FIR/] [cell.vhd] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 parrado
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
--The cell mult and sum
5
entity cell is
6
generic (WordWidth:integer:=24;--width signal of in/out
7
                        M:integer:=16;--width word of coefs
8
                        WordWidth_Q:integer:=4--width signal of Q
9
                        );
10
 
11
port(
12
 
13
signal_input :in std_logic_vector(WordWidth-1 downto 0);
14
filter_coef: in std_logic_vector(M-1 downto 0);
15
reg_input:in std_logic_vector(WordWidth-1 downto 0);
16
signal_output:out std_logic_vector(WordWidth-1 downto 0);
17
clk,reset,clear,enable:in std_logic;
18
Q :in std_logic_vector(WordWidth_Q-1 downto 0)
19
 
20
);
21
end entity;
22
 
23
architecture RTL of cell is
24
--The fullregister component
25
component fullregister is
26
 
27
        generic
28
        (
29
                N: integer
30
        );
31
 
32
        port
33
        (
34
                clk               : in std_logic;
35
                reset_n   : in std_logic;
36
                enable    : in std_logic;
37
                clear             : in std_logic;
38
                d                 : in std_logic_vector(N-1 downto 0);
39
                q                 : out std_logic_vector(N-1 downto 0)
40
 
41
        );
42
end component;
43
 
44
component Barrel_Shifter is
45
 
46
generic (
47
 
48
        WordWidth_in:integer;--width signal of in
49
        WordWidth_out:integer;--width signal of out
50
        WordWidth_Q:integer--width signal of Q
51
);
52
port(
53
signal_input :in std_logic_vector(WordWidth_in-1 downto 0);
54
signal_out :out std_logic_vector(WordWidth_out-1 downto 0);
55
Q :in std_logic_vector(WordWidth_Q-1 downto 0)
56
);
57
end component;
58
 
59
component Barrel_Shifter_left is
60
 
61
generic (
62
 
63
        WordWidth_in:integer;--width signal of in
64
        WordWidth_out:integer;--width signal of out
65
        WordWidth_Q:integer--width signal of Q
66
);
67
port(
68
signal_input :in std_logic_vector(WordWidth_in-1 downto 0);
69
signal_out :out std_logic_vector(WordWidth_out-1 downto 0);
70
Q :in std_logic_vector(WordWidth_Q-1 downto 0)
71
);
72
end component;
73
 
74
signal signal_output_aux: std_logic_vector(WordWidth-1 downto 0);
75
signal sum_mult: std_logic_vector(M+WordWidth-1 downto 0);
76
signal reg_input_aux,reg_output_aux:std_logic_vector(M+WordWidth-1 downto 0);
77
--signal sext:std_logic_vector(WordWidth-Q downto 0);
78
begin
79
 
80
--reg_input_aux(Q-1 downto 0)<= (others =>'0');
81
--sext<=(others=>reg_input(WordWidth-1));
82
--reg_input_aux(2*wordwidth downto Q)<=sext & reg_input; 
83
 
84
Barrel_Shifter2:Barrel_Shifter_left
85
 
86
generic map(
87
 
88
        WordWidth_in=>WordWidth,
89
        WordWidth_out=>WordWidth+M,
90
        WordWidth_Q=>WordWidth_Q
91
)
92
port map(
93
signal_input=>reg_input,
94
signal_out=>reg_input_aux,
95
Q=>Q
96
);
97
 
98
 
99
 
100
sum_mult<=std_logic_vector((signed(filter_coef)*signed(signal_input)) + signed(reg_input_aux));
101
 
102
mycell:fullregister
103
generic map(
104
                N=>M+WordWidth
105
)
106
        port map (
107
                clk=>clk,
108
                reset_n=>reset,
109
                enable=>enable,
110
                clear=>clear,
111
                d=>sum_mult,
112
                q=>reg_output_aux
113
                );
114
 
115
Barrel_Shifter1:Barrel_Shifter
116
 
117
generic map(
118
 
119
        WordWidth_in=>WordWidth+M,
120
        WordWidth_out=>WordWidth,
121
        WordWidth_Q=>WordWidth_Q
122
)
123
port map(
124
signal_input=>reg_output_aux,
125
signal_out=>signal_output_aux,
126
Q=>Q
127
);
128
 
129
 
130
signal_output<=signal_output_aux;
131
 
132
end architecture;

powered by: WebSVN 2.1.0

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