在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 6141|回复: 2

问个lpm_ram_dq的问题

[复制链接]
发表于 2008-5-1 13:13:24 | 显示全部楼层 |阅读模式

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

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

x



我在学习使用FPGA里面的RAM资源,但是不知道应该怎么使用。只知道可以用lpm_ram_dq这个IP核,所以我自己写了个验证的程序,但是没有成功,大家帮我看看。


我的原理图如下:



                               
登录/注册后可看大图




intram模块的程序如下:


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity intram is
port(
   clock:in std_logic;
   clock_in,clock_outut std_logic;
   datafrommem:in integer range 0 to 255;
   datatomemut integer range 0 to 255;
   address:buffer integer range 0 to 255;
   weut std_logic;
   correctut std_logic
);
end;
architecture ramcontroller of intram is
signal counter:integer range 0 to 3;
signal data:integer range 0 to 255;
begin
   process(clock)
   begin
      if(rising_edge(clock))then
         if(counter=counter'high)then
            counter<=0;
         else
            counter<=counter+1;
         end if;
      end if;
   end process;
   process(clock)
   begin
      if(rising_edge(clock))then
         if(counter=0)then
            if(address=255)then
               address<=0;
            else
               address<=address+1;
            end if;
         elsif(counter=1)then
            datatomem<=address;
            we<='1';
         elsif(counter=2)then
            we<='0';
         elsif(counter=3)then
            if(datafrommem=address)then
               correct<='1';
            else
               correct<='0';
            end if;
         end if;
      end if;
   end process;
   process(counter,clock)
   begin
      if(falling_edge(clock))then
         case counter is
            when 2 =>clock_in<='1';
            when 3 =>clock_out<='1';
                     clock_in<='0';
            when others =>clock_in<='0';
                     clock_out<='0';
         end case;
      end if;
   end process;
end ramcontroller;



我说说我对lpm_ram_dq元件的理解不知道错没错:

lpm_ram_dq在we为高电平时,在inclock的上升沿把data[7..0]写入地址为address[7..0]的内部存储单元。
lpm_ram_dq在we为低电平时,在outclock的上升沿把地址为address的内部存储单元的数据从q[7..0]输出。



我的仿真时序如下:  


                               
登录/注册后可看大图


如果我上面对lpm_ram_dq的理解没有错的话,那么我的所有时序都是按照我的思路产生的啊,怎么在counter为3的时候lpm_ram_dq没有从RAM中读出数据啊?或者是我在conuter为2的时候根本就没有把数据写入RAM?

望大家多多指教!!!
 楼主| 发表于 2008-5-3 09:53:14 | 显示全部楼层
有人吗·?????????????????????
发表于 2008-5-3 23:52:55 | 显示全部楼层
没有听说过吗?工程师最讨厌分析别人的程序!
一个这么长的程序拿到这里来恐怕没有几个人看!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-12 12:59 , Processed in 0.020617 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表