找回密码
 注册

手机号码,快捷登录

手机号码,快捷登录

查看: 2573|回复: 0

FPGA访问SRAM,求助!!急!!  

[复制链接]
发表于 2006-4-15 23:16:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
小弟用FPGA访问外部sram,用状态机实现,先向地址0x1里写了一个数2,再向地址0x2里写了一个数4,然后读地址0x1的数,始终不对!
程序如下,请各位指教:如有更好的方法请赐教!
library ieee;
use ieee.std_logic_1164.all;
entity sram is
port (
       clk,rst : in std_logic;
       saddr : out std_logic_vector(16 downto 0);
       dataio: out std_logic_vector(15 downto 0);
       sram_wrenut std_logic;--sram写使能,低有效
       sram_rdenut std_logic;--sram输出使能,低有效
       sdata : inout std_logic_vector(15 downto 0)
       )
end sram ;
architecture behavor of i486_bus is
signal state,next_state :std_logic_vector(1 downto 0);
begin
process(clk)
begin
   if rst='1'then
       state<="00";
   elsif clk'event and clk='1'then
       state<=next_state;
   end if;
end process;
process(state)
begin
case state is
       when "00"=>
               sram_wren<='0';--写数据
               sram_rden<='1';
               saddr<="00000000000000001";--地址0x1
               sdata<="0000000000000100";--写入数据 4
               next_state<="01";
       when "01"=>
               sram_wren<='0';--写数据
               sram_rden<='1';
               saddr<="00000000000000010";--地址0x2
               sdata<="0000000000000010";----数据2
               next_state<="10";
       when "10"=>
               sram_wren<='1';--读数据
               sram_rden<='0';
               saddr<="00000000000000010";--地址0x2
               dataio<=sdata;--数据输出到io口上,测量该io口数据不对
               next_state<="10";--循环读该地址
       end case;
end process;
您需要登录后才可以回帖 登录 | 注册

本版积分规则


QQ|手机版|小黑屋|关于我们|联系我们|隐私声明|EETOP 创芯网 ( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2026-1-16 07:24 , Processed in 0.034163 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表