Nithin Posted August 8, 2023 Report Share Posted August 8, 2023 Hi, I am not able to do file write operations inside SC_CTHREAD. Is that expected? Is that a known behavior with SC_CTHREAD? It doesn't give any error, but the file is empty. The same file write operations work in an SC_THREAD though. Here is my SC_CTHREAD function. void MOD::READ_FROM_FIFO() { sc_bv<6> S_val; ofstream f1; f1.open ("output.txt"); while(true) { S_val = FIFO.read(); S.write(S_val); f1 << "READ_FROM_DS_FIFO DBG1: S_val= " << S_val<< "\n"; wait(); } f1.close(); } Any guidance is appreciated. Thanks in advance. Regards, Nithin Quote Link to comment Share on other sites More sharing options...
David Black Posted August 8, 2023 Report Share Posted August 8, 2023 Your problem is definitely not SystemC. You did not specify how it’s not working. I have some observations though: 1. f.close is not reachable due to the infiinite loop. 2, you did not check for the success of opening the file. 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.