systemc-clang icon indicating copy to clipboard operation
systemc-clang copied to clipboard

thread support for continue

Open zhuanhao-wu opened this issue 3 years ago • 0 comments

https://github.com/intel/systemc-compiler/blob/main/tests/cthread/test_continue.cpp

For continue_break_exit1, we are currently generating the following, where the next state is not assigned for state 1.

    void continue_break_exit1() {
        int k = 0;
        wait();
        
        while (1) {
            k = 0;
            for ( ; ; ) {
                wait();
                k = k + 1;
                if (a.read()) {
                    break;
                } else {
                    continue;
                }
                sct_assert_level(2);
            }
            sct_assert_level(1);
            k = 1;
        }
    }   
    hProcesses  NONAME [
      hProcess continue_break_exit1 [
        hFunction continue_break_exit1_func [
          hFunctionRetType  NONAME NOLIST
          hCStmt  NONAME [
            hSwitchStmt  NONAME [
              hVarref state_continue_break_exit1# NOLIST
              hCStmt  NONAME [
                hSwitchCase  NONAME [
                  hLiteral 0 NOLIST
                  hVarAssign  NONAME [
                    hVarref k_continue_break_exit1_thread_0 NOLIST
                    hLiteral 0 NOLIST
                  ]
                  hBinop = [
                    hVarref _next_state_continue_break_exit1# NOLIST
                    hLiteral 1 NOLIST
                  ]
                  hReturnStmt  NONAME NOLIST
                ]
                hSwitchCase  NONAME [
                  hLiteral 1 NOLIST
                  hIfStmt  NONAME [
                    hLiteral 1 NOLIST
                    hCStmt  NONAME NOLIST
                  ]
                  hBinop = [
                    hVarref k_continue_break_exit1_thread_0 NOLIST
                    hLiteral 0 NOLIST
                  ]
                  hIfStmt  NONAME [ // notice here, there is no condition
                    hCStmt  NONAME NOLIST
                  ]
                  hIfStmt  NONAME [
                    hSigAssignR read [
                      hVarref a_scclang_global_0 NOLIST
                    ]
                    hCStmt  NONAME NOLIST
                  ]
                ]

zhuanhao-wu avatar Oct 31 '22 02:10 zhuanhao-wu