Jump to content

Perform action on signal


Recommended Posts

I suspect the answer is quite simple, but I can't seem to figure it out:

I have a TDF module that calculates the position of an array of elements with state space equations. I want to create an 'element generator' module that sends a signal to the 'calculation module' that a new element has arrived every 5 seconds'. How do I go about doing that?

I've come up with the following, but it seems a difficult way to do something simple:

The generator module sends 'true' through a boolean port for 1 second every 5 seconds (i've made this with a sine signal), the calculator module picks it up, and if no elements have been created in the last second, it adds one.

 

Could someone point me in the correct direction to do this the correct/easy way?

 

regards,

 

Marijn

Link to comment
Share on other sites

Although I do not understand well your application (perhaps you can explain a bit more), here some things which might help.

 

The SystemC AMS TDF modules are tiggered -or fired according to the synchronous data flow terminology-  if all samples are available at its input ports. In such case, the processing() method is called. You can add a simple data member counting the number of firings of this processing() method, As the time step is known, you should then know when to perform the additional calculations on your array.

Alternatively, you can use the get_time() method to ask for the time in a TDF module (note: you should not use the sc_time_stamp(), as the SystemC time might differ from the SystemC AMS TDF time in a TDF module), and compare it with previous stored time (also using a data member) and take action if the time difference is what you expect.

 

Note that the whole idea of SystemC AMS is to keep the number of digital discrete events (handled by the SystemC kernal) for signal-level interfaces as low as possible, and therefore time handled in the SystemC AMS kernel. Actually, the time in TDF models is annotated, based on the static schedule which can be calculated prior to simulation, and thus the number of discrete events processed by the SystemC kernel is kept as low as possible. So I would not introduce additional (SystemC) modules to generate additional events; instead, it is adviced to calculate the number of firings or time in a TDF module.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...