1 | --
|
---|
2 | -- VHDL Architecture FACT_FTM_lib.fram_control.beha
|
---|
3 | --
|
---|
4 | -- Created:
|
---|
5 | -- by - kai.UNKNOWN (E5PCXX)
|
---|
6 | -- at - 11:47:24 21.02.2011
|
---|
7 | --
|
---|
8 | -- using Mentor Graphics HDL Designer(TM) 2009.1 (Build 12)
|
---|
9 | --
|
---|
10 | LIBRARY ieee;
|
---|
11 | USE ieee.std_logic_1164.all;
|
---|
12 | USE ieee.std_logic_arith.all;
|
---|
13 | USE IEEE.STD_LOGIC_UNSIGNED.all;
|
---|
14 | -- LIBRARY FACT_FTM_lib;
|
---|
15 | -- USE FACT_FTM_lib.ftm_array_types.all;
|
---|
16 | -- USE FACT_FTM_lib.ftm_constants.all;
|
---|
17 | library ftm_definitions;
|
---|
18 | USE ftm_definitions.ftm_array_types.all;
|
---|
19 | USE ftm_definitions.ftm_constants.all;
|
---|
20 |
|
---|
21 | ENTITY fram_control IS
|
---|
22 | PORT(
|
---|
23 | clk : IN std_logic;
|
---|
24 | fram_data_in : OUT std_logic_vector (15 DOWNTO 0);
|
---|
25 | fram_data_out : IN std_logic_vector (15 DOWNTO 0);
|
---|
26 | fram_addr_in : OUT std_logic_vector (11 DOWNTO 0);
|
---|
27 | fram_addr_out : OUT std_logic_vector (11 DOWNTO 0);
|
---|
28 | fram_we : OUT std_logic_vector (0 DOWNTO 0) := "0";
|
---|
29 | fl_read : IN std_logic;
|
---|
30 | fl_write_ftu : IN std_logic;
|
---|
31 | fl_busy : OUT std_logic := '1';
|
---|
32 | fl_started : OUT std_logic := '0';
|
---|
33 | fl_started_ftu : OUT std_logic := '0';
|
---|
34 | fl_ready : OUT std_logic := '0';
|
---|
35 | fl_data_out : OUT std_logic_vector (15 DOWNTO 0) := (others => '0');
|
---|
36 | fl_data_in_ftu : IN std_logic_vector (15 DOWNTO 0);
|
---|
37 | fl_addr : IN std_logic_vector (11 DOWNTO 0);
|
---|
38 | fl_addr_ftu : IN std_logic_vector (11 DOWNTO 0)
|
---|
39 | );
|
---|
40 |
|
---|
41 | -- Declarations
|
---|
42 |
|
---|
43 | END fram_control ;
|
---|
44 |
|
---|
45 | --
|
---|
46 | ARCHITECTURE beha OF fram_control IS
|
---|
47 |
|
---|
48 | type state_fram_proc_type is (FR_INIT, FR_CONFIG, FR_IDLE, FR_DOUT_WIZ_START, FR_DOUT_WIZ_END, FR_WRITE_START, FR_WRITE_END,
|
---|
49 | FR_READ_START, FR_READ_WAIT, FR_READ_END);
|
---|
50 |
|
---|
51 | signal state_fram_proc : state_fram_proc_type := FR_INIT;
|
---|
52 | signal next_state : state_fram_proc_type := FR_IDLE;
|
---|
53 |
|
---|
54 | signal local_addr : std_logic_vector (11 downto 0) := X"000";
|
---|
55 | signal local_data : std_logic_vector (15 downto 0);
|
---|
56 |
|
---|
57 | BEGIN
|
---|
58 |
|
---|
59 | fram_proc : process (clk)
|
---|
60 | begin
|
---|
61 | if rising_edge (clk) then
|
---|
62 | case state_fram_proc is
|
---|
63 |
|
---|
64 | when FR_INIT =>
|
---|
65 | state_fram_proc <= FR_CONFIG;
|
---|
66 |
|
---|
67 | when FR_CONFIG =>
|
---|
68 | state_fram_proc <= FR_IDLE;
|
---|
69 |
|
---|
70 | when FR_IDLE =>
|
---|
71 | fl_busy <= '0';
|
---|
72 |
|
---|
73 | if (fl_read = '1') then
|
---|
74 | fl_busy <= '1';
|
---|
75 | fl_started <= '1';
|
---|
76 | fl_ready <= '0';
|
---|
77 | local_addr <= fl_addr;
|
---|
78 | next_state <= FR_DOUT_WIZ_START;
|
---|
79 | state_fram_proc <= FR_READ_START;
|
---|
80 |
|
---|
81 | elsif (fl_write_ftu = '1') then
|
---|
82 | fl_busy <= '1';
|
---|
83 | fl_started_ftu <= '1';
|
---|
84 | fl_ready <= '0';
|
---|
85 | local_addr <= fl_addr_ftu;
|
---|
86 | local_data <= fl_data_in_ftu;
|
---|
87 | next_state <= FR_IDLE;
|
---|
88 | state_fram_proc <= FR_WRITE_START;
|
---|
89 | end if;
|
---|
90 |
|
---|
91 |
|
---|
92 |
|
---|
93 | when FR_DOUT_WIZ_START =>
|
---|
94 | fl_data_out <= local_data;
|
---|
95 | fl_ready <= '1';
|
---|
96 | state_fram_proc <= FR_DOUT_WIZ_END;
|
---|
97 |
|
---|
98 | when FR_DOUT_WIZ_END =>
|
---|
99 | if (fl_read <= '0') then
|
---|
100 | fl_started <= '0';
|
---|
101 | state_fram_proc <= FR_IDLE;
|
---|
102 | end if;
|
---|
103 |
|
---|
104 | -- --
|
---|
105 | -- write to ftu-list ram
|
---|
106 | -- --
|
---|
107 | when FR_WRITE_START =>
|
---|
108 | fram_addr_in <= local_addr;
|
---|
109 | fram_data_in <= local_data;
|
---|
110 | fram_we <= "1";
|
---|
111 | state_fram_proc <= FR_WRITE_END;
|
---|
112 |
|
---|
113 | when FR_WRITE_END =>
|
---|
114 | fram_we <= "0";
|
---|
115 | fl_started_ftu <= '0';
|
---|
116 | fl_ready <= '1';
|
---|
117 | state_fram_proc <= next_state;
|
---|
118 |
|
---|
119 | -- --
|
---|
120 | -- read from ftu-list ram
|
---|
121 | -- --
|
---|
122 | when FR_READ_START =>
|
---|
123 | fram_addr_out <= local_addr;
|
---|
124 | state_fram_proc <= FR_READ_WAIT;
|
---|
125 |
|
---|
126 | when FR_READ_WAIT =>
|
---|
127 | state_fram_proc <= FR_READ_END;
|
---|
128 |
|
---|
129 | when FR_READ_END =>
|
---|
130 | local_data <= fram_data_out;
|
---|
131 | state_fram_proc <= next_state;
|
---|
132 |
|
---|
133 |
|
---|
134 | end case;
|
---|
135 | end if; -- rising edge
|
---|
136 | end process fram_proc;
|
---|
137 |
|
---|
138 | END ARCHITECTURE beha;
|
---|