source: firmware/FTM/ethernet/fram_control_beha.vhd@ 13057

Last change on this file since 13057 was 10256, checked in by weitzel, 14 years ago
new version of FTM ethernet module; first version of clock conditioner
File size: 4.2 KB
Line 
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
11LIBRARY ieee;
12USE ieee.std_logic_1164.all;
13USE ieee.std_logic_arith.all;
14USE IEEE.STD_LOGIC_UNSIGNED.all;
15-- LIBRARY FACT_FTM_lib;
16-- USE FACT_FTM_lib.ftm_array_types.all;
17-- USE FACT_FTM_lib.ftm_constants.all;
18library ftm_definitions;
19USE ftm_definitions.ftm_array_types.all;
20USE ftm_definitions.ftm_constants.all;
21
22ENTITY fram_control IS
23 PORT(
24 clk : IN std_logic;
25 fram_data_in : OUT std_logic_vector (15 DOWNTO 0) := (others => '0');
26 fram_data_out : IN std_logic_vector (15 DOWNTO 0);
27 fram_addr_in : OUT std_logic_vector (11 DOWNTO 0) := (others => '0');
28 fram_addr_out : OUT std_logic_vector (11 DOWNTO 0) := (others => '0');
29 fram_we : OUT std_logic_vector (0 DOWNTO 0) := "0";
30 fl_read : IN std_logic;
31 fl_write_ftu : IN std_logic;
32 fl_busy : OUT std_logic := '1';
33 fl_started : OUT std_logic := '0';
34 fl_started_ftu : OUT std_logic := '0';
35 fl_ready : OUT std_logic := '0';
36 fl_data_out : OUT std_logic_vector (15 DOWNTO 0) := (others => '0');
37 fl_data_in_ftu : IN std_logic_vector (15 DOWNTO 0);
38 fl_addr : IN std_logic_vector (11 DOWNTO 0);
39 fl_addr_ftu : IN std_logic_vector (11 DOWNTO 0)
40 );
41
42-- Declarations
43
44END fram_control ;
45
46--
47ARCHITECTURE beha OF fram_control IS
48
49 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,
50 FR_READ_START, FR_READ_WAIT, FR_READ_END);
51
52 signal state_fram_proc : state_fram_proc_type := FR_INIT;
53 signal next_state : state_fram_proc_type := FR_IDLE;
54
55 signal local_addr : std_logic_vector (11 downto 0) := X"000";
56 signal local_data : std_logic_vector (15 downto 0);
57
58BEGIN
59
60 fram_proc : process (clk)
61 begin
62 if rising_edge (clk) then
63 case state_fram_proc is
64
65 when FR_INIT =>
66 state_fram_proc <= FR_CONFIG;
67
68 when FR_CONFIG =>
69 state_fram_proc <= FR_IDLE;
70
71 when FR_IDLE =>
72 fl_busy <= '0';
73
74 if (fl_read = '1') then
75 fl_busy <= '1';
76 fl_started <= '1';
77 fl_ready <= '0';
78 local_addr <= fl_addr;
79 next_state <= FR_DOUT_WIZ_START;
80 state_fram_proc <= FR_READ_START;
81
82 elsif (fl_write_ftu = '1') then
83 fl_busy <= '1';
84 fl_started_ftu <= '1';
85 fl_ready <= '0';
86 local_addr <= fl_addr_ftu;
87 local_data <= fl_data_in_ftu;
88 next_state <= FR_IDLE;
89 state_fram_proc <= FR_WRITE_START;
90 end if;
91
92
93
94 when FR_DOUT_WIZ_START =>
95 fl_data_out <= local_data;
96 fl_ready <= '1';
97 state_fram_proc <= FR_DOUT_WIZ_END;
98
99 when FR_DOUT_WIZ_END =>
100 if (fl_read <= '0') then
101 fl_started <= '0';
102 state_fram_proc <= FR_IDLE;
103 end if;
104
105 -- --
106 -- write to ftu-list ram
107 -- --
108 when FR_WRITE_START =>
109 fram_addr_in <= local_addr;
110 fram_data_in <= local_data;
111 fram_we <= "1";
112 state_fram_proc <= FR_WRITE_END;
113
114 when FR_WRITE_END =>
115 fram_we <= "0";
116 if (fl_write_ftu = '0') then
117 fl_started_ftu <= '0';
118 fl_ready <= '1';
119 state_fram_proc <= next_state;
120 end if;
121
122 -- --
123 -- read from ftu-list ram
124 -- --
125 when FR_READ_START =>
126 fram_addr_out <= local_addr;
127 state_fram_proc <= FR_READ_WAIT;
128
129 when FR_READ_WAIT =>
130 state_fram_proc <= FR_READ_END;
131
132 when FR_READ_END =>
133 local_data <= fram_data_out;
134 state_fram_proc <= next_state;
135
136
137 end case;
138 end if; -- rising edge
139 end process fram_proc;
140
141END ARCHITECTURE beha;
Note: See TracBrowser for help on using the repository browser.