仿真触发器 D ISim 12.3

发布于 2024-12-19 20:28:31 字数 2980 浏览 3 评论 0原文

如何在 ISim 12.3 上模拟此 vhdl 代码?我知道它有效,因为我下载到了 FPGA,但我看不到良好的模拟。

提前致谢,如果它太基础了,我很抱歉,但我对此很陌生。

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use work.packageFlipFlop.all;
use work.packageUtilities.all;

entity contadorFlipFlopD is
    Port ( CLK : in  STD_LOGIC;
           E : in  STD_LOGIC;
              CLEAR: in STD_LOGIC;
           S : out  STD_LOGIC_VECTOR (3 downto 0)
            );
end contadorFlipFlopD;

architecture Behavioral of contadorFlipFlopD is
    signal dEFFD, dSFFD, aux: std_logic_vector(3 downto 0) := (others=>'0');
    --signal CLKslow: std_logic;
begin

    aux(0) <= E;
    aux(1) <= aux(0) AND dSFFD(0);
    aux(2) <= aux(0) AND dSFFD(0);
    aux(3) <= aux(0) AND dSFFD(0);

    dEFFD(0) <= aux(0) XOR dSFFD(0);
    dEFFD(1) <= aux(1) XOR dSFFD(1);
    dEFFD(2) <= aux(2) XOR dSFFD(2);
    dEFFD(3) <= aux(3) XOR dSFFD(3);

    --dF0: divisorFrecuencia PORT MAP(CLK, CLEAR, CLKslow);

    ffD0: flipFlopD PORT MAP( dEFFD(0), CLK, dSFFD(0) );
    ffD1: flipFlopD PORT MAP( dEFFD(1), CLK, dSFFD(1) );
    ffD2: flipFlopD PORT MAP( dEFFD(2), CLK, dSFFD(2) );
    ffD3: flipFlopD PORT MAP( dEFFD(3), CLK, dSFFD(3) );

    S <= dSFFD;

end Behavioral;




library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity flipFlopD is
    Port ( D, CLK : in  STD_LOGIC;
           Q : out  STD_LOGIC);
end flipFlopD;

architecture a_flipFlopD of flipFlopD is

begin
    process (CLK)
    begin
        if (clk'event AND clk = '1') then
            Q <= D;
        end if;
    end process;
end a_flipFlopD;

这就是我的测试平台的样子

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY test IS
END test;

ARCHITECTURE behavior OF test IS 

    -- Component Declaration for the Unit Under Test (UUT)

    COMPONENT contadorFlipFlopD
    PORT(
         CLK : IN  std_logic;
         E : IN  std_logic;
         CLEAR : IN  std_logic;
         S : OUT  std_logic_vector(3 downto 0)
        );
    END COMPONENT;


   --Inputs
   signal CLK : std_logic := '0';
   signal E : std_logic := '1';
   signal CLEAR : std_logic := '0';

    --Outputs
   signal S : std_logic_vector(3 downto 0);

    --Signals
    signal dEFFD, dSFFD, aux: std_logic_vector(3 downto 0) := "0000";
    signal CLKslow: std_logic := '0';


   -- Clock period definitions
   constant CLK_period : time := 20 ns;

BEGIN

    -- Instantiate the Unit Under Test (UUT)
   uut: contadorFlipFlopD PORT MAP (
          CLK => CLK,
          E => E,
          CLEAR => CLEAR,
          S => S
        );

   -- Clock process definitions
   CLK_process :process
   begin
        CLK <= '0';
        wait for CLK_period/2;
        CLK <= '1';
        wait for CLK_period/2;
   end process;


   -- Stimulus process
   stim_proc: process
   begin        
      -- hold reset state for 100 ns.
      wait for 100 ns;  

      wait for CLK_period*10;

      -- insert stimulus here 

      wait;
   end process;

END;

How can I simulate this vhdl code on ISim 12.3? I know it works because I downloaded to the FPGA but I cannot see a good simulation.

Thanks in advance and sorry if it's too basic but I'm very new to this.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use work.packageFlipFlop.all;
use work.packageUtilities.all;

entity contadorFlipFlopD is
    Port ( CLK : in  STD_LOGIC;
           E : in  STD_LOGIC;
              CLEAR: in STD_LOGIC;
           S : out  STD_LOGIC_VECTOR (3 downto 0)
            );
end contadorFlipFlopD;

architecture Behavioral of contadorFlipFlopD is
    signal dEFFD, dSFFD, aux: std_logic_vector(3 downto 0) := (others=>'0');
    --signal CLKslow: std_logic;
begin

    aux(0) <= E;
    aux(1) <= aux(0) AND dSFFD(0);
    aux(2) <= aux(0) AND dSFFD(0);
    aux(3) <= aux(0) AND dSFFD(0);

    dEFFD(0) <= aux(0) XOR dSFFD(0);
    dEFFD(1) <= aux(1) XOR dSFFD(1);
    dEFFD(2) <= aux(2) XOR dSFFD(2);
    dEFFD(3) <= aux(3) XOR dSFFD(3);

    --dF0: divisorFrecuencia PORT MAP(CLK, CLEAR, CLKslow);

    ffD0: flipFlopD PORT MAP( dEFFD(0), CLK, dSFFD(0) );
    ffD1: flipFlopD PORT MAP( dEFFD(1), CLK, dSFFD(1) );
    ffD2: flipFlopD PORT MAP( dEFFD(2), CLK, dSFFD(2) );
    ffD3: flipFlopD PORT MAP( dEFFD(3), CLK, dSFFD(3) );

    S <= dSFFD;

end Behavioral;




library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity flipFlopD is
    Port ( D, CLK : in  STD_LOGIC;
           Q : out  STD_LOGIC);
end flipFlopD;

architecture a_flipFlopD of flipFlopD is

begin
    process (CLK)
    begin
        if (clk'event AND clk = '1') then
            Q <= D;
        end if;
    end process;
end a_flipFlopD;

this is what my testbench looks like

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY test IS
END test;

ARCHITECTURE behavior OF test IS 

    -- Component Declaration for the Unit Under Test (UUT)

    COMPONENT contadorFlipFlopD
    PORT(
         CLK : IN  std_logic;
         E : IN  std_logic;
         CLEAR : IN  std_logic;
         S : OUT  std_logic_vector(3 downto 0)
        );
    END COMPONENT;


   --Inputs
   signal CLK : std_logic := '0';
   signal E : std_logic := '1';
   signal CLEAR : std_logic := '0';

    --Outputs
   signal S : std_logic_vector(3 downto 0);

    --Signals
    signal dEFFD, dSFFD, aux: std_logic_vector(3 downto 0) := "0000";
    signal CLKslow: std_logic := '0';


   -- Clock period definitions
   constant CLK_period : time := 20 ns;

BEGIN

    -- Instantiate the Unit Under Test (UUT)
   uut: contadorFlipFlopD PORT MAP (
          CLK => CLK,
          E => E,
          CLEAR => CLEAR,
          S => S
        );

   -- Clock process definitions
   CLK_process :process
   begin
        CLK <= '0';
        wait for CLK_period/2;
        CLK <= '1';
        wait for CLK_period/2;
   end process;


   -- Stimulus process
   stim_proc: process
   begin        
      -- hold reset state for 100 ns.
      wait for 100 ns;  

      wait for CLK_period*10;

      -- insert stimulus here 

      wait;
   end process;

END;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素食主义者 2024-12-26 20:28:31

您需要一个测试平台来模拟您的设计并捕获波形。

类似这样的

You need a testbench to stimulate your design and capture the waveforms.

Something like this

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文