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

Subversion Repositories nand_controller

[/] [nand_controller/] [trunk/] [VHDL/] [onfi_package.vhd] - Blame information for rev 13

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 pradd
-------------------------------------------------------------------------------------------------
2
-------------------------------------------------------------------------------------------------
3
-- Title                                                : ONFI compliant NAND interface
4
-- File                                                 : onfi_package.vhd
5
-- Author                                               : Alexey Lyashko <pradd@opencores.org>
6
-- License                                              : LGPL
7
-------------------------------------------------------------------------------------------------
8
-- Description:
9
-- This file contains clock cycle duration definition, delay timing constants as well as 
10
-- definition of FSM states and types used in the module.
11
-------------------------------------------------------------------------------------------------
12
-------------------------------------------------------------------------------------------------
13
 
14
library ieee;
15
use ieee.std_logic_1164.all;
16
 
17
package onfi is
18
        -- Clock cycle length in ns
19
        -- IMPORTANT!!! The 'clock_cycle' is configured for 400MHz, change it appropriately!
20
        constant clock_cycle    : real := 2.5;
21
 
22
        -- NAND interface delays.
23
        -- Delays of 7.5ns may need to be fixed to 7.0.
24
        constant        t_cls           :       integer := integer(10.0 / clock_cycle);
25
        constant        t_clh           :       integer := integer(5.0  / clock_cycle);
26
        constant        t_wp            :       integer := integer(10.0         / clock_cycle);
27
        constant        t_wh            :       integer := integer(7.5          / clock_cycle);
28
        constant        t_wc            :       integer := integer(20.0 / clock_cycle);
29
        constant        t_ds            :       integer := integer(7.5          / clock_cycle);
30
        constant        t_dh            :       integer := integer(5.0          / clock_cycle);
31
        constant        t_als           :       integer := integer(10.0 / clock_cycle);
32
        constant        t_alh           :       integer := integer(5.0          / clock_cycle);
33
        constant        t_rr            :       integer := integer(20.0 / clock_cycle);
34
        constant        t_rea           :       integer := integer(16.0 / clock_cycle);
35
        constant        t_rp            :       integer := integer(10.0 / clock_cycle);
36
        constant        t_reh           :       integer := integer(7.5          / clock_cycle);
37
        constant        t_wb            :       integer := integer(100.0        / clock_cycle);
38
        constant        t_rst           :       integer := integer(5000.0       / clock_cycle);
39
        constant        t_bers  :       integer :=      integer(700000.0 / clock_cycle);
40
        constant        t_whr           :       integer :=      integer(80.0    / clock_cycle);
41 12 pradd
        constant        t_prog  :       integer :=      integer(600000.0 / clock_cycle);
42 9 pradd
        constant        t_adl           :       integer :=      integer(70.0    / clock_cycle);
43
 
44
        type latch_t is (LATCH_CMD, LATCH_ADDR);
45
        type io_t is (IO_READ, IO_WRITE);
46
 
47
        type master_state_t is
48
        (
49
                M_IDLE,                                                         -- NAND Master is in idle state - awaits commands.
50
                M_RESET,                                                                -- NAND Master is being reset.
51
                M_WAIT,                                                         -- NAND Master waits for current operation to complete.
52
                M_DELAY,                                                                -- Execute timed delay.
53
                M_NAND_RESET,                                           -- NAND Master executes NAND 'reset' command.
54
                M_NAND_READ_PARAM_PAGE,                 -- Read ONFI parameter page.
55
                M_NAND_READ_ID,                                 -- Read the JEDEC ID of the chip.
56
                M_NAND_BLOCK_ERASE,                             -- Erase block specified by address in current_address.
57
                M_NAND_READ_STATUS,                             --      Read status byte.
58
                M_NAND_READ,                                            -- Reads page into the buffer.
59
                M_NAND_READ_8,
60
                M_NAND_READ_16,
61
                M_NAND_PAGE_PROGRAM,                            -- Program one page.
62
                -- interface commands
63
                MI_GET_STATUS,                                          -- Returns the status byte.
64
                MI_CHIP_ENABLE,                                 -- Sets CE# to 0.
65
                MI_CHIP_DISABLE,                                        -- Sets CE# to 1.
66
                MI_WRITE_PROTECT,                                       -- Sets WP# to 0.
67
                MI_WRITE_ENABLE,                                        --      Sets WP# to 1.
68
                MI_RESET_INDEX,                                 -- Resets page_idx (used as indes into arrays) to 0.
69
                -- The following states depend on 'page_idx' pointer. If its value goes beyond the limits
70
                -- of the array, it is then reset to 0.
71
                MI_GET_ID_BYTE,                                 -- Gets chip_id(page_idx) byte.
72
                MI_GET_PARAM_PAGE_BYTE,                 -- Gets page_param(page_idx) byte.
73
                MI_GET_DATA_PAGE_BYTE,                  -- Gets page_data(page_idx) byte.
74
                MI_SET_DATA_PAGE_BYTE,                  -- Sets value at page_data(page_idx).
75
                MI_GET_CURRENT_ADDRESS_BYTE,    -- Gets current_address(page_idx) byte.
76
                MI_SET_CURRENT_ADDRESS_BYTE     -- Sets value at current_address(page_idx).
77
        );
78
 
79
        type master_substate_t is
80
        (
81
                MS_BEGIN,
82
                MS_SUBMIT_COMMAND,
83
                MS_SUBMIT_COMMAND1,
84
                MS_SUBMIT_ADDRESS,
85
                MS_WRITE_DATA0,
86
                MS_WRITE_DATA1,
87
                MS_WRITE_DATA2,
88
                MS_WRITE_DATA3,
89
                MS_READ_DATA0,
90
                MS_READ_DATA1,
91
                MS_READ_DATA2,
92
                MS_DELAY,
93
                MS_WAIT,
94
                MS_END
95
        );
96
 
97
        type page_t is array (0 to 8628) of std_logic_vector(7 downto 0);
98
        type param_page_t is array (0 to 255) of std_logic_vector(7 downto 0);
99
        type nand_id_t is array (0 to 4) of std_logic_vector(7 downto 0);
100
        type nand_address_t is array (0 to 4) of std_logic_vector(7 downto 0);
101
        type states_t is array (0 to 255) of master_state_t;
102
 
103
        constant        max_page_idx    :       integer :=      8626;
104
end onfi;

powered by: WebSVN 2.1.0

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