Forum Discussion

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

attribute 'event usage within procedure

Hi,

I'm having a procedure (non-synthesizable code) and I am trying to use the 'event attribute on a signal declared as input to the procedure:

   procedure priority_req(signal   tb_control : in  t_tb_control) is
   begin
         while (tb_control.command /= priority_grant) loop
            wait for tb_control.cycle_time;
            wait until tb_control.command'event;
         end loop;
   end priority_req;

tb_control is a signal (although mode 'in' within procedure) of type t_command

where t_command is a record.

From the compiler I am getting the error:

Error, attribute event is only defined for signals.

I have tried all language syntaxes from '87 to '2008, all see it as an error.

Does anyone have an ideea how I can fix/rewrite it so it gets compiled?

5 Replies

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

    thats because the 'event attribute is not a signal, and hence cannot be waited on.

    instead, use:

    wait on tb_control.command;
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    @Tricky

    thank you, the compiler is happy with "wait on".

    Is "wait on signal" accomplished on assignment of signal or value change?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Wait on waits until an event occurs on the signals in the list, so you can list multiple signals.

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

    If you want to wait until the the assignment of a signal, you can use:

    wait on my_signal'transaction;

    So in this case it is every time a signal is assigned, even if it is from the same state, eg:

    
    my_signal <= '1';
    wait for 10 ns;
    my_signal <= '1';
    

    creates 2 'transactions.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I am using HDL Designer flow and the error I initially mentioned occurs in the "Generation step" of the ModelSim TCL flow.

    With the proposed 'transaction attribute the tool passes the generation step but triggeres a compile error in ModelSim:

    wait on tb_control.command'transaction;

    tb_control is a record containing a signal "command"

    ModelSim error:
    Attribute "transaction" may not be read from formal signal parameter "tb_control".
    VHDL Compiler exiting

    It seems that various tools interpret these attributes differently:

    1. ModelSim accepts 'event, HDL Designer doesn't

    2. HDL Designer accepts 'transaction, ModelSim doesn't