简体   繁体   English

防止 SC_METHOD 在没有事件/触发器的情况下执行

[英]Prevent SC_METHOD from executing without event/trigger

My method fsm1 executes once even without event and therefore id1_cmd.read() and id1_value.read() contain 0 and not the correct values.我的方法fsm1即使没有事件也会执行一次,因此id1_cmd.read()id1_value.read()包含 0 而不是正确的值。

//------------------------------------------------------------------
//  Method:  control::fsm1() 
//  Parameter: None
//  @Sensitivity: ID_1_cmd (unsigned int)
//------------------------------------------------------------------
void control::fsm1() {
   cout << id1_cmd.read() << endl;
   cout << id1_value.read() << endl;

}

//------------------------------------------------------------------
//  Method: Constructor
//------------------------------------------------------------------
SC_CTOR(control) {
    SC_METHOD(fsm1);
    sensitive << id1_cmd;
}

Exists there a way to prevent it from executing once or do i have to handle that case always in my methods?有没有办法阻止它执行一次,或者我必须总是在我的方法中处理这种情况?

Use the dont_initialize method see the Language Reference Manual使用dont_initialize方法参见语言参考手册

SC_CTOR(control) {
    SC_METHOD(fsm1);
    sensitive << id1_cmd;
    dont_initialize();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM