We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File: https://github.com/intel/systemc-compiler/blob/main/designs/tests/cthread/test_cthread_read_defined_ref.cpp
template<class T> void const_ref(const T& par) { auto i = par; } // Assign through reference template<class T> void ref_assign(T& par) { par = 0; } void fcall_ref_assign() { int i; sc_uint<2> k = 0; wait(); while (1) { ref_assign(i); ref_assign(k); const_ref(i); const_ref(k ? 1 : 2); // sct_assert_defined(i); // sct_assert_defined(k); // sct_assert_register(i, false); // sct_assert_register(k, false); sc_uint<2> m; ref_assign(m); auto j = m / 2; // sct_assert_defined(m); // sct_assert_register(m, false); wait(); } }
Currently the generated code looks as follows:
hSwitchCase NONAME [ hLiteral 1 NOLIST hIfStmt NONAME [ hLiteral 1 NOLIST ] hLiteral 1 NOLIST hMethodCall A__const_ref_func_0 [ hCondop NONAME [ hVarref k_fcall_ref_assign_thread_1 NOLIST hLiteral 1 NOLIST hLiteral 2 NOLIST ] ] hMethodCall A__ref_assign_func_0 [ hVarref m_fcall_ref_assign_thread_2 NOLIST ] hVarAssign NONAME [ hVarref j_fcall_ref_assign_thread_3 NOLIST hBinop / [ hVarref m_fcall_ref_assign_thread_2 NOLIST hLiteral 2 NOLIST ] ] hBinop = [ hVarref _next_state_fcall_ref_assign# NOLIST hLiteral 2 NOLIST ] hReturnStmt NONAME NOLIST // the return statement is generated here, but we still have more statemetns hLiteral 2 NOLIST hMethodCall A__const_ref_func_0 [ hCondop NONAME [ hVarref k_fcall_ref_assign_thread_1 NOLIST hLiteral 1 NOLIST hLiteral 2 NOLIST ] ] hVarAssign NONAME [ // here, we have a dangling assignment hVarref m_fcall_ref_assign_thread_2 NOLIST ] hMethodCall A__ref_assign_func_1 [ hVarref m_fcall_ref_assign_thread_2 NOLIST ] hVarAssign NONAME [ hVarref j_fcall_ref_assign_thread_3 NOLIST hBinop / [ hVarref m_fcall_ref_assign_thread_2 NOLIST hLiteral 2 NOLIST ] ] hBinop = [ hVarref _next_state_fcall_ref_assign# NOLIST hLiteral 2 NOLIST ] hReturnStmt NONAME NOLIST ]
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
The code that is causing the issue is const_ref(k ? 1 : 2);.
const_ref(k ? 1 : 2);
const_ref
template<class T> void const_ref(T par) { auto i = par; }
SystemVerilog has support for pass-by-reference with the following form
function automatic logic pipe(ref logic[31:0] ip); ip = ip + 1; return ip; endfunction
No branches or pull requests
File: https://github.com/intel/systemc-compiler/blob/main/designs/tests/cthread/test_cthread_read_defined_ref.cpp
Currently the generated code looks as follows:
The text was updated successfully, but these errors were encountered: