Question

Let's say I have an entity called "HostToDevice" which has a "ps2c" inout signal (VHDL). In this entity I only set this signal to 'Z' (high impedance) because I want an other entity to control it.

I created a test bench to check the behavior and something strange (for me) happens. In the test bench I have this code:

ps2ctemp_process :process
begin
    ps2ctemp <= '0';
    wait for ps2c_period/2;
    ps2ctemp <= '1';
    wait for ps2c_period/2;
end process;

And after:

stim_proc: process
begin
    ps2c <= ps2ctemp;

    wait;
end process;

When I run the simulation (behavioral) the "ps2c" inout signal is just low and doesn't change like ps2ctemp signal does.

Instead if I drive manually the ps2c signal without using another signal it works fine; like this:

ps2c <= '1';
wait for 10 ns;
ps2c <= '0';
wait for 10 ns;
ps2c <= '1';

Was it helpful?

Solution

Your "stim_proc" has no sensitivity list, and one "wait" without event or timeout, so it is intended to run once and wait forever. This seems to be what the sim is doing, so, good.

Now I'll make a wild guess here, that you actually want it to wake up every time ps2ctemp changes, and pass on the new value to ps2c.

There are two ways to do that:

(1) with a sensitivity list

stim_proc: process(psc2temp)
begin
    ps2c <= ps2ctemp;

    --wait;
    -- no, we want the process to complete, so it can be woken up 
    -- and run from the start again
end process;

(2) with a wait for a specific event...

stim_proc: process
begin
    ps2c <= ps2ctemp;

    wait until ps2ctemp'event;
    -- any activity at all on ps2ctemp should wake this process, 
    -- in case there is something it ought to be doing...
end process;

In this simple case, these two forms are essentially equivalent. So the simpler one (sensitivity list) is to be preferred...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top