老曦子博客

记录我学习生活的小博客(FPGA/SOPC)

« VHDL生成PWM是很简单的[学习记录]Quartus错误大全【转载】 »

VHDL并转串其实很容易

刚刚学习的时候经常用到case语句实现,导致有很多毛刺产生,下面小程序可以避免这种现象发生。

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity ww is
port(
clk:in std_logic;
inda:in std_logic_vector(4 downto 0);
data:out std_logic);
end ww;

architecture one of ww is
begin
process(clk)
variable d:integer range 0 to 4 :=0;

begin
if clk'event and clk='1' then
    data<=inda(d);
    d:=d+1;
end if;
end process;
end one;

 

短小,但是很好用哦~

热文排行

随机文章

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-Blog 1.8 Spirit Build 80722

Laoxizi's Blog FPGA/SOPC 文章转载请联系作者