OpenCores
URL https://opencores.org/ocsvn/ffr16/ffr16/trunk

Subversion Repositories ffr16

[/] [ffr16/] [branches/] [APERT/] [rtl/] [050803kn/] [cf_file_reader.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 armando
--===========================================================================--
2
-- 
3
-- FAT16 FIRST FILE READER
4
--
5
--  - DECEMBER 2002
6
--  - UPV / EHU.  
7
--
8
--  - APPLIED ELECTRONICS RESEARCH TEAM (APERT)-
9
--  DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATIONS - BASQUE COUNTRY UNIVERSITY
10
--
11
-- THIS CODE IS DISTRIBUTED UNDER :
12
-- OpenIPCore Hardware General Public License "OHGPL" 
13
-- http://www.opencores.org/OIPC/OHGPL.shtml
14
--
15
-- Design units   : COMPACT FLASH TOOLS
16
--
17
-- File name      : cf_file_reader.vhd
18
--
19
-- Purpose        : 
20
--                  
21
-- Library        : WORK
22
--
23
-- Dependencies   : IEEE.Std_Logic_1164
24
--
25
-- Simulator      : ModelSim SE version 5.5e on a WindowsXP PC
26
--===========================================================================--
27
-------------------------------------------------------------------------------
28
-- Revision list
29
-- Version   Author                 Date           Changes
30
--
31
-- 280103     Armando Astarloa     28 January    FAT16 VERSION (FROM FAT32)
32
-- 300403     Armando Astarloa     28 January    Data out 8 bits
33
-- 200503     Armando Astarloa     20 May                        Quit debug signals
34
-- 030603         Armando Astarloa        03 June                Ack_comrx lasts only one period        
35
-- 240603         Armando Astarloa        24    June             Quit soft reset signals (with kcpsm 
36
--                                                                                                                                      v.1002)
37
-------------------------------------------------------------------------------
38
-- Description    : Top VHDL file for FFR16
39
--                  
40
-------------------------------------------------------------------------------
41
-- Entity for cf_file_reader Unit                                                         --
42
-------------------------------------------------------------------------------
43
library IEEE;
44
use IEEE.STD_LOGIC_1164.ALL;
45
use IEEE.STD_LOGIC_ARITH.ALL;
46
use IEEE.STD_LOGIC_UNSIGNED.ALL;
47
 
48
library WORK;
49
use WORK.cf_package.ALL;
50
 
51
entity cf_file_reader is
52
    Port (
53
 
54
                                --
55
                                -- WISHBONE GLOBAL SIGNALS
56
                                --
57
                                RST_I:  in  std_logic;                                                                                                          -- WB : Global RESET signal
58
            CLK_I:  in  std_logic;
59
 
60
                                --
61
                                -- NON WISHBONE SIGNALS (IDE SIGNALS) 
62
                                --
63
                                IDE_BUS: inout  std_logic_vector(15 downto 0 );                                  -- IDE DATA bidirectional bus
64
 
65
                                NIOWR:  out  std_logic;                                                                                                         -- IDE : Write Strobe
66
                                NIORD:  out  std_logic;                                                                                                         -- IDE : Read Strobe
67
                           NCE1:  out  std_logic;                                                                                                               -- IDE : CE1
68
                                NCE0:  out  std_logic;                                                                                                          -- IDE : CE2
69
                                A2:  out  std_logic;                                                                                                                    -- IDE : Address bit 2
70
                                A1:  out  std_logic;                                                                                                                    -- IDE : Address bit 1
71
                                A0:  out  std_logic;                                                                                                                    -- IDE : Address bit 0
72
 
73
                                ERROR:  out  std_logic;                                                                                                         -- Error on cf access
74
 
75
                                --
76
                                -- SLAVE INTERFACE
77
                                --
78
 
79
                                ACK_O:  out std_logic;                                                                                                          -- WB : Ack to the master
80
--          ADR_I:  in  std_logic_vector(1 downto 0 );                                                  -- WB : Register selection
81
--          DAT_O:  out  std_logic_vector(15 downto 0 );                                                -- WB : 16 bits data bus input
82
                      DAT_O:  out  std_logic_vector(7 downto 0 );                                                -- WB : 16 bits data bus input
83
                                STB_I:  in  std_logic;                                                                                                  -- WB : Access qualify from master
84
            WE_I:   in  std_logic;                                                                                                      -- WB : Read/write request from master
85
                                TAG0_WORD_AVAILABLE_O:  out  std_logic;
86
                                TAG1_ERROR_O:  out  std_logic
87
 
88
                        );
89
end cf_file_reader;
90
 
91
architecture Behavioral of cf_file_reader is
92
 
93
-- ack_comrx active only one period
94
type ack_state is (ackone_wait, ackactive, ackzero_wait);
95
signal act_ack : ack_state;
96
signal next_ack: ack_state;
97
signal ack_slave_int: std_logic;
98
 
99
--
100
-- INTERCONEXION SIGNALS
101
--
102
signal stb_internal : std_logic;
103
signal ack_internal : std_logic;
104
signal data_internal : std_logic_vector(15 downto 0 );
105
signal data_internal_reg : std_logic_vector(15 downto 0 );
106
signal we_internal : std_logic;
107
signal adr_i_internal : std_logic;
108
signal error_internal : std_logic;
109
 
110
signal tag0_word_available_internal : std_logic;
111
signal tag1_word_request_internal : std_logic;
112
 
113
-- for the 8 bit version only LSB is valid
114
signal data_out_full : std_logic_vector(15 downto 0 );
115
begin
116
 
117
-- ack_comrx active only one period
118
ack_control: process (rst_i, clk_i)
119
-- declarations
120
begin
121
        if rst_i = '1' then
122
                act_ack <= ackone_wait;
123
        elsif (clk_i'event and clk_i = '1') then
124
                act_ack <= next_ack;
125
        end if;
126
end process;
127
 
128
process(act_ack, ack_slave_int)
129
begin
130
                case act_ack is
131
                        when ackone_wait =>
132
                                if ack_slave_int ='1' then
133
                                        next_ack <= ackactive;
134
                                else
135
                                        next_ack <= ackone_wait;
136
                                end if;
137
                        when ackactive =>
138
                                next_ack <= ackzero_wait;
139
                        when ackzero_wait =>
140
                                if ack_slave_int = '0' then
141
                                        next_ack <= ackone_wait;
142
                                else
143
                                        next_ack <= ackzero_wait;
144
                                end if;
145
                        when others =>
146
                                next_ack <= ackone_wait;
147
                end case;
148
 end process;
149
 
150
with act_ack select
151
        ACK_O <= '1' when ackactive,
152
                                '0' when others;
153
 
154
 
155
--
156
-- COMPONENT INSTANTATION
157
--
158
--
159
-- SECTOR READER
160
--
161
sector_reader:cf_sector_reader port map (
162
                                --
163
                                -- WISHBONE SIGNALS
164
                                --
165
                                RST_I => RST_I,
166
                                ACK_O => ack_internal,
167
                                ADR_I =>        adr_i_internal,
168
            CLK_I => CLK_I,
169
            DAT_I_O => data_internal,
170
            STB_I => stb_internal,
171
                 WE_I => we_internal,
172
                                TAG0_WORD_AVAILABLE => tag0_word_available_internal,                            -- 
173
                                TAG1_WORD_REQUEST => tag1_word_request_internal,                                        -- IDE : Write Strobe
174
 
175
                                --
176
                                -- NON WISHBONE SIGNALS
177
                                --
178
                                IDE_BUS => IDE_BUS,
179
 
180
                                NIOWR => NIOWR,
181
                                NIORD => NIORD,
182
                           NCE1 => NCE1,
183
                                NCE0 => NCE0,
184
                                A2 => A2,
185
                                A1 => A1,
186
                                A0 => A0,
187
                                ERROR => error_internal
188
                                );
189
 
190
--
191
-- FAT PROCESSOR
192
--
193
fat_processor:cf_fat16_reader port map (
194
                                --
195
                                -- WISHBONE SIGNALS
196
                                --
197
                                RST_I => RST_I,
198
                                CLK_I => CLK_I,
199
                                --
200
                                -- MASTER INTERFACE
201
                                --
202
                                ACK_I_M => ack_internal,
203
            ADR_O_M => adr_i_internal,
204
            DAT_M => data_internal,
205
            STB_O_M => stb_internal,
206
                 WE_O_M => we_internal,
207
                                TAG0_ERROR_I_M => error_internal,
208
                                --
209
                                -- SLAVE INTERFACE
210
                                --
211
 
212
                                ACK_O_S => ack_slave_int,
213
                                --          ADR_I:  in  std_logic_vector(1 downto 0 );                  -- WB : Register selection
214
            DAT_O_S => data_out_full,
215
            STB_I_S => STB_I,
216
            WE_I_S => WE_I,
217
                                TAG0_WORD_AVAILABLE_O_S => TAG0_WORD_AVAILABLE_O,
218
                                TAG1_ERROR_O_S => TAG1_ERROR_O                                                                                  -- Error on cf access                                                                                                                           
219
                                );
220
 
221
                                --
222
                                -- COMB. ASIGMENTS
223
                                --
224
                                ERROR <= error_internal;
225
                                DAT_O <= data_out_full(7 downto 0);
226
 
227
end Behavioral;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.