1 |
145 |
lanttu |
------------------------------------------------------------------------------
|
2 |
|
|
-- Author : Timo Alho
|
3 |
|
|
-- e-mail : timo.a.alho@tut.fi
|
4 |
|
|
-- Date : 14.06.2004 14:36:26
|
5 |
|
|
-- File : Rom_dct_sub.vhd
|
6 |
|
|
-- Design :
|
7 |
|
|
------------------------------------------------------------------------------
|
8 |
|
|
-- Description : Pre-calculated DCT-coefficients for subtraction -terms
|
9 |
|
|
------------------------------------------------------------------------------
|
10 |
|
|
LIBRARY ieee;
|
11 |
|
|
USE ieee.std_logic_1164.ALL;
|
12 |
|
|
USE ieee.std_logic_arith.ALL;
|
13 |
|
|
|
14 |
|
|
ENTITY Rom_dct_sub IS
|
15 |
|
|
GENERIC(
|
16 |
|
|
coeffw_g : integer := 14
|
17 |
|
|
);
|
18 |
|
|
PORT(
|
19 |
|
|
addr_in : IN std_logic_vector (3 DOWNTO 0);
|
20 |
|
|
clk : IN std_logic;
|
21 |
|
|
data_out : OUT std_logic_vector (4*coeffw_g-1 DOWNTO 0)
|
22 |
|
|
);
|
23 |
|
|
|
24 |
|
|
-- Declarations
|
25 |
|
|
|
26 |
|
|
END Rom_dct_sub ;
|
27 |
|
|
|
28 |
|
|
--
|
29 |
|
|
ARCHITECTURE rtl OF Rom_dct_sub IS
|
30 |
|
|
TYPE Rom16x4x15 IS ARRAY (0 TO 15) OF signed(15*4-1 DOWNTO 0);
|
31 |
|
|
CONSTANT ROM_SUB : Rom16x4x15 := (
|
32 |
|
|
conv_signed(0, 15) & conv_signed(0, 15) & conv_signed(0, 15) & conv_signed(0, 15),
|
33 |
|
|
conv_signed(5681, 15) & conv_signed(4816, 15) & conv_signed(3218, 15) & conv_signed(1130, 15),
|
34 |
|
|
conv_signed(4816, 15) & conv_signed(-1130, 15) & conv_signed(-5681, 15) & conv_signed(-3218, 15),
|
35 |
|
|
conv_signed(10498, 15) & conv_signed(3686, 15) & conv_signed(-2463, 15) & conv_signed(-2088, 15),
|
36 |
|
|
conv_signed(3218, 15) & conv_signed(-5681, 15) & conv_signed(1130, 15) & conv_signed(4816, 15),
|
37 |
|
|
conv_signed(8900, 15) & conv_signed(-865, 15) & conv_signed(4348, 15) & conv_signed(5946, 15),
|
38 |
|
|
conv_signed(8035, 15) & conv_signed(-6811, 15) & conv_signed(-4551, 15) & conv_signed(1598, 15),
|
39 |
|
|
conv_signed(13716, 15) & conv_signed(-1995, 15) & conv_signed(-1333, 15) & conv_signed(2728, 15),
|
40 |
|
|
conv_signed(1130, 15) & conv_signed(-3218, 15) & conv_signed(4816, 15) & conv_signed(-5681, 15),
|
41 |
|
|
conv_signed(6811, 15) & conv_signed(1598, 15) & conv_signed(8035, 15) & conv_signed(-4551, 15),
|
42 |
|
|
conv_signed(5946, 15) & conv_signed(-4348, 15) & conv_signed(-865, 15) & conv_signed(-8900, 15),
|
43 |
|
|
conv_signed(11628, 15) & conv_signed(468, 15) & conv_signed(2353, 15) & conv_signed(-7769, 15),
|
44 |
|
|
conv_signed(4348, 15) & conv_signed(-8900, 15) & conv_signed(5946, 15) & conv_signed(-865, 15),
|
45 |
|
|
conv_signed(10030, 15) & conv_signed(-4083, 15) & conv_signed(9165, 15) & conv_signed(265, 15),
|
46 |
|
|
conv_signed(9165, 15) & conv_signed(-10030, 15) & conv_signed(265, 15) & conv_signed(-4083, 15),
|
47 |
|
|
conv_signed(14846, 15) & conv_signed(-5213, 15) & conv_signed(3483, 15) & conv_signed(-2953, 15));
|
48 |
|
|
|
49 |
|
|
SIGNAL addr_r : std_logic_vector(3 DOWNTO 0);
|
50 |
|
|
BEGIN
|
51 |
|
|
|
52 |
|
|
clocked : PROCESS (clk)
|
53 |
|
|
BEGIN -- PROCESS clocked
|
54 |
|
|
IF clk'event AND clk = '1' THEN -- rising clock edge
|
55 |
|
|
addr_r <= addr_in;
|
56 |
|
|
END IF;
|
57 |
|
|
END PROCESS clocked;
|
58 |
|
|
|
59 |
|
|
access_rom : PROCESS (addr_r)
|
60 |
|
|
VARIABLE address : integer;
|
61 |
|
|
BEGIN
|
62 |
|
|
address := conv_integer(unsigned(addr_r));
|
63 |
|
|
data_out <= conv_std_logic_vector(ROM_SUB(address), 4*coeffw_g);
|
64 |
|
|
END PROCESS access_rom;
|
65 |
|
|
|
66 |
|
|
END rtl;
|
67 |
|
|
|