Jump to content

sc_fox

Members
  • Content count

    8
  • Joined

  • Last visited

  1. Thank you, Philipp, for your answer. I appreciate it. Just one more thing, Because "ch_a_fix" is "channel" defined as: sc_signal<sc_fixed<...> > ch_a_fix; "sc_signal" class doesn't have "to_double()" as its member function. So I had compile error with the code in your message. So I have modified your code slightly as follows: double ch_a_fix_tr; void update_ch_a_fix() { ch_a_fix_tr = ch_a_fix.read().to_double(); // just added sc_signal<T>.read(), to get the value. } // in constructor ... SC_METHOD(update_ch_a_fix); sensitive << ch_a_fix; I'm not sure if that is the right way to do, but it looks working. Philipp, do you have any comments on this? Thanks, again.
  2. How to output "float (double)" from sc_fixed type class using sc_trace? I have an existing model (all in floating point design, using "sc_signal<double>"), and am trying to convert it to its fixed point one (i.e. using sc_signal<sc_fixed< ,,,, > >"). sc_signal<double> ch_a; sc_signal<sc_fixed<16,8, SC_RND, SC_SAT> > ch_a_fix; sc_trace(tf, ch_a, "ch_a" ); // floating point channel tracing, it traces signal in "double". sc_trace(tf, ch_a_fix, "ch_a_fix ); // fixed point channel tracing: it traces signal in "integer numbers". The question is, how can I trace the sc_fixed type class (sc_signal<sc_fixed<...:> >) in floating point numbers? For waveform viewer-wise, I'm using gtkwave for now. I have found one posting that has the same question that I have now. But it doesn't have any replies there. http://www.accellera.org/Discussion_Forums/helpforum/archive/msg/msg?list_name=help_forum&monthdir=200802&msg=msg00035.html Many thanks in advance.
  3. I should have mentioned as "integer bit length" instead of just "length". So the question was, how to change the integer bit length of sc_fix dynamically. I have updated my original posting accordingly. To dakupto's question: The reason why I'm trying to change the integer bit length is, that I need to find the optimum integer bit length in my model so I'd like to make it dynamically programmable and find the optimum value through running simulation runs over many different values (for the integer bit length). David Long, thank you for letting me know one technique that I can take advantage of. Is there any technique to change the "integer bit length" dynamically?
  4. Hello, please let me ask a trivial question. How to change the integer bit length of "sc_fix" variable dynamically after its initialization? As far as I know "sc_fix" variable can be configured dynamically, though "sc_fixed" is not. Many thanks in advance. int sc_main( int argv, char* argc[]) { sc_fix var_1( 16, 4, SC_RND, SC_SAT); sc_fix var_2( 16, 4, SC_RND, SC_SAT); sc_fix var_3( 16, 4, SC_RND, SC_SAT); var_1 = 0.5; var_2 = 1.125; var_3 = 0.7; var_1 = var_2 + var_3; // *** at this moment, I'd like to change var_1's integer bit length to 8. *** var_1 = sc_fix( 16, 8, SC_RND, SC_SAT); // This does not work. // further processing,...... return 0; }
  5. Philipp, Superb! Working fine. Previously I missed setting the constant. Thank you very much.
  6. Thanks for your message, Philipp. And you're right, I bound the input port to "vh_open", rather than output ports. After fixing, it worked for the output port. Thanks to Ralph, again and Philipp, too. BTW, Philipp, the snipped one in your message causes compile error when I bound the input port to "vh_const". error C2664: 'void sc_core::sc_in<T>::operator ()(sc_core::sc_port<IF,N,P> &)' : cannot convert parameter 1 from 'const sc_core::sc_signal_in_if<T> &(__cdecl *)(const T &)' to 'sc_core::sc_port<IF,N,P> &' 1> with 1> [ 1> T=int, 1> IF=sc_core::sc_signal_inout_if<int>, 1> N=1, 1> P=SC_ONE_OR_MORE_BOUND 1> ] 1> and 1> [ 1> IF=sc_core::sc_signal_inout_if<int>, 1> N=1, 1> P=SC_ONE_OR_MORE_BOUND 1> ] I'm using MSVC2008. Thanks!
  7. Ralph, thanks for your reply. I appreciate it. BTW, after I plugged in "vh_open" structure into my code, and bound my unused port "sc_out<int>" to "vh_open". But I have compile error like below. // myModule.h SC_MODULE (myModule){ sc_out<int> p1_; ..... }; // main.cpp // your vh_open structure included here,,,. int sc_main(){ ... myModule m_; // module instantiation m_.p1_(vh_open); // binding to vh_open ... } error C2664: 'void sc_core::sc_in<T>::operator ()(sc_core::sc_port<IF,N,P> &)' : cannot convert parameter 1 from 'const <unnamed-type-vh_open>' to 'sc_core::sc_port<IF,N,P> &' 1> with 1> [ 1> T=int, 1> IF=sc_core::sc_signal_inout_if<int>, 1> N=1, 1> P=SC_ONE_OR_MORE_BOUND 1> ] 1> and 1> [ 1> IF=sc_core::sc_signal_inout_if<int>, 1> N=1, 1> P=SC_ONE_OR_MORE_BOUND 1> ]
  8. Hello, does anyone know how to terminate unused ports of modules in the port binding? Like, sc_in<int> ,,,. Much thanks in advance.
×