Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/21/2020 in all areas

  1. David Black

    sc_inout class

    Nothing wrong. Your output will be available after the delta cycle completes. You can view the new value in the next delta cycle. The problem for you conceptually is that you think 'S_val_out = expression' is a blocking statement. In other words, you expect the value to be transferred to the current value of S_val_out at the end of the assignment. Actually what is happening is akin to: S_val_out->write( A_val_in->read() +B_val_in->read() ); External to your sum class object, the S_val_out is bound to a channel sc_signal<T>, where the write() method is implemented. The write method does something like this: template<typename T> class sc_signal : sc_signal_in_if<T>, sc_signal_inout_if<T> { void write( T value ) { next_val = value; request_notify(); } T read() { return curr_val; } void notify() { curr_val = next_val; } }; SystemC will call notify at the end of the delta cycle after all other processes in the current delta cycle have completed their work. You could force code displaying the sum into the next delta cycle with: wait(SC_ZERO_TIME); but that could theoretically affect the other wait depending on how the inputs are being driven and cause you to miss updates.
    1 point
×
×
  • Create New...