Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

No signal changes when using VHDL testbench with ModelSim

I'm trying to write a VHDL testbench for ModelSim (switching from using the quartus 9.1 waveform editor)

I feel like this is a pretty simple procedure... everything compiles, no warnings, but when I run the simulation, my signals don't change at all, they just have a 'U' value:

LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
-- Set up this testbench as an entity
entity test_cpld is
end test_cpld;
-- Create an implementation of the entity
-- (May have several per entity)
architecture testbench of test_cpld is
  -- Set up the signals under test
  signal cart_present : std_logic := '1';
  signal t0 : std_logic := '0';
  begin
    -- dut = device under test (same name as top project from Quartus)
    dut : entity work.cpld
      -- Map the ports from the dut to this testbench
      port map (
        eff_cart_present => cart_present,
        timer_0 => t0,
        );
    -- Set up the signals
    stimulus : process is
      begin
        cart_present <= '0';
        loop
          t0 <= '0';
          wait for 100 ps;
          t0 <= '1';
          wait for 100 ps;
        end loop;
      end process stimulus;
end architecture testbench;

I run the simulation for 100ns, but adding the signals to the waveform viewer, I don't see any of my stimulus. Any thoughts?

9 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    you probably want to change away from 100ps gaps to at least 1ns. The default resultion in modelsim is 1ns I think.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Try:

    vsim -t ps test_cpld

    and if it works, then as Tricky comments, the reason you see nothing is the default timescale.

    Since your test does not really need a 100ps timescale, change it to 1ns or greater. That'll save having to remember to change the simulator timescale.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Interesting note about the resolution!

    I changed my clock width to 100us, and simulated out to 10ms, and the same response. Still just a flatline 'U' for both of my signals.

    Is there something wrong with the way I'm running? I'm selecting both vhdl files (the module and my testbench) and choosing "Compile Selection..." (no errors) - or compiling them at the console using vcom filename.vhd - to run I'm either choosing "Start Simulation..." and bowsing the work library for the test_cpld architecture, or am doing the same with the 'vsim' command. No matter how I slice it, I don't get any data in my waveform viewer.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I am making an effort to post links to screenshots of my simulator, hoping that will provoke an AHA moment...

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Still just a flatline 'U' for both of my signals.

    --- Quote End ---

    Check that the timer_0 port is defined as an input port, otherwise you could have a driver conflict (though I think that would come up as an 'X').

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Please read the warning messages from Modelsim - it says right there in your screen shot that the inout drivers for timer_0 and eff_cart_present are uninitialized, i.e., 'U'.

    Cheers,

    Dave