Alaba Posted July 25, 2020 Report Share Posted July 25, 2020 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 Quote Link to comment Share on other sites More sharing options...
Martin Barnasconi Posted July 25, 2020 Report Share Posted July 25, 2020 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. Quote Link to comment Share on other sites More sharing options...
Alaba Posted July 26, 2020 Author Report Share Posted July 26, 2020 So Should the digital discrete-event side set the default state of the control in its initialization ? Quote Link to comment Share on other sites More sharing options...
maehne Posted July 26, 2020 Report Share Posted July 26, 2020 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(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.