【问题标题】:Non resolved signal has multiple sources VHDL非解析信号有多个来源 VHDL
【发布时间】:2014-12-29 15:44:53
【问题描述】:

我正在使用 VHDL 实现一个简单的 FSM。 我用 VHDL 编写了这段代码,但出现了这个错误:“未解析的信号 NS 有多个来源”。我深入查看了代码,但无法找出错误 谁能帮我解决这个问题?

                     library ieee ;
                     use ieee.std_logic_1164.all ;
                     entity MeallyMachine is
                     port( 
                     x,res,clk:in std_logic;
                     z1,z2:out std_logic       
                     );

                    end MooreMachine;


                    architecture M1 of MooreMachine is
                    type state_type is(s0,s1,s2,s3);
                    signal PS,NS:state_type;

                     begin
                     ETAT:process(PS,x)
                     begin
                     case PS is
                      when  s0=>  if (x='0') then
                      NS<=s0;
                                 elsif (x='1') then
                                 NS<=s1;
                                 end if;
                     when s1=>  if (x='0') then
                      NS<=s1;
                                elsif (x='1') then
                      NS<=s2;
                                end if;  
                     when s2=>  if (x='0') then
                     NS<=s2;
                                elsif (x='1') then
                     NS<=s3;
                                 end if;
                     when s3=>  if (x='0') then
                     NS<=s3;
                                 elsif (x='1') then
                     NS<=s0;
                                 end if;
                     end case;
                   end process ETAT;
                Sortie:process(PS,x)
                  begin
                   case PS is
                      when s0=>  
                            z1<='1';
                        if (x='0') then
                            z2<='0';
                         elsif (x='1') then
                            z2<='1';
                          end if;
                      when s1=>   
                            z1<='1';
                       if (x='0') then
                            z2<='0';
                       elsif (x='1') then
                        z2<='1';
                       end if;  
                     when s2=>  z1<='0';
                      if (x='0') then
                        z2<='0';
                      elsif (x='1') then
                        z2<='1';
                      end if;
                   when s3=>   z1<='1';
                        if (x='0') then
                         z2<='0';
                        elsif (x='1') then
                         z2<='1';
                        end if;
                   end case;
                end process Sortie;
           Horloge:process(clk,res,NS)
                begin
                 if (res='0') then
                      NS<=s0;
                 elsif (rising_edge(clk)) then 
                      PS<=NS;
                 end if;
                 end process Horloge;




         end M1;

【问题讨论】:

  • 我猜你忘了在实体和架构的末尾将MooreMachine 更改为MealyMachine。可能不是问题,但不是很好;-)
  • 就是这样。感谢您的关注:)

标签: vhdl fsm


【解决方案1】:

您的错误消息:non resolved signal NS has multiple sources 还包含导致多驱动程序问题的源代码行。查看完整的 Xilinx XST 综合报告。

此外,您的代码有多个复制粘贴错误:

  1. entity MeallyMachine is 应该是 entity MooreMachine is 因为你的架构引用了 MoorMachine
  2. NS&lt;=s0; 应该是 PS&lt;=s0; 来解决多驱动问题
  3. 您的 FSM 不是 Moore FSM,因为输出取决于当前状态和输入 process(PS,x)

【讨论】:

  • 你能解释一下为什么 NS
  • 通常,NS 代表 NextState,PS(我不知道 P 在法语中是什么意思)代表 CurrentState。因此,如果复位res 处于活动状态(您使用的是低电平有效复位,这在片上设计中并不常见),则应将PS 设置为初始状态s0,否则如果出现上升沿, NS 应保存在 PS 中。这只是 n 进程 FSM 模式。 -- 多驱动问题是由NS 上的2 个进程写入 引起的。只有一个进程可以驱动相同的信号,否则你需要一个解析函数或门/逻辑来解决这个冲突。
  • 清澈如水!谢谢。顺便说一句,P 代表“现在”(英文实际)
  • 哦,抱歉,我看到了“Sortie”和“Horloge”,并假定了法语标识符:)
猜你喜欢
  • 2022-08-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-30
  • 2013-03-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多