Multiple Entry into @update_once block

38 views
Skip to first unread message

Enze

unread,
Feb 19, 2021, 10:27:55 PM2/19/21
to pymtl-users
I've constructed the following, minimal example source file:

# Begin File tb3.py
from pymtl3 import *

class dut(Component):
  def construct(s):
    @update_once
    def next_cycle1():
      print("entering update_once block")

my_tb = dut()
my_tb.apply(DefaultPassGroup())
my_tb.sim_reset()

for i in range(4):
  print("Iteration:" + str(i))
  my_tb.sim_tick()

print("Sim Done")

# End File

I expect the line "entering update_once block" to print once per clock cycle. However, when I run this, I see the following console output:

$ python tb3.py
entering update_once block
entering update_once block
entering update_once block
entering update_once block
Iteration:0
entering update_once block
entering update_once block
Iteration:1
entering update_once block
entering update_once block
Iteration:2
entering update_once block
entering update_once block
Iteration:3
entering update_once block
entering update_once block
Sim Done

This is with python 3.8.2. It appears that this block is scheduled twice per clock cycle Am I misunderstanding how to use the @update_once block?

Thanks

Christopher Batten

unread,
Feb 21, 2021, 10:15:05 AM2/21/21
to Enze, pymtl-users

Hmmm ... this seems interesting. The initially four executions of the update block are happening during reset, but I am surprised the update_once block happens twice per cycle when you are calling `sim_tick()` ... we will take a look awn get back to you this week!

Best,
-c
> --
> You received this message because you are subscribed to the Google Groups "pymtl-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pymtl-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pymtl-users/d4840ae5-7cc0-4175-855c-5405a79a9bf3n%40googlegroups.com.

Shunning Jiang

unread,
Apr 18, 2021, 4:43:47 PM4/18/21
to Enze, pymtl-users
Thanks for the report. I finally got a chance to fix it on master.

--
You received this message because you are subscribed to the Google Groups "pymtl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymtl-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pymtl-users/d4840ae5-7cc0-4175-855c-5405a79a9bf3n%40googlegroups.com.


--

Shunning Jiang

Ph.D. Candidate 

Computer Systems Laboratory

School of Electrical and Computer Engineering

Cornell University

http://www.csl.cornell.edu/~shunning

Reply all
Reply to author
Forward
0 new messages