Digit0001
Member level 1
Hi
Can someone suggest how would i combine the following code into one process? The code is made up of a counter and a state machine which i want to make as one process. The problem i am having at the moment is the count will not work because it conflicts, hence i want to make it in one process.
P.S
Can someone suggest how would i combine the following code into one process? The code is made up of a counter and a state machine which i want to make as one process. The problem i am having at the moment is the count will not work because it conflicts, hence i want to make it in one process.
Code:
architecture Behavioural of pulseDesign is
type StateType is (LowState,HighState);
signal nextState,state : StateType;
signal count : std_logic_vector(3 downto 0);
begin
---------------------------------------------
--Counter
process(clk,reset,count)
begin
if(rising_edge(clk)) then
State <= nextState;
if(reset='1') then
count <= "0000";
State <= LowState;
else
count <= count + '1';
end if;
end if;
end process;
---------------------------------------------
--StateMachine
process(state,pulse)
begin
temp <= "0000";
case state is
when LowState =>
if(pulse = '1') then
temp <= count;
count <= "0000";
nextState <= LowState;
else
count <= count + 1;
nextState <= HighState;
end if;
when HighState =>
if(pulse = '1') then
count <= count + 1;
nextState <= HighState;
else
count <= count + 1;
nextState <= LowState;
end if;
end case;
end process;
end Behavioural;
P.S