-------------------------------------------------------------------------
-- Project: SDRAM controller
-- This file: Type definitions
--
-- Copyright (C) 2007 J. Ahrensfeld
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- For questions and ideas, please contact the author at jens@jayfield.org
--
--------------------------------------------------------------------------

library IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
USE IEEE.MATH_REAL.ALL;

package sdram_const is

	-----------------------------------------------------------------------------------------
	-- Table of Timing Parameters as a function of operation

	-- Derived constants from sdram_config

	subtype user_cmd_t is unsigned(1 downto 0);
	constant UCMD_NOP			: user_cmd_t := "00";
	constant UCMD_READ			: user_cmd_t := "01";
	constant UCMD_WRITE			: user_cmd_t := "10";
	constant UCMD_LMR			: user_cmd_t := "11";

	subtype sdr_cmd_t is natural range 0 to 9;
	constant SD_DESELECT		: sdr_cmd_t := 0;
	constant SD_NOP				: sdr_cmd_t := 1;
	constant SD_LMR				: sdr_cmd_t := 2;
	constant SD_ACT				: sdr_cmd_t := 3;
	constant SD_READ			: sdr_cmd_t := 4;
	constant SD_WRITE			: sdr_cmd_t := 5;
	constant SD_PRE				: sdr_cmd_t := 6;
	constant SD_BST				: sdr_cmd_t := 7;
	constant SD_AR				: sdr_cmd_t := 8;
	constant SD_SR				: sdr_cmd_t := 9;

	constant LMR_REG_BASE		: natural := 0;
	constant LMR_REG_EXTENDED	: natural := 1;
	constant LMR_OP_NORMAL		: natural := 0;
	constant LMR_OP_RES_DLL		: natural := 2;
	constant LMR_BT_SEQ			: natural := 0;
	constant LMR_BT_ILVD		: natural := 1;
	constant LMR_BL1			: natural := 0;
	constant LMR_BL2			: natural := 1;
	constant LMR_BL4			: natural := 2;
	constant LMR_BL8			: natural := 3;
	constant LMR_CL2			: natural := 2;
	constant LMR_CL3			: natural := 3;
	constant LMR_CL2_5			: natural := 6;
	
end sdram_const;
