计数器VHDL多路复用器7段

计数器VHDL多路复用器7段,vhdl,spartan,seven-segment-display,Vhdl,Spartan,Seven Segment Display,我不熟悉VHDL,我的代码可能看起来很愚蠢,但我仍在努力。 我正在尝试使用斯巴达3套件制作BCD计数器。 我有一个问题,多路复用7段,我知道我应该使用组件 但我选择了更简单的方法。 我在合成中得到这个错误:“第103行:过程灵敏度列表中缺少一个或多个信号”。为了能够合成FPGA/CPLD硬件,XST将假设所有必要的信号都存在于灵敏度列表中。请注意,合成结果可能与初始设计规范不同。缺失的信号是: 谢谢你的帮助。多谢各位 library IEEE; use IEEE.STD_LOGIC_1164.a

我不熟悉VHDL,我的代码可能看起来很愚蠢,但我仍在努力。 我正在尝试使用斯巴达3套件制作BCD计数器。 我有一个问题,多路复用7段,我知道我应该使用组件 但我选择了更简单的方法。 我在合成中得到这个错误:“第103行:过程灵敏度列表中缺少一个或多个信号”。为了能够合成FPGA/CPLD硬件,XST将假设所有必要的信号都存在于灵敏度列表中。请注意,合成结果可能与初始设计规范不同。缺失的信号是: 谢谢你的帮助。多谢各位

library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity lab5 is
  port (clk      : in  std_logic;
        x        : in  std_logic;
        --count : inout  STD_LOGIC_VECTOR (3 downto 0);
        data_out : out std_logic_vector (6 downto 0);
        an       : out std_logic_vector (3 downto 0)
        );

end lab5;

architecture Behavioral of lab5 is
  signal counter    : std_logic_vector (3 downto 0) := (others => '0');
  signal prescaler  : std_logic_vector (25 downto 0);
  signal prescaler2 : std_logic_vector (11 downto 0);
  signal counter2   : std_logic_vector (1 downto 0) := (others => '0');
begin

  CounterProcess : process(CLK, x)
  begin
    --prescaler is used as a clock slower to increment the counter every 50M cycles(1 sec)
    if rising_edge(CLK) then
      if prescaler < "10111110101111000010000000" then
        prescaler <= prescaler+1;

      else
        prescaler <= (others => '0');
        if x = '0' then
          if counter = "1001" then
            counter <= "0000";
          else
            counter <= counter+1;
          end if;
        else
          if counter = "0000" then
            counter <= "1001";
          else
            counter <= counter-1;
          end if;
        end if;
      end if;
    end if;

  end process;

--count<=counter;

  Sevensegclock : process(CLK)
  begin
    if rising_edge(CLK) then
      --scale clock to count(which will be the segment selector) every 1024 cycle
      if prescaler2 < "010000000000" then
        prescaler2 <= prescaler2+1;

      else
        prescaler2 <= (others => '0');
        if counter2 = "11" then
          counter2 <= "00";
        else
          counter2 <= counter2+1;
        end if;
      end if;
    end if;

  end process;

  sevenseg : process(counter2, clk)
  begin
    --counter the segment selector used to activate selector and decode data
    if counter2 = "00" then
      an <= "1110";
      if counter(0) = '0' then
        data_out <= "0000001";
      else
        data_out <= "1001111";
      end if;

    end if;

    if counter2 = "01" then
      an <= "1101";
      if counter(1) = '0' then
        data_out <= "0000001";
      else
        data_out <= "1001111";
      end if;
    end if;

    if counter2 = "10" then
      an <= "1011";

      if counter(2) = '0' then
        data_out <= "0000001";
      else
        data_out <= "1001111";
      end if;
    end if;

    if counter2 = "11" then
      an <= "0111";
      if counter(3) = '0' then
        data_out <= "0000001";
      else
        data_out <= "1001111";
      end if;
    end if;

  end process;

end Behavioral;
IEEE库;
使用IEEE.STD_LOGIC_1164.all;
使用IEEE.STD_LOGIC_ARITH.all;
使用IEEE.STD_LOGIC_UNSIGNED.all;
----如果正在实例化,请取消对以下库声明的注释
----此代码中的任何Xilinx原语。
--UNISIM图书馆;
--使用UNISIM.VComponents.all;
实体lab5是
端口(时钟:在标准逻辑中;
x:在标准逻辑中;
--计数:输入标准逻辑向量(3到0);
数据输出:输出标准逻辑向量(6到0);
an:out标准逻辑向量(3到0)
);
末端lab5;
lab5的体系结构是
信号计数器:标准逻辑向量(3到0):=(其他=>“0”);
信号预分频器:标准逻辑向量(25到0);
信号预分频器2:标准逻辑向量(11到0);
信号计数器2:std_逻辑_向量(1到0):=(其他=>'0');
开始
反进程:进程(CLK,x)
开始
--预分频器用作时钟,每50M周期(1秒)递增计数器
如果上升沿(CLK),则
如果预分频器<“101111101011100000000000”,则

预分频器一个开始的地方是为每个流程确定它是否实现 顺序元件(触发器)或组合元件(门)

实现顺序元素(触发器)的流程模板, 如果没有异步重置,可以:

process (clk) is
begin
  if rising_edge(clk) then
    -- Code for assign to flip-flop outputs at rising edge
  end if;
end process;
实现组合元素(门)的流程模板可以 是:

请注意,
(all)
仅在VHDL-2008语法中可用,否则在以前的VHDL中可用 版本语法在灵敏度列表中明确列出所有信号

匹配其中一个模板使合成工具确定如何 实现VHDL代码中描述的设计。但是,如果代码匹配 无论是哪种模板,合成工具都可能有困难 确定如何在FPGA中实现VHDL代码,结果可能是 错误消息,与您得到的消息相同

基于模板,流程
Sevensegclock
实现了一个顺序 元素(触发器),这个过程应该没有问题

但是,
CounterProcess
sevenseg
两个进程都不匹配 顺序或组合元素的模板

对于进程
反进程
,看起来您想要实现一个 顺序元件(触发器),但灵敏度列表中包含
x
。这个 解决方案可能是从灵敏度列表中删除
x

对于流程
sevenseg
,看起来您想要实现一个组合 元件(门),但灵敏度列表并未涵盖所使用的所有信号 在流程中,甚至包括流程中未使用的
clk
。 如果使用VHDL-2008,解决方案是将灵敏度列表替换为
(全部)
,如果使用以前的VHDL版本,则创建灵敏度列表 覆盖过程中使用的所有信号
(计数器2,计数器)

免责声明:我没有检查中代码的逻辑正确性 过程所以以上只是给出一些关于如何写作的一般性指导 处理,以便在FPGA中制作不同类型的设计元素

process (all) is  -- "all" make sensitivity on all used signals
begin
  -- Code for assign to gate outputs
end process;