Vhdl 如何允许两个进程更改同一信号的值
我有两个进程使用信号在它们之间进行同步,使用的信号是衰减方式:Vhdl 如何允许两个进程更改同一信号的值,vhdl,Vhdl,我有两个进程使用信号在它们之间进行同步,使用的信号是衰减方式: 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
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;
类型状态\u机器\u 1为
(st1_状态_空闲、st1_状态_1、st1_状态_2、st1_状态_3、,
st1_州4、st1_州5、st1_州6);
类型状态_机器_2为
(st2_状态_空闲、st2_状态_1、st2_状态_2);
--...
信号st1:状态机1;
信号st2:状态机2;
信号同步信号:标准逻辑;
--...
st1_过程:过程(时钟、复位)
开始
如果(重置='1'),则
st1'U'(未初始化)仅在模拟开始时未激活reset
时出现。当两个FSM发生冲突时,您实际上应该得到“X”,因为您在sync\u sig
上有多个驱动程序。当解析类型上有多个驱动程序时,这是正常和预期的行为
看起来您希望每个FSM在“1”和“0”之间切换sync\u sig
的状态。这可以通过在单独的过程中描述JK触发器来实现,每个FSM单独驱动set和clear信号。这样做将消除多个驱动程序,并允许FSM进行互操作
<> P>从这个问题中拯救自己,考虑使用未解决的<代码> STDIULGOICIC< /COD>和<代码> STDYULGOICICVARION/<代码>。如果您错误地描述了多个驱动程序,您将得到一个编译器错误。解析类型实际上只适合于行为模拟和管理双向IOs。它们不应该是整个设计信号的“默认值”。也许对您有所帮助。