0
我有两个进程使用的信号它们之间进行同步的值,则使用的信号是休耕的方式:如何让两个过程来改变相同的信号
type state_machine_1 is
(st1_state_idle, st1_state_1, st1_state_2, st1_state_3,
st1_state_4,st1_state_5,st1_state_6);
type state_machine_2 is
(st2_state_idle, st2_state_1, st2_state_2);
--...
signal st1 : state_machine_1;
signal st2 : state_machine_2;
signal sync_sig : std_logic;
--...
st1_proc: process (CLK, RESET)
begin
if (RESET = '1') then
st1 <= st1_state_idle;
sync_sig <= '0';
elsif rising_edge(CLK) then
case st1 is
when st1_state_idle =>
--...
sync_data_is_ready_for_cau <= '0';
if (START = '1') then
st1 <= st_state_1;
else
st1 <= st1_state_idle;
end if;
----------------
when st_state_1 =>
--...
st1 <= st_state_2;
----------------
when st_state_2 =>
--...
st1 <= st_state_3;
----------------
when st_state_3 =>
--...
if (sync_sig = '0') then
st1 <= st_state_5;
else
st1 <= st_state_4;
end if;
----------------
when 4 =>
if (sync_sig = '0') then
st1 <= st_state_5;
else
st1 <= st_state_4;
end if;
----------------
when st_state_5 =>
--...
sync_sig <= '1';
st1 <= st_state_1;
end case;
end if;
end process;
st2_proc: process (CLK, RESET, reset_for_st2)
begin
if (RESET = '1' or reset_for_st2 = '1') then
st2 <= st2_state_idle;
elsif (rising_edge(CLK)) then
case st2 is
when st2_state_idle =>
if (sync_sig = '1') then
st2 <= st2_state_1;
else
st2 <= st2_state_idle;
end if;
----------------
when st2_state_1 =>
--...
st2 <= st2_state_2;
----------------
when st_state_2 =>
--...
st2 <= st2_state_3;
----------------
when st2_state_3 =>
--...
sync_sig <= '0';
st2 <= st2_state_idle;
----------------
end case;
end if;
end process;
所有--...
是逻辑不接触同步信号,不接触状态信号(有些情况下,如果等待某个信号来提升状态)。因此,放入同步信号的值之间不会有任何冲突,但仿真(Altera Model-Sim)会给信号赋予一个U
值。我如何使用信号在进程之间进行同步?
也许[this](http://stackoverflow.com/questions/9084975/vhdl-driving-signal-from-different-processes)可以帮助你。 – hr0m