?? controller.vhd
字號:
--###############################################################################---- LOGIC CORE: SDR SDRAM Controller -- MODULE NAME: Controller() -- date: 2006.8.9-- REVISION HISTORY: -- FUNCTIONAL DESCRIPTION:---- This module is the state_machine for the SDR SDRAM controller.-- Copyright (C) 1991-2000 --##############################################################################library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity controller is port ( clk : in std_logic; --!系統時鐘由 pll產生,100mhz clkout : out std_logic; operationreq : in std_logic_vector(2 downto 0); --!操作請求碼,對應各種操作 cmdstate : out std_logic_vector(3 downto 0); --輸出當前的狀態 cmdt : out std_logic_vector(2 downto 0); --輸出當前的狀態 CMDACKt : out std_logic; cmdlengthcount : out std_logic_vector(9 downto 0); -- 命令長度計數器的返回值 reset : in std_logic; --模塊的復位信號 reqack : out std_logic; --操作完成應答信號,10ns的脈沖 fifo1rden : out std_logic; --fifo的使能信號高電平有效 fifo2wren : out std_logic; hostdataen : out std_logic; HostAdr : in std_logic_vector(22 downto 0); --???外部提供的隨機地址信號 HostDataout : out std_logic_vector(15 downto 0); --隨機讀寫數據 HostDatain : IN std_logic_vector(15 downto 0); --隨機讀寫數據 DataWr : in std_logic_vector(15 downto 0); --!give to age_mode外部輸入數據,可連接前端fifo,或選通后接主機數據總線 DataRd : out std_logic_vector(15 downto 0); --外部輸出數據,可連接后端fifo,或選通后接主機數據總線 PageWeAdrSet : in std_logic; --!頁寫首地址復位信號 PageRdAdrSet : in std_logic; --!頁讀首地址復位信號 HostRd : in std_logic; --ADDR : out std_logic_vector(12 downto 0); --接口地址,輸出給SDRAM的地址總線 sdramin : out std_logic_vector(15 downto 0); --接口輸入數據總線; sdramout : out std_logic_vector(15 downto 0); --接口輸出數據總線 count1 : out std_logic_vector(2 downto 0); SA : out std_logic_vector(11 downto 0); --???SDRAM address output BA : out std_logic_vector(1 downto 0); --SDRAM bank address CS_N : out std_logic; --SDRAM Chip Selects CKE : out std_logic; --SDRAM clock enable RAS_N : out std_logic; --SDRAM Row address Strobe CAS_N : out std_logic; --SDRAM Column address Strobe WE_N : out std_logic; --SDRAM write enable DQ : inout std_logic_vector(15 downto 0); --!SDRAM data bus DQM : out std_logic_vector(1 downto 0); --SDRAM data mask lines------------------------------------------------------------------------------- tcmdlengthcount : out std_logic_vector(9 downto 0));end controller;architecture operation of controller is component sdr_sdram generic ( ASIZE : integer := 23; --??? DSIZE : integer := 16; ROWSIZE : integer := 12; --??? COLSIZE : integer := 9; BANKSIZE : integer := 2; --???2 ROWSTART : integer := 9; COLSTART : integer := 0; BANKSTART : integer := 20 --???20 ); port ( CLK : in std_logic; --System Clock RESET_N : in std_logic; --System Reset ADDR : in std_logic_vector(ASIZE-1 downto 0); --Address for controller requests CMD : in std_logic_vector(2 downto 0); --Controller command CMDACK : out std_logic; --Controller command acknowledgement DATAIN : in std_logic_vector(DSIZE-1 downto 0); --Data input DATAOUT : out std_logic_vector(DSIZE-1 downto 0); --Data output DM : in std_logic_vector(DSIZE/8-1 downto 0); --Data mask input SA : out std_logic_vector(11 downto 0); --SDRAM address output BA : out std_logic_vector(1 downto 0); --SDRAM bank address CS_N : out std_logic; --SDRAM Chip Selects CKE : out std_logic; --SDRAM clock enable RAS_N : out std_logic; --SDRAM Row address Strobe CAS_N : out std_logic; --SDRAM Column address Strobe WE_N : out std_logic; --SDRAM write enable DQ : inout std_logic_vector(DSIZE-1 downto 0); --SDRAM data bus DQM : out std_logic_vector(DSIZE/8-1 downto 0) --SDRAM data mask lines ); end component; component state_machine port ( sdramclk : in std_logic; --!統時鐘由 pll產生,100mhz operationreq : in std_logic_vector(2 downto 0); --!操作請求碼,對應各種操作,由頂層模塊直接給 CMDACK : in std_logic; --!Controller command acknowledgement cmdstate : out std_logic_vector(3 downto 0); --!輸出當前的狀態 --cmdlengthcount : out std_logic_vector(9 downto 0); --!命令長度計數器的返回值 tcmdlengthcount : out std_logic_vector(9 downto 0); cmd : inout std_logic_vector(2 downto 0); --!輸出給sdramcontroller的命令端口 reset : in std_logic; --!模塊的復位信號,由頂層模塊提供 reqack : out std_logic; --!操作完成應答信號,10ns的脈沖 fifo1rden : out std_logic; --fifo的使能信號高電平有效 fifo2wren : out std_logic; hostdataen : out std_logic; --!fifo的使能信號高電平有效,給頂層模塊 --ackcounti :out std_logic_vector(2 downto 0); --counto1 : out std_logic_vector(2 downto 0); counto5 : out std_logic_vector(2 downto 0); counto3 : out std_logic_vector(2 downto 0) ); end component; component AddrGenerate port ( SdramClk : in std_logic; --!由頂層模塊提供 reqack : in std_logic; --!由state_machine提供 reset: in std_logic; --cmdlengthcount: in std_logic_vector(9 downto 0); --!由state_machine提供 --PageWrfstAdr : in std_logic_vector(11 downto 0); --!??頁寫首地址,固定 --PageRdfstAdr : in std_logic_vector(11 downto 0); --!??頁讀首地址復位信號 PageWrfstAdr : in std_logic_vector(13 downto 0); --!??頁寫首地址,固定 PageRdfstAdr : in std_logic_vector(13 downto 0); --!??頁讀首地址復位信號 OperationReq : in std_logic_vector(2 downto 0); PageWeAdrSet : in std_logic; --!頁寫首地址復位信號 PageRdAdrSet : in std_logic; --!頁讀首地址復位信號 ADDR : out std_logic_vector(22 downto 0); --??!給sdr_sdram模塊 HostRd : in std_logic; HostAdr : in std_logic_vector(22 downto 0); --!??隨機的地址 FIFO1Data : in std_logic_vector(15 downto 0); --!頂層模塊提供的,寫入的數據 DataOut : out std_logic_vector(15 downto 0); FIFO2Data : out std_logic_vector(15 downto 0); DataIn : in std_logic_vector(15 downto 0); HostDataout : out std_logic_vector(15 downto 0); --隨機讀寫數據 HostDatain : in std_logic_vector(15 downto 0); --隨機讀寫數據 sdramin : out std_logic_vector(15 downto 0); --隨機讀寫
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -