Line 6... |
Line 6... |
-- Design Name: DDR SDRAM Controller
|
-- Design Name: DDR SDRAM Controller
|
-- Module Name: sdram_controller - impl
|
-- Module Name: sdram_controller - impl
|
-- Project Name:
|
-- Project Name:
|
-- Target Devices: Spartan3e Starter Board
|
-- Target Devices: Spartan3e Starter Board
|
-- Tool versions: ISE 11.2
|
-- Tool versions: ISE 11.2
|
-- Description: This is the main controller module. This is where the signals to/from the DDR SDRAM chip happen.
|
-- Description: This is the main controller module. This is where the signals
|
|
-- to/from the DDR SDRAM chip happen.
|
--
|
--
|
-- Dependencies:
|
-- Dependencies:
|
--
|
--
|
-- Revision:
|
-- Revision:
|
-- Revision 0.01 - File Created
|
-- Revision 0.01 - File Created
|
Line 24... |
Line 25... |
use IEEE.STD_LOGIC_ARITH.ALL;
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
|
|
---- Uncomment the following library declaration if instantiating
|
---- Uncomment the following library declaration if instantiating
|
---- any Xilinx primitives in this code.
|
---- any Xilinx primitives in this code.
|
library UNISIM;
|
--library UNISIM;
|
use UNISIM.VComponents.all;
|
--use UNISIM.VComponents.all;
|
|
|
-- This is not meant to be a high performance controller. No fancy command scheduling, does the bare minimum to work without screwing up timing.
|
-- This is not meant to be a high performance controller. No fancy command
|
-- Do NOT put this controller in something mission critical! This is the creation of a guy in his bedroom, learning digital circuits.
|
-- scheduling, does the bare minimum to work without screwing up timing.
|
-- Intended to be used exclusively with the Spartan3e Starter Board and targets the mt46v32m16 chip. Dunno if it will work anywhere else.
|
-- Do NOT put this controller in something mission critical! This is the creation
|
-- Uses the ODDR2 and DCM Xilinx primitives, for other FPGAs, you'll need to patch in equivalents. See sdram_support for the details.
|
-- of a guy in his bedroom, learning digital circuits.
|
-- I'd strongly recommend running it through a post-PAR simulation if you're porting to any other FPGA, as the timings will change on you.
|
-- Intended to be used exclusively with the Spartan3e Starter Board and targets
|
-- Consumes two DCMs, runs off of the main 50mhz board clock. Could possibly consume one DCM if you want to feed it the 100mhz clock directly.
|
-- the mt46v32m16 chip. Dunno if it will work anywhere else.
|
-- Has an 8bit wide datapath, moderate changes could support 16bits, 32 bits you'll have to work some. You want more than that, you'll
|
-- Uses the ODDR2 and DCM Xilinx primitives, for other FPGAs, you'll need to
|
-- be doing brain surgery on the FSMs - good luck.
|
-- patch in equivalents. See sdram_support for the details.
|
|
-- I'd strongly recommend running it through a post-PAR simulation if you're
|
|
-- porting to any other FPGA, as the timings will probably change on you.
|
|
-- Consumes two DCMs, runs off of the main 50mhz board clock. Could possibly
|
|
-- consume one DCM if you want to feed it the 100mhz clock directly.
|
|
-- Has an 8bit wide datapath, moderate changes could support 16bits, 32 bits
|
|
-- you'll have to work some. You want more than that, you'll be doing brain
|
|
-- surgery on the FSMs - good luck.
|
|
|
-- This design has been tested with the testbench only. There may be glitches hidden in here somewhere still. Consider this to be an alpha release.
|
-- This design has been tested with the testbench only. There may be glitches
|
|
-- hidden in here somewhere still. Consider this to be an alpha release.
|
-- Did I mention that you shouldn't put this in anything mission critical?
|
-- Did I mention that you shouldn't put this in anything mission critical?
|
|
|
-- Be careful with the synthesizer settings too. Do not let the FSM extractor choose something other than one-hot. Be careful with register
|
-- Be careful with the synthesizer settings too. Do not let the FSM extractor
|
-- removal.
|
-- choose something other than one-hot. Be careful with equivalent register
|
|
-- removal. I've rolled all synthesizer settings back to default and things
|
|
-- seem to be OK, but pay attention to the synthesizer reports!
|
|
|
-- TODO: implement reset signal
|
-- TODO: implement reset signal
|
entity sdram_controller is
|
entity sdram_controller is
|
port( -- user facing signals
|
port( -- user facing signals
|
clk50mhz : in std_logic;
|
clk50mhz : in std_logic;
|