Altera_Forum
Honored Contributor
13 years agoI am not sure why this happen.. (process problem)
Hi. I made two same codes about BCD adder and first code is working well, but second code had a problem.The only diffence between two code is the sensitivity list.
first code includes bin_result, and second code doesn't. when I test the two code in Model_sim.. first code show me the bcd_result output. but second code doesn't show me the bcd_result( just show me the redline ) I want to know why first code show me the bcd_result output and second code can't! (1) LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; -- Using If-else USE IEEE.STD_LOGIC_UNSIGNED.ALL; --BCD correction adder ENTITY bcd_adder is PORT( astring : in std_logic_vector(7 downto 0); bstring : in std_logic_vector(7 downto 0); bcd_result : out std_logic_vector(7 downto 0)); end bcd_adder; Architecture arc of bcd_adder is signal bin_result : std_logic_vector(7 downto 0); -- initial interconnection signal BEGIN bin_result<= astring + bstring; -- initial interconnection signal PROCESS(astring,bstring,bin_result) BEGIN IF bin_result>"1001" -- 맨 오른쪽부터 LSB THEN bcd_result <= bin_result+"00110"; else bcd_result <= bin_result; end if; end process; end arc; ------------------------------------------------- (2) LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; -- Using If-else USE IEEE.STD_LOGIC_UNSIGNED.ALL; --BCD correction adder ENTITY bcd_adder_error is PORT( astring : in std_logic_vector(7 downto 0); bstring : in std_logic_vector(7 downto 0); bcd_result : out std_logic_vector(7 downto 0)); end bcd_adder_error; Architecture arc of bcd_adder_error is signal bin_result : std_logic_vector(7 downto 0); -- initial interconnection signal BEGIN bin_result<= astring + bstring; -- initial interconnection signal PROCESS(astring,bstring) -- Think about the reason why i include the bin_result BEGIN IF bin_result>"00001001" THEN bcd_result <= bin_result+"00000110"; else bcd_result <= bin_result; end if; end process; end arc;