Jump to content

Recommended Posts

sca_eln::sca_de_rswitch sw0;

SC_CTOR(mod): sw0("sw0",R_on,R_off ,off_state0) 
	sw0.p(p);
	sw0.n(n);
	sw0.off_state =off_state1;
	sw0.ctrl(ctrl);

 

From documentation :

if we assume  off_state1 = true

sw0.off_state  sets the boolean state that correspond to the switch off_state.  in this case off_state is set to true, which means when the value of "ctrl"  is true it will switch to R_off 
My question is,  how to set the default state of the sw0 ?  The argument  "off_state0" , also sets the off_state boolean value,  but it does not set the default state of the switch at initialization. Is it always set to Ron by default? 

I could not find it in the documentation. 

Thanks

Link to post
Share on other sites

There is no such thing as a default state. Equation 7.34 in the 1666.1-2016 LRM defines the contribution of the switch to the equation system, and depends on the value of the control signal (ctrl) of the switch. Since the type of the control signal should be a Boolean value, the initial value can be true or false, which is driven from the digital discrete-event side.

Link to post
Share on other sites

Yes, the simplest way is to write the desired initial bool value to the bound signal using the signal’s write() member function (see IEEE Std 1666-2011, clause 6.4.4), e.g., from sc_main() before starting your simulation with sc_start().

Link to post
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...