2 use ieee.std_logic_1164.all;
3 use ieee.std_logic_arith.all;
4 use ieee.std_logic_unsigned.all;
6 --------------------------------------------------------------------------------
10 LUT_DAT_W : integer := 10;
11 LUT_ADR_W : integer := 9;
12 LUT_P1_OFF : integer := 0;
13 LUT_P2_OFF : integer := 171;
14 LUT_P3_OFF : integer := 341;
15 IRF_ADR_W : integer := 5;
16 A_BASE : integer := 0;
17 P_BASE : integer := 1;
18 P1_OFF : integer := 0;
19 P2_OFF : integer := 1;
20 P3_OFF : integer := 2);
22 -- Primary slave interface
23 ACK_O : out std_logic;
27 -- Master interface to the interface memory
28 IRF_ACK_I : in std_logic;
29 IRF_ADR_O : out std_logic_vector (IRF_ADR_W-1 downto 0);
30 IRF_CYC_O : out std_logic;
31 IRF_DAT_I : in std_logic_vector (15 downto 0);
32 IRF_DAT_O : out std_logic_vector (15 downto 0);
33 IRF_STB_O : out std_logic := '0';
34 IRF_WE_O : out std_logic;
35 -- Master interface to the wave look-up-table
36 LUT_ADR_O : out std_logic_vector (LUT_ADR_W-1 downto 0);
37 LUT_DAT_I : in std_logic_vector (LUT_DAT_W-1 downto 0);
38 LUT_STB_O : out std_logic);
39 end entity vector_gen;
41 --------------------------------------------------------------------------------
43 architecture behavioral of vector_gen is
45 type state_t is (ready, angle, phase1, phase2, phase3, done);
46 subtype irf_adr_t is std_logic_vector (IRF_ADR_W-1 downto 0);
47 subtype lut_adr_t is std_logic_vector (LUT_ADR_W-1 downto 0);
49 constant A_ADR : irf_adr_t := conv_std_logic_vector(A_BASE, IRF_ADR_W);
50 constant P1_ADR : irf_adr_t := conv_std_logic_vector(P_BASE+P1_OFF, IRF_ADR_W);
51 constant P2_ADR : irf_adr_t := conv_std_logic_vector(P_BASE+P2_OFF, IRF_ADR_W);
52 constant P3_ADR : irf_adr_t := conv_std_logic_vector(P_BASE+P3_OFF, IRF_ADR_W);
54 signal state : state_t := ready;
55 signal angle_in : lut_adr_t;
56 signal ack_latch : std_logic := '0';
58 --------------------------------------------------------------------------------
62 IRF_DAT_O (IRF_DAT_O'HIGH downto LUT_DAT_I'HIGH+1) <= (others => '0');
63 IRF_DAT_O (LUT_DAT_I'RANGE) <= LUT_DAT_I;
65 ACK_O <= ack_latch and STB_I;
68 FSM : process (CLK_I) is
70 if rising_edge(CLK_I) then
71 if RST_I = '1' or STB_I = '0' then
90 if IRF_ACK_I = '1' then
92 angle_in <= IRF_DAT_I(angle_in'RANGE);
93 LUT_ADR_O <= IRF_DAT_I(angle_in'RANGE) + LUT_P1_OFF;
101 LUT_ADR_O <= angle_in + LUT_P2_OFF;
106 LUT_ADR_O <= angle_in + LUT_P3_OFF;
125 end architecture behavioral;