萍聚社区-德国热线-德国实用信息网

 找回密码
 注册

微信登录

微信扫一扫,快速登录

萍聚头条

查看: 805|回复: 5

[电子] 请教关于vdhl的问题

[复制链接]
发表于 2007-7-6 13:03 | 显示全部楼层 |阅读模式

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

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

x
上课的时候学习vhdl都是用电脑仿真的。测试的时候也只是在电脑模拟结果。
现在因为要做一个project,需要用到xilinx vertix4开发板。真正接触实物。
现在想先编一个简单的程序实验一下。但出现问题了。编了一个binary counter。用开发板上用4个led灯显示。但程序传到板上的时候,应该是时钟太快了,根本看不清灯的闪烁。想问问,如何能在程序里面加入一个空转的命令,使之闪烁的速度慢点?可以用肉眼看得请。 wait for 的命令只能在仿真中用。所以不知道应该怎么做。
clock的频率是100MHz的,输出到led的时候闪得很快。肉眼完全看不出led在闪。我想能不能用loop什么的,可以让时钟空转,达到减慢时钟的频率,看得清闪烁。
记得学汇编的时候就有让alu空转的方法。但vhdl不知道应该怎么办
请高手指教。谢谢!
源程序
entity counter is
Port ( clock : in STD_LOGIC;
direction : in STD_LOGIC;
count_out : out STD_LOGIC_VECTOR (3 downto 0));
end counter;

architecture Behavioral of counter is
signal count_int : std_logic_vector(3 downto 0) := "0000" ;
begin
process (clock)
begin
if clock='1' and clock'event then
if direction='1' then
count_int <= count_int + 1;
else
count_int <= count_int - 1;
end if;
end if;
end process;

count_out <= count_int;

end Behavioral;
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
头像被屏蔽

TA的专栏

发表于 2007-7-6 16:55 | 显示全部楼层
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
发表于 2007-7-6 17:09 | 显示全部楼层
先看你板子的外部时钟是多少,然后用循环几千次处理一次的方法,等效的放慢时钟。
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
 楼主| 发表于 2007-7-6 19:59 | 显示全部楼层
原帖由 eisenstange 于 2007-7-6 17:09 发表
先看你板子的外部时钟是多少,然后用循环几千次处理一次的方法,等效的放慢时钟。

这也是我想到的。但我应该怎么做呢?
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
发表于 2007-7-6 20:40 | 显示全部楼层
你可以这样干。
entity Divider is
Port ( clock_in : in STD_LOGIC;
         clock_out : out STD_LOGIC);
end Divider;

architecture Behavioral of Divider is
signal cnt : std_logic_vector(15 downto 0) := "0000_0000_0000_0000" ;
begin
process (clock_in)
begin
    if clock='1' and clock'event then
         cnt <= cnt_int + 1;
         if cnt>"0111_1111_1111_1111";
             clock_in<='1';
         else
             clock_in<='0';
         end if;
    end if;
end process;
end Behavioral;

然后再写一个顶层模块,把这个模块和你的模块连起来就可以了。

评分

1

查看全部评分

Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
发表于 2007-7-6 21:02 | 显示全部楼层
原帖由 aileute 于 2007-7-6 20:40 发表
你可以这样干。
entity Divider is
Port ( clock_in : in STD_LOGIC;
         clock_out : out STD_LOGIC);
end Divider;

architecture Behavioral of Divider is
signal cnt : std_logic_vector(15 d ...


这是一个办法,但是有点不明白的是,为什么要用Std_logic_vector呢,用整型不是更方便么,而且可以用Gernic在接口定义,这样可以在知道了线路传输延迟以后再传进去。

不知道这种想法对不对。
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
您需要登录后才可以回帖 登录 | 注册 微信登录

本版积分规则

手机版|Archiver|AGB|Impressum|Datenschutzerklärung|萍聚社区-德国热线-德国实用信息网 |网站地图

GMT+2, 2024-5-6 07:41 , Processed in 1.336986 second(s), 23 queries , MemCached On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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