小弟现要把一段Verilog的程序转成vhdl,用的是X-hdl软件,
always@(negedge clock or posedge reset)
begin
if(reset) cnt <= 6;
else
if(cnt >= 5)
cnt <= 0;
else
cnt <= cnt + 1;
end
转出来后是
PROCESS
BEGIN
WAIT UNTIL (clock'EVENT AND clock = '0') OR (reset'EVENT AND reset = '1');
IF (reset = '1') THEN
cnt <= "110";
ELSE
IF (cnt >= "101") THEN
cnt <= "000";
ELSE
cnt <= cnt + "001";
END IF;
END IF;
END PROCESS;
报的错是
Error (10628): VHDL error at control_vhd.vhd(81): can't implement register for two clock edges combined with a binary operator
我的理解是一个2个时钟的沿不能再一个wait until 中,小弟稍稍懂一点,于是改了改
PROCESS( clock,reset )
BEGIN
if( reset = '1' ) then --复位的上升沿
cnt <= "110";
ELSif(clock ='0' ) then--时钟下降沿
IF (cnt >= "101") THEN
cnt <= "000";
ELSE
cnt <= cnt + "001";
END IF;
END IF;
END PROCESS;
可结果不对,也不知道要怎么改了
高人出来帮帮我吧!
begin -- process
if rst_n_i = '0' then
a <= '0';
-- activities triggered by rising edge of clock
elsif clk_i'event and clk_i = '1' then
if stop_i = '0' then
a <= 1;
else
a <= '0';
end if;
end if;
end process;