一段VHDL程序,有可能同时写同一信号出错。。寻求有效简单解决方法 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;
entity main is generic(width:integer:=5); port( data:in std_logic_vector(width-1 downto 0); clk:in std_logic; write:in std_logic; pulse:out std_logic ); end entity;
architecture behave of main is signal curcnt,cnt:std_logic_vector(width-1 downto 0); begin process(data,clk,write) begin if write='1' then curcnt<=data; wb:='0'; end if; if clk'event and clk='1' then cnt<=cnt-1; if cnt=1 then pulse<='1'; cnt<=curcnt; curcnt<="00001"; --出问题就是这了。。可能同时写一个信号; else pulse<='0'; end if; end if; end process; end behave;
|