Altera_Forum
Honored Contributor
16 years agoThe problem of multi_cycle custom instruction
Hi!
I want to learn the multi_cycle custom instruction,so I write an code randomly. but the instruction didn't work in the NIOS IDE.I cann't find the error of the code,please help me. library ieee; use ieee.std_logic_unsigned.all; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; entity move is port(dataa:in std_logic_vector(31 downto 0); datab:in std_logic_vector(31 downto 0); result:out std_logic_vector(31 downto 0); clk:in std_logic; clk_en:in std_logic; start:in std_logic; reset:in std_logic; done:out std_logic); end move; architecture behave of move is signal t:std_logic_vector(3 downto 0); signal a:std_logic_vector(31 downto 0); signal b:std_logic_vector(31 downto 0); begin process(clk,clk_en,reset) begin if(clk_en='1')then if(start='1')then a<=dataa; b<=datab; t<="0000"; elsif(t<"1111")then if(clk'event and clk='1')then a<=a+1; b<=b+1; t<=t+1; end if; end if; end if; end process; process(t,a,b) begin if(t="1111")then done<='1'; result<=a+b; else done<='0'; end if; end process; end behave; thanks in advance!