URL
https://opencores.org/ocsvn/nand_controller/nand_controller/trunk
[/] [nand_controller/] [trunk/] [VHDL/] [nand_master.vhd] - Diff between revs 10 and 12
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 10 |
Rev 12 |
Line 24... |
Line 24... |
entity nand_master is
|
entity nand_master is
|
port
|
port
|
(
|
(
|
-- System clock
|
-- System clock
|
clk : in std_logic;
|
clk : in std_logic;
|
|
enable : in std_logic;
|
-- NAND chip control hardware interface. These signals should be bound to physical pins.
|
-- NAND chip control hardware interface. These signals should be bound to physical pins.
|
nand_cle : out std_logic := '0';
|
nand_cle : out std_logic := '0';
|
nand_ale : out std_logic := '0';
|
nand_ale : out std_logic := '0';
|
nand_nwe : out std_logic := '1';
|
nand_nwe : out std_logic := '1';
|
nand_nwp : out std_logic := '0';
|
nand_nwp : out std_logic := '0';
|
Line 278... |
Line 279... |
state <= M_RESET;
|
state <= M_RESET;
|
|
|
-- elsif(activate = '1')then
|
-- elsif(activate = '1')then
|
-- state <= state_switch(to_integer(unsigned(cmd_in)));
|
-- state <= state_switch(to_integer(unsigned(cmd_in)));
|
|
|
elsif(rising_edge(clk))then
|
elsif(rising_edge(clk) and enable = '0')then
|
case state is
|
case state is
|
-- RESET state. Speaks for itself
|
-- RESET state. Speaks for itself
|
when M_RESET =>
|
when M_RESET =>
|
state <= M_IDLE;
|
state <= M_IDLE;
|
substate <= MS_BEGIN;
|
substate <= MS_BEGIN;
|
Line 310... |
Line 311... |
-- Reset the NAND chip
|
-- Reset the NAND chip
|
when M_NAND_RESET =>
|
when M_NAND_RESET =>
|
cle_data_in <= x"00ff";
|
cle_data_in <= x"00ff";
|
state <= M_WAIT;
|
state <= M_WAIT;
|
n_state <= M_IDLE;
|
n_state <= M_IDLE;
|
|
delay <= t_wb + 8;
|
|
|
-- Read the status register of the controller
|
-- Read the status register of the controller
|
when MI_GET_STATUS =>
|
when MI_GET_STATUS =>
|
data_out <= status;
|
data_out <= status;
|
state <= M_IDLE;
|
state <= M_IDLE;
|
Line 767... |
Line 769... |
end if;
|
end if;
|
end if;
|
end if;
|
|
|
-- Wait for latch and IO modules to become ready as well as for NAND's R/B# to be '1'
|
-- Wait for latch and IO modules to become ready as well as for NAND's R/B# to be '1'
|
when M_WAIT =>
|
when M_WAIT =>
|
if('0' = (cle_busy or ale_busy or io_rd_busy or io_wr_busy or (not nand_rnb)))then
|
if(delay > 1)then
|
|
delay <= delay - 1;
|
|
elsif('0' = (cle_busy or ale_busy or io_rd_busy or io_wr_busy or (not nand_rnb)))then
|
state <= n_state;
|
state <= n_state;
|
end if;
|
end if;
|
|
|
-- Simple delay mechanism
|
-- Simple delay mechanism
|
when M_DELAY =>
|
when M_DELAY =>
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.