首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

关于VHDL程序,为什么这么简单的功能都不好实现

我做了一个如下的程序,看看符合你的要求吗? library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity test is port( clk:in std_logic; reset:in std_logic; a:in std_logic_vector(1 downto 0); b:in std_logic_vector(1 downto 0); c:in std_logic_vector(1 downto 0); dut std_logic_vector(4 downto 0) ); end test; architecture rtl of test is signal pc:std_logic_vector(4 downto 0); signal i:std_logic_vector(1 downto 0); signal en:std_logic; begin process(clk,reset) variable add_a:std_logic_vector(4 downto 0); variable add_b:std_logic_vector(4 downto 0); variable temp:std_logic_vector(4 downto 0); begin add_a:="000"&a; if(reset='0')then pc<="00000"; i<="00"; en<='1'; elsif (clk'event and clk='1')then if(en='1')then if(i<=c)then add_b(3 downto 0):=i*b; add_b(4):='0'; else en<='0'; end if; temp:=add_a+add_b; if(pc=temp)then d<=pc; i<=i+1; pc<=pc+1; else pc<=pc+1; end if; end if; end if; end process; end rtl;
返回列表