Jump to content

Reading in file + upsampling

Recommended Posts

I am currently working on a module that equidistantly reads in values from a text file. For this purpose, I use the file_in_tdf module from the basic library of COSIDE and have set the time step to 1s and interpolation to true. The idea now is to have a subsequent module that, however, has a lower time step, let's say 10 ms. 


Unfortunately I get the following error when trying to simulate:

Inconsistency in timestep assignment between
 module: top. ... .i_file_in_tdf1 timestep: 1 s (1 Hz)   expect: 10 ms (100 Hz)
and  module: top. ... .dummy_inst T: 10 ms (100 Hz) or expect: 1 s (1 Hz)
rate1/rate2= 1/1 dT: -990 ms
Of course both elements do not have the same time step, but I would expect that the file_in_tdf module is able to provide interpolated values every 10ms.
So, is there any additional configuration I have to consider for the file_in_tdf module to have some kind of upsampling? Do I have to add a user-defined module in between which does the job for me or is such a timing setup simply not possible?
Kind regards,
Sebastian Simon
Link to comment
Share on other sites

I'm afraid that only someone with a local COSIDE license can answer your questions related to file_in_tdf. However, connecting TDF clusters with different time steps has been rendered possible with the advent of the SystemC AMS 2.0 standard and the therein define decoupling out ports. You will have to add a module, which reads through its input port of type sca_tdf::sca_in<T> the values of type T from your file_in_tdf instance and then forwards them via an output port of type sca_tdf::sca_out<T, sca_tdf::SCA_CT_CUT>. To this output, you can then connect your TDF signal going to your dummy_inst module.

Link to comment
Share on other sites

Regardless of the file_in_tdf module the problem may also occur in case of systems where borders between TDF domains with different time steps are necessary.


Nevertheless, the decoupling out ports sound like what I was looking for. I will try it out. Thanks for your help!

Link to comment
Share on other sites

I'm not familiar with this COSIDE library component, but it looks like your are facing a classical time step and rate inconsistency problem when different and incompatible time steps are defined in a single TDF cluster.


My advice is to read section 2.1.3 of the users guide (Time step assignment and propagation) and in particular the paragraph Consistency of time step assignment and propagation. Here you will see that you can have different time steps due to the rate setting. Please check carefully the time steps and rates defined in the methods set_attributes() of your TDF modules, and see if this is consistent with the formula given in the user guide: module time step = input port time step · input port rate = output port time step · output port rate


If changing the port time step is not possible (either by a parameter or changing the value in the method set_timestep(...) ), only then I would advice to apply the SystemC AMS 2.0 features. In this case, you basically split the TDF cluster in 2 independent TDF clusters, each having its own time step. Note that the complexity changes in this case, because you need to introduce dedicated decoupling ports.


But I expect you can resolve the issue easily by checking the consistency of time steps and rates.

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.

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...