⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controller.vhd

📁 sdram控制器
💻 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 + -