1

I have to events:

event clk_e is rise (smp.port_uart_clk$) @sim;
event async_16_clk_e is rise (smp.port_br_clk_16$) @sim; 

*uart clk is faster than br_clk_16

update_int()@clk_e is {
      while TRUE 
      {
         if ((uart_env.uart_regs.uartis.rxmi | uart_env.uart_regs.uartis.txmi | uart_env.uart_regs.uartis.rtmi | uart_env.uart_regs.uartis.femi | uart_env.uart_regs.uartis.blmi | uart_env.uart_regs.uartis.rxoemi | uart_env.uart_regs.uartis.txoemi)  == 1) 
         { 
            first of 
            {
               {
                  wait true(smp.port_uart_int$ == 0);
                  message(LOW, "INTRP MON : Intrpt has occured");
               };
               {
                  message(LOW, "EXPECT INTERRUPT");
                  if (uart_env.uart_regs.uartis.rxmi == 1)
                  {
                      wait[10] @async_16_clk_e;  --I want to wait  10 clocks of br_clk_16
                  }
                  else if (uart_env.uart_regs.uartis.txmi == 1)
                  {
                     wait[2] @tx_clk_e;
                  };
                  dut_error ("Interrupt should be asserted, but it's not");
                  --message(LOW, "INTRP MON : Intrpt has occured");
               };
            }; -- all of
         };
         wait;
      };

   };

For some reason I wait more than 10 clocks. How can I wait 10 clocks of br_clk_16?

Sara p
  • 31
  • 6

2 Answers2

1

You are waiting for async_16_clk_e at the default sampling event of the TCM. Try instead wait [10] * cycle@async_16_clk_e;

Thorsten
  • 710
  • 8
  • 17
  • what's the difference between `wait [10] * cycle@async_16_clk_e;`to `wait [10] * @async_16_clk_e;` – Sara p May 22 '18 at 10:06
  • In the TCMs context, which has clk_e as default sampling event, `wait [10] * cycle@async_16_clk_e` will continue after the 10th occurrence of the async_16_clk_e event. `wait [10] * @async_16_clk_e` will continue on the next clk_e event after 10 cycles of async_16_clk_e. At least according to the docs, but I couldn't try this right now to verify this. – Thorsten May 23 '18 at 10:40
0

I suggest running it with 'trace events'. There might be issues like multiple ticks at the same simulation time, etc., which lead to counter-intuitive behavior. Also, try to convert "true(smp.port_uart_int$ == 0)" to a separate event, as it too can have sampling glitches with clk_e, tcm's sampling event.

Rodion Melnikov
  • 338
  • 1
  • 4