Can';我的VHDL代码没有模拟

Can';我的VHDL代码没有模拟,vhdl,simulation,Vhdl,Simulation,我正在寻找问题的原因或答案,即: 我的VHDL代码正在运行,我正在尝试创建一个10倍的分频器。 问题是模拟报告一直给我一个未定义的输出(没有值) 这是我的VHDL代码,如果有任何帮助,我将不胜感激!谢谢大家! Library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity Frequency_divider is port(clk:

我正在寻找问题的原因或答案,即: 我的VHDL代码正在运行,我正在尝试创建一个10倍的分频器。 问题是模拟报告一直给我一个未定义的输出(没有值)

这是我的VHDL代码,如果有任何帮助,我将不胜感激!谢谢大家!

Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity Frequency_divider is 
port(clk: in std_logic;
     Q:out std_logic);
end Frequency_divider;

architecture desc_freq_divider_10 of Frequency_divider is 


signal S: std_logic:='0';
begin

process(clk,S)
    variable cpt: integer:=0;
    begin

        if (rising_edge(clk)) then 
            cpt:=cpt+1;
        end if;

        if (cpt=5) then 
            S<=not(S);
            cpt:=0;
        end if;

    end process;    
    Q<=S;
end desc_freq_divider_10;       
ieee库;
使用ieee.std_logic_1164.all;
使用ieee.std_logic_arith.all;
使用ieee.std_logic_unsigned.all;
实体分频器为
端口(时钟:在标准逻辑中;
Q:输出标准(U逻辑);
端分频器;
分频器的结构描述为
信号S:std_逻辑:='0';
开始
过程(时钟,S)
变量cpt:integer:=0;
开始
如果(上升沿(clk)),则
cpt:=cpt+1;
如果结束;
如果(cpt=5),则

S我去掉了无关的use子句:

--use ieee.std_logic_arith.all;
--use ieee.std_logic_unsigned.all;
增加了一个试验台:

library ieee;
use ieee.std_logic_1164.all;

entity freq_test is
end entity;

architecture tb of freq_test is
    signal CLK:     std_logic :='0';
    signal Q:       std_logic;
begin

CLOCK:
    process
    begin
        if Now < 300 ns then
            wait for 10 ns;
            clk <= not clk;
        else
            wait;
        end if;
    end process;
DUT:
    entity work.frequency_divider
        port map (clk,q);
end architecture;
ieee库;
使用ieee.std_logic_1164.all;
实体频率测试是
终端实体;
频率测试的架构tb是
信号时钟:标准逻辑:='0';
信号Q:std_逻辑;
开始
时钟:
过程
开始
如果现在小于300纳秒,则
等待10纳秒;

正如David Koontz所描述的,clk模拟应该很好,但对于可合成设计,该过程在灵敏度列表中应该只有
clk
,并且应该在
if
语句中有所有更新,如:

process(clk)
  variable cpt : integer range 0 to 5 := 0;  -- Must be constrained for synthesis
begin
  if (rising_edge(clk)) then
    cpt := cpt+1;
    if (cpt = 5) then
      S   <= not(S);
      cpt := 0;
    end if;
  end if;
end process;
过程(clk)
变量cpt:整数范围0到5:=0;--必须对合成进行约束
开始
如果(上升沿(clk)),则
cpt:=cpt+1;
如果(cpt=5),则
s