graphene
Full Member level 2
- Joined
- Mar 22, 2012
- Messages
- 129
- Helped
- 4
- Reputation
- 8
- Reaction score
- 3
- Trophy points
- 1,298
- Location
- Germany
- Activity points
- 2,181
Hi,
I am designing an FSM for my project. I am from SW background but new to VHDL and Xilinx.
1) I have a counter with just CLOCK, and RESET inputs and a OUTPUT
2) I have a PISO with RESET, CLOCK, PARALLEL DATA and LOAD inputs and SERIAL OUTPUT.
I now need to create an FSM that controls how the 2 components (Counter and PISO) are controlled.
The problem is despite any eforrts the output when IN_COUNT, IN_LOW_SYNC are asserted doesnt impact on my simulation results.
Can you help me with this. And also any tutorial on how to frame a BUBBLE DIAGRAM for MEALY state machines will be very helpful to me.
The code for the FSM is given below
I am designing an FSM for my project. I am from SW background but new to VHDL and Xilinx.
1) I have a counter with just CLOCK, and RESET inputs and a OUTPUT
2) I have a PISO with RESET, CLOCK, PARALLEL DATA and LOAD inputs and SERIAL OUTPUT.
I now need to create an FSM that controls how the 2 components (Counter and PISO) are controlled.
The problem is despite any eforrts the output when IN_COUNT, IN_LOW_SYNC are asserted doesnt impact on my simulation results.
Can you help me with this. And also any tutorial on how to frame a BUBBLE DIAGRAM for MEALY state machines will be very helpful to me.
The code for the FSM is given below
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fsm_for_dac is
port(
IN_CLK : in STD_LOGIC;
IN_RST : in STD_LOGIC;
IN_COUNT : in STD_LOGIC; -- logic 1 or 0 that disables or enables count respectively
IN_LOW_SYNC : in STD_LOGIC;
-- general outputs
OUT_RST : out STD_LOGIC; -- common output for both PISO AND Counter
-- output to PISO
OUT_SYNC : out STD_LOGIC; -- SYNC output to the PISO
OUT_LOAD : out STD_LOGIC; -- LOAD that enables the PISO
OUT_DATA : out STD_LOGIC -- PARALLEL DATA to the PISO
);
end fsm_for_dac;
architecture Behavioral of fsm_for_dac is
type fsm_state is (state_reset, state_sync, state_piso);
signal present_state, next_state : fsm_state;
begin
clk_process: process (IN_CLK)
begin
if (rising_edge(IN_CLK)) then
if (IN_RST='1') then
present_state <= state_reset;
else
present_state <= next_state;
end if;
end if;
end process clk_process;
next_state_process: process(present_state, IN_RST,IN_LOW_SYNC, IN_COUNT) --
begin
case present_state is
when state_reset =>
if (IN_RST='1') then
next_state <= state_reset; -- it remains on the same reset state
else
next_state <= state_sync; -- if IN_LOW_SYNC is '0', then piso operation starts
end if;
when state_sync =>
if (IN_RST='1') then
next_state <= state_reset;
elsif (IN_COUNT='0') then
next_state <= state_piso;
else
next_state <= state_sync;
end if;
when state_piso =>
if (IN_RST='1') then
next_state <= state_reset;
elsif (IN_COUNT='0') then
next_state <= state_piso; -- if IN_LOW_SYNC is '0', then piso operation
else
next_state <= state_reset;
end if;
end case;
end process next_state_process;
output_process: process(present_state, IN_RST, IN_COUNT)
begin
case present_state is
when state_reset =>
OUT_RST <= '1';
OUT_SYNC <= '1';
OUT_DATA <= '0';
OUT_LOAD <= '0';
-- when state_sync =>
-- OUT_RST <= '0';
-- OUT_SYNC <= '0';
-- OUT_DATA <= '1';
-- OUT_DATA <= '0';
when state_piso =>
OUT_RST <= '0';
OUT_SYNC <= '0';
OUT_DATA <= '1';
OUT_LOAD <= '1';
when others =>
OUT_RST <= '1';
OUT_SYNC <= '1';
OUT_DATA <= '0';
OUT_DATA <= '0';
OUT_LOAD <= '0';
end case;
end process output_process;
end Behavioral;