0

As part of an assignment, I'm expected to write a process that spans over a certain amount of time. However, we are not allowed to use neither wait for nor after statements.

Since I've been given a clock that has a period of 250ms, I have tried to create a counter that adds 1 each time the clock completes a full period, and then multiply it by 250 to get the time in miliseconds but when testing, the values for a and b are the ones defined at the beginning of the process, instead of updating at all.

The clock starts at 1, hence why I start the counter at -1.

process_1: process


variable t1: integer := 3000;
variable t2: integer := 10000;
variable t3: integer := 13000;
variable t4: integer := 23000;
variable counter: integer := -1;

begin

a <= "001";
b <= "100";

if (sensor = '1' and clk = '1' and clk'event) then

    while (250*counter < t4) loop
       --updates the counter
        if (clk = '1') then counter := counter+1; end if;

        --0 to 3000 ms
        if (250*counter < t1) then
            a <= "010";
            b <= "100";


        --3000 to 10000 ms
        elsif (250*counter < t2) then
            a <= "100";
            b <= "001";

        --10000 to 13000 ms
        elsif (250*counter < t3) then
            a <= "100";
            b <= "010";

        --13000 to 23000 ms
        else 
            a <= "001";
            b <= "100";
        end if;
    end loop;

end if;

wait until (sensor = '1');
end process;

Any ideas? How do I put a process through time intervals without using wait for?

Milo
  • 3,365
  • 9
  • 30
  • 44
  • 1
    Delete all the Waits and put a sensitivity list on the process. Also read about how signal assignment works, for example https://stackoverflow.com/questions/13954193/is-process-in-vhdl-reentrant/13956532#13956532 –  Dec 19 '17 at 19:07
  • This can be easily fixed, but what would you learn from that? I purpose you look up how to fix this and answer your own question. ;) – JHBonarius Dec 20 '17 at 09:19

0 Answers0