@@ -0,0 +1,38 | |||||
|
1 | --------------------------------------------------------------------- | |||
|
No newline at end of file | ||||
|
2 | library IEEE; | |||
|
No newline at end of file | ||||
|
3 | use IEEE.STD_LOGIC_1164.ALL; | |||
|
No newline at end of file | ||||
|
4 | use IEEE.numeric_std.all; | |||
|
No newline at end of file | ||||
|
5 | ||||
|
No newline at end of file | ||||
|
6 | use work.cic_utils.all; | |||
|
No newline at end of file | ||||
|
7 | ||||
|
No newline at end of file | ||||
|
8 | entity hc is | |||
|
No newline at end of file | ||||
|
9 | Port ( clk : in std_logic; | |||
|
No newline at end of file | ||||
|
10 | reset: in std_logic; | |||
|
No newline at end of file | ||||
|
11 | input : in std_logic_vector(FIXWIDTH-1 downto 0); | |||
|
No newline at end of file | ||||
|
12 | output : out std_logic_vector(FIXWIDTH-1 downto 0)); | |||
|
No newline at end of file | ||||
|
13 | end hc; | |||
|
No newline at end of file | ||||
|
14 | ||||
|
No newline at end of file | ||||
|
15 | architecture Behavioral of hc is | |||
|
No newline at end of file | ||||
|
16 | component hc_block | |||
|
No newline at end of file | ||||
|
17 | Port ( clk : in std_logic; | |||
|
No newline at end of file | ||||
|
18 | reset: in std_logic; | |||
|
No newline at end of file | ||||
|
19 | input : in std_logic_vector(FIXWIDTH-1 downto 0); | |||
|
No newline at end of file | ||||
|
20 | output : out std_logic_vector(FIXWIDTH-1 downto 0)); | |||
|
No newline at end of file | ||||
|
21 | end component; | |||
|
No newline at end of file | ||||
|
22 | ||||
|
No newline at end of file | ||||
|
23 | type filt_bus is array (0 to STAGES+1) of std_logic_vector(FIXWIDTH-1 downto 0); | |||
|
No newline at end of file | ||||
|
24 | signal s : filt_bus; | |||
|
No newline at end of file | ||||
|
25 | ||||
|
No newline at end of file | ||||
|
26 | begin | |||
|
No newline at end of file | ||||
|
27 | s(0) <= input; | |||
|
No newline at end of file | ||||
|
28 | output <= s(STAGES+1); | |||
|
No newline at end of file | ||||
|
29 | ||||
|
No newline at end of file | ||||
|
30 | compensation_filter: for i in 1 to STAGES+1 generate | |||
|
No newline at end of file | ||||
|
31 | begin | |||
|
No newline at end of file | ||||
|
32 | hc_filt_stage: component hc_block | |||
|
No newline at end of file | ||||
|
33 | --(clk,reset,input,output) | |||
|
No newline at end of file | ||||
|
34 | port map (clk,reset,s(i-1),s(i)); | |||
|
No newline at end of file | ||||
|
35 | ||||
|
No newline at end of file | ||||
|
36 | end generate compensation_filter; | |||
|
No newline at end of file | ||||
|
37 | ||||
|
No newline at end of file | ||||
|
38 | end Behavioral; No newline at end of file |
@@ -0,0 +1,40 | |||||
|
1 | --------------------------------------------------------------------- | |||
|
No newline at end of file | ||||
|
2 | library IEEE; | |||
|
No newline at end of file | ||||
|
3 | use IEEE.STD_LOGIC_1164.ALL; | |||
|
No newline at end of file | ||||
|
4 | use IEEE.numeric_std.all; | |||
|
No newline at end of file | ||||
|
5 | ||||
|
No newline at end of file | ||||
|
6 | use work.cic_utils.all; | |||
|
No newline at end of file | ||||
|
7 | ||||
|
No newline at end of file | ||||
|
8 | ||||
|
No newline at end of file | ||||
|
9 | entity hc_block is | |||
|
No newline at end of file | ||||
|
10 | Port ( clk : in std_logic; | |||
|
No newline at end of file | ||||
|
11 | reset: in std_logic; | |||
|
No newline at end of file | ||||
|
12 | input : in std_logic_vector(FIXWIDTH-1 downto 0); | |||
|
No newline at end of file | ||||
|
13 | output : out std_logic_vector(FIXWIDTH-1 downto 0)); | |||
|
No newline at end of file | ||||
|
14 | end hc_block; | |||
|
No newline at end of file | ||||
|
15 | ||||
|
No newline at end of file | ||||
|
16 | architecture Behavioral of hc_block is | |||
|
No newline at end of file | ||||
|
17 | signal s0,s1,s2,s3: std_logic_vector(FIXWIDTH-1 downto 0); | |||
|
No newline at end of file | ||||
|
18 | signal t0 : std_logic_vector(FIXWIDTH-1 downto 0); | |||
|
No newline at end of file | ||||
|
19 | constant A : integer := (-625*(2**MANTISSA_BITS))/10000; -- -2^-4 | |||
|
No newline at end of file | ||||
|
20 | constant B : integer := -18 * (2**MANTISSA_BITS); -- -(2^4 + 2) | |||
|
No newline at end of file | ||||
|
21 | begin | |||
|
No newline at end of file | ||||
|
22 | ||||
|
No newline at end of file | ||||
|
23 | process(clk,reset) | |||
|
No newline at end of file | ||||
|
24 | begin | |||
|
No newline at end of file | ||||
|
25 | if reset='1' then | |||
|
No newline at end of file | ||||
|
26 | s1 <= (others=>'0');--to_sfixed(0,s0); | |||
|
No newline at end of file | ||||
|
27 | s2 <= (others=>'0');--to_sfixed(0,s0); | |||
|
No newline at end of file | ||||
|
28 | elsif clk'event and clk='1' then | |||
|
No newline at end of file | ||||
|
29 | s2 <= s1; | |||
|
No newline at end of file | ||||
|
30 | s1 <= s0; | |||
|
No newline at end of file | ||||
|
31 | end if; | |||
|
No newline at end of file | ||||
|
32 | end process; | |||
|
No newline at end of file | ||||
|
33 | ||||
|
No newline at end of file | ||||
|
34 | s0 <= mul(input,to_fix(A)); | |||
|
No newline at end of file | ||||
|
35 | s3 <= mul(s1,to_fix(B)); | |||
|
No newline at end of file | ||||
|
36 | t0 <= add(s0,s2); | |||
|
No newline at end of file | ||||
|
37 | output <= add(t0,s3); | |||
|
No newline at end of file | ||||
|
38 | ||||
|
No newline at end of file | ||||
|
39 | end Behavioral; | |||
|
No newline at end of file | ||||
|
40 | No newline at end of file |
@@ -0,0 +1,75 | |||||
|
1 | -- test_hr Template | |||
|
No newline at end of file | ||||
|
2 | ||||
|
No newline at end of file | ||||
|
3 | LIBRARY ieee; | |||
|
No newline at end of file | ||||
|
4 | USE ieee.std_logic_1164.ALL; | |||
|
No newline at end of file | ||||
|
5 | USE ieee.numeric_std.ALL; | |||
|
No newline at end of file | ||||
|
6 | library IEEE_proposed; | |||
|
No newline at end of file | ||||
|
7 | use IEEE_proposed.fixed_pkg.all; | |||
|
No newline at end of file | ||||
|
8 | use work.cic_utils.all; | |||
|
No newline at end of file | ||||
|
9 | ||||
|
No newline at end of file | ||||
|
10 | ||||
|
No newline at end of file | ||||
|
11 | ENTITY test_hr IS | |||
|
No newline at end of file | ||||
|
12 | END test_hr; | |||
|
No newline at end of file | ||||
|
13 | ||||
|
No newline at end of file | ||||
|
14 | ARCHITECTURE behavior OF test_hr IS | |||
|
No newline at end of file | ||||
|
15 | ||||
|
No newline at end of file | ||||
|
16 | -- Component Declaration | |||
|
No newline at end of file | ||||
|
17 | COMPONENT Hr_block | |||
|
No newline at end of file | ||||
|
18 | Port ( input : in sfixed(NUMBER_BITS-1 downto MANTISSA_BITS); | |||
|
No newline at end of file | ||||
|
19 | outCa : out sfixed(NUMBER_BITS-1 downto MANTISSA_BITS); | |||
|
No newline at end of file | ||||
|
20 | outCb : out sfixed(NUMBER_BITS-1 downto MANTISSA_BITS); | |||
|
No newline at end of file | ||||
|
21 | clk : in std_logic; | |||
|
No newline at end of file | ||||
|
22 | ka : in integer range 0 to 18; | |||
|
No newline at end of file | ||||
|
23 | kb : in integer range 0 to 18); | |||
|
No newline at end of file | ||||
|
24 | END COMPONENT; | |||
|
No newline at end of file | ||||
|
25 | ||||
|
No newline at end of file | ||||
|
26 | signal input : sfixed(NUMBER_BITS-1 downto MANTISSA_BITS); | |||
|
No newline at end of file | ||||
|
27 | signal outCa : sfixed(NUMBER_BITS-1 downto MANTISSA_BITS); | |||
|
No newline at end of file | ||||
|
28 | signal outCb : sfixed(NUMBER_BITS-1 downto MANTISSA_BITS); | |||
|
No newline at end of file | ||||
|
29 | signal clk : std_logic; | |||
|
No newline at end of file | ||||
|
30 | signal ka : integer range 0 to 18; | |||
|
No newline at end of file | ||||
|
31 | signal kb : integer range 0 to 18; | |||
|
No newline at end of file | ||||
|
32 | ||||
|
No newline at end of file | ||||
|
33 | -- Clock period definitions | |||
|
No newline at end of file | ||||
|
34 | constant clk_period : time := 1 ms; | |||
|
No newline at end of file | ||||
|
35 | ||||
|
No newline at end of file | ||||
|
36 | BEGIN | |||
|
No newline at end of file | ||||
|
37 | ||||
|
No newline at end of file | ||||
|
38 | -- Component Instantiation | |||
|
No newline at end of file | ||||
|
39 | uut: Hr_block PORT MAP( | |||
|
No newline at end of file | ||||
|
40 | input => input, | |||
|
No newline at end of file | ||||
|
41 | outCa => outCa, | |||
|
No newline at end of file | ||||
|
42 | outCb => outCb, | |||
|
No newline at end of file | ||||
|
43 | clk => clk, | |||
|
No newline at end of file | ||||
|
44 | ka => ka, | |||
|
No newline at end of file | ||||
|
45 | kb => kb | |||
|
No newline at end of file | ||||
|
46 | ); | |||
|
No newline at end of file | ||||
|
47 | ||||
|
No newline at end of file | ||||
|
48 | kb <= 3; | |||
|
No newline at end of file | ||||
|
49 | ka <= 0; | |||
|
No newline at end of file | ||||
|
50 | ||||
|
No newline at end of file | ||||
|
51 | -- Clock process definitions | |||
|
No newline at end of file | ||||
|
52 | clk_process :process | |||
|
No newline at end of file | ||||
|
53 | begin | |||
|
No newline at end of file | ||||
|
54 | clk <= '1'; | |||
|
No newline at end of file | ||||
|
55 | wait for clk_period/2; | |||
|
No newline at end of file | ||||
|
56 | clk <= '0'; | |||
|
No newline at end of file | ||||
|
57 | wait for clk_period/2; | |||
|
No newline at end of file | ||||
|
58 | end process; | |||
|
No newline at end of file | ||||
|
59 | ||||
|
No newline at end of file | ||||
|
60 | ||||
|
No newline at end of file | ||||
|
61 | -- Test Bench Statements | |||
|
No newline at end of file | ||||
|
62 | tb : PROCESS | |||
|
No newline at end of file | ||||
|
63 | BEGIN | |||
|
No newline at end of file | ||||
|
64 | ||||
|
No newline at end of file | ||||
|
65 | -- hold reset state for 1 ms. | |||
|
No newline at end of file | ||||
|
66 | input <= to_sfixed(1,input); | |||
|
No newline at end of file | ||||
|
67 | wait for clk_period; | |||
|
No newline at end of file | ||||
|
68 | input <= to_sfixed(16,input); | |||
|
No newline at end of file | ||||
|
69 | wait for clk_period; | |||
|
No newline at end of file | ||||
|
70 | ||||
|
No newline at end of file | ||||
|
71 | wait; | |||
|
No newline at end of file | ||||
|
72 | END PROCESS tb; | |||
|
No newline at end of file | ||||
|
73 | -- End Test Bench | |||
|
No newline at end of file | ||||
|
74 | ||||
|
No newline at end of file | ||||
|
75 | END; No newline at end of file |
@@ -0,0 +1,57 | |||||
|
1 | ---------------------------------------------------------------------------------- | |||
|
No newline at end of file | ||||
|
2 | -- Company: | |||
|
No newline at end of file | ||||
|
3 | -- Engineer: | |||
|
No newline at end of file | ||||
|
4 | -- | |||
|
No newline at end of file | ||||
|
5 | -- Create Date: 17:26:48 03/19/2015 | |||
|
No newline at end of file | ||||
|
6 | -- Design Name: | |||
|
No newline at end of file | ||||
|
7 | -- Module Name: integra_gain1 - Behavioral | |||
|
No newline at end of file | ||||
|
8 | -- Project Name: | |||
|
No newline at end of file | ||||
|
9 | -- Target Devices: | |||
|
No newline at end of file | ||||
|
10 | -- Tool versions: | |||
|
No newline at end of file | ||||
|
11 | -- Description: | |||
|
No newline at end of file | ||||
|
12 | -- | |||
|
No newline at end of file | ||||
|
13 | -- Dependencies: | |||
|
No newline at end of file | ||||
|
14 | -- | |||
|
No newline at end of file | ||||
|
15 | -- Revision: | |||
|
No newline at end of file | ||||
|
16 | -- Revision 0.01 - File Created | |||
|
No newline at end of file | ||||
|
17 | -- Additional Comments: | |||
|
No newline at end of file | ||||
|
18 | -- | |||
|
No newline at end of file | ||||
|
19 | ---------------------------------------------------------------------------------- | |||
|
No newline at end of file | ||||
|
20 | library IEEE; | |||
|
No newline at end of file | ||||
|
21 | use IEEE.std_logic_1164.all; | |||
|
No newline at end of file | ||||
|
22 | use IEEE.numeric_std.all; | |||
|
No newline at end of file | ||||
|
23 | ||||
|
No newline at end of file | ||||
|
24 | use work.cic_utils.all; | |||
|
No newline at end of file | ||||
|
25 | ||||
|
No newline at end of file | ||||
|
26 | -- entity declaration -------------------------------- | |||
|
No newline at end of file | ||||
|
27 | ||||
|
No newline at end of file | ||||
|
28 | ||||
|
No newline at end of file | ||||
|
29 | entity integra_gain1 is | |||
|
No newline at end of file | ||||
|
30 | port ( | |||
|
No newline at end of file | ||||
|
31 | clk : in std_logic; | |||
|
No newline at end of file | ||||
|
32 | N : in integer range 1 to MAX_M2_DEC; | |||
|
No newline at end of file | ||||
|
33 | input : in std_logic_vector(FIXWIDTH-1 downto 0); | |||
|
No newline at end of file | ||||
|
34 | output : out std_logic_vector(FIXWIDTH-1 downto 0) | |||
|
No newline at end of file | ||||
|
35 | ); | |||
|
No newline at end of file | ||||
|
36 | end integra_gain1; | |||
|
No newline at end of file | ||||
|
37 | ||||
|
No newline at end of file | ||||
|
38 | architecture Behavioral of integra_gain1 is | |||
|
No newline at end of file | ||||
|
39 | component integrator | |||
|
No newline at end of file | ||||
|
40 | port ( | |||
|
No newline at end of file | ||||
|
41 | clk : in std_logic; | |||
|
No newline at end of file | ||||
|
42 | input : in std_logic_vector(FIXWIDTH-1 downto 0); | |||
|
No newline at end of file | ||||
|
43 | output : out std_logic_vector(FIXWIDTH-1 downto 0) | |||
|
No newline at end of file | ||||
|
44 | ); | |||
|
No newline at end of file | ||||
|
45 | end component; | |||
|
No newline at end of file | ||||
|
46 | signal s1 ,s2: std_logic_vector(FIXWIDTH-1 downto 0); | |||
|
No newline at end of file | ||||
|
47 | begin | |||
|
No newline at end of file | ||||
|
48 | inte: integrator port map( | |||
|
No newline at end of file | ||||
|
49 | clk => clk, | |||
|
No newline at end of file | ||||
|
50 | input => input, | |||
|
No newline at end of file | ||||
|
51 | output => s1 | |||
|
No newline at end of file | ||||
|
52 | ); | |||
|
No newline at end of file | ||||
|
53 | ||||
|
No newline at end of file | ||||
|
54 | s2 <= to_fix(ONE/N); | |||
|
No newline at end of file | ||||
|
55 | output <= s2*s1; | |||
|
No newline at end of file | ||||
|
56 | end Behavioral; | |||
|
No newline at end of file | ||||
|
57 | No newline at end of file |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now