Retvisan Posted September 13, 2019 Report Posted September 13, 2019 Hello everybody, I have a statement that should return a half of a period, but instead it returns me a zero. Why? struct PWM::states { sc_core::sc_time period; states() { sc_core::sc_time period(4.0,sc_core::SC_MS); } }; std::cout<<s.period/2.0; Thanks in advance Quote
David Black Posted September 13, 2019 Report Posted September 13, 2019 It is unclear where your std::cout is located. The earliest I would expect is inside start_of_simulation() or as the first thing inside an SC_THREAD. But your code has another issue. You are declaring two independent variables. One in the struct, and the other as a stack located version with an initial value of 4 ms. Perhaps you meant to do something like: https://www.edaplayground.com/x/2c9j Quote
Retvisan Posted September 14, 2019 Author Report Posted September 14, 2019 Hello Mr. Black, Unfortunately I do not have today my code with me. I have created a module with SC_THREAD process. And in this module this process is made with constructor. I have probably understood my mistake but I can check it only on Monday when I will have access to my code. Thanks for the help! P.S. How could I register on edaplayground? My e-mail is not accepted by a system check. Quote
David Black Posted September 22, 2019 Report Posted September 22, 2019 Logging in with a social accounts gives you access to all non-commercial simulators and some commercial simulators. If you want to use all the commercial simulators, you need a commercial/work e-mail address. For SystemC you don't need the commercial simulators. Quote
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.