Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VHDL时钟测试台_Vhdl_Ghdl - Fatal编程技术网

VHDL时钟测试台

VHDL时钟测试台,vhdl,ghdl,Vhdl,Ghdl,我正在尝试运行一个我在线获取的代码,但不知何故,测试台无法在GHDL上运行预期的输出。 体系结构代码 图书馆IEEE; 使用IEEE.STD_LOGIC_1164.ALL entity clk200Hz is Port ( clk_in : in STD_LOGIC; reset : in STD_LOGIC; clk_out: out STD_LOGIC ); end clk200Hz; architecture Beha


我正在尝试运行一个我在线获取的代码,但不知何故,测试台无法在GHDL上运行预期的输出。

体系结构代码 图书馆IEEE; 使用IEEE.STD_LOGIC_1164.ALL

entity clk200Hz is
    Port (
        clk_in : in  STD_LOGIC;
        reset  : in  STD_LOGIC;
        clk_out: out STD_LOGIC
    );
end clk200Hz;

architecture Behavioral of clk200Hz is
    signal temporal: STD_LOGIC;
    signal counter : integer range 0 to 124999 := 0;
begin
    frequency_divider: process (reset, clk_in) begin
        if (reset = '1') then
            temporal <= '0';
            counter <= 0;
        elsif rising_edge(clk_in) then
            if (counter = 124999) then
                temporal <= NOT(temporal);
                counter <= 0;
            else
                counter <= counter + 1;
            end if;
        end if;
    end process;

    clk_out <= temporal;
end Behavioral;
这是我的输出
但对于时钟停止,我希望是一个向上和向下的信号,而不是0的信号


谢谢

我已经解决了这个问题,在我运行的命令中,我简单地添加了ghdl-r clk200Hz_tb--vcd=led.vcd--stop time=100ns

ghdl-一个clk200Hz_tb.vhdl
ghdl-e clk200Hz_tb
ghdl-r clk200Hz_tb——波形=clk200Hz_tb.ghw——停止时间=500ns

给出:


(可单击)

VHDL代码似乎正确,您使用的是什么ghdl命令。你如何断言有错误?这是在gtkwave屏幕截图中显示水平滚动条的一个很好的论据。
  LIBRARY ieee;
    USE ieee.std_logic_1164.ALL;

    ENTITY clk200Hz_tb IS
    END clk200Hz_tb;

    ARCHITECTURE behavior OF clk200Hz_tb IS 
      COMPONENT clk200Hz
      PORT(
        clk_in : IN  std_logic;
        reset  : IN  std_logic;
        clk_out: OUT std_logic
      );
      END COMPONENT;

      -- Inputs
      signal clk_in  : std_logic := '0';
      signal reset   : std_logic := '0';
      -- Outputs
      signal clk_out : std_logic;
      constant clk_in_t : time := 20 ns; 
    BEGIN 
      -- Instance of unit under test.
      uut: clk200Hz PORT MAP (
        clk_in  => clk_in,
        reset   => reset,
        clk_out => clk_out
      );

      -- Clock definition.
      entrada_process :process
        begin
        clk_in <= '0';
        wait for clk_in_t / 2;
        clk_in <= '1';
        wait for clk_in_t / 2;
      end process;

      -- Processing.
      stimuli: process
      begin
        reset <= '1'; -- Initial conditions.
        wait for 100 ns;
        reset <= '0'; -- Down to work!
            wait;
      end process;
    END;
ghdl -s *.vhd
    ghdl -a *.vhd
    ghdl -e clk200Hz_tb
    ghdl -r clk200Hz_tb --vcd=led.vcd 
    gtkwave led.vcd