PokeGent Posted October 16, 2021 Report Share Posted October 16, 2021 Hello! I am trying to run a testbench to simulate a simple averager circuit and I am not sure why I am getting this error. Other examples on the site don't seem to apply and I'd love any help or tips I can get. I am hoping its some simple syntax or ordering error that I am doing wrong. Here is what I am doing for the simulation: #include "averageTB.h" int sc_main(int argc, char* argv[]) { averageTB* myAVGTB = new averageTB("Testbench"); sc_trace_file* VCDFile; VCDFile = sc_create_vcd_trace_file("averageTB"); sc_trace(VCDFile, myAVGTB->rst, "rst"); sc_trace(VCDFile, myAVGTB->clk, "clk"); sc_trace(VCDFile, myAVGTB->start, "start"); sc_trace(VCDFile, myAVGTB->stop, "stop"); sc_trace(VCDFile, myAVGTB->inBus, "inBus"); sc_trace(VCDFile, myAVGTB->outBus, "outBus"); sc_start(2000, SC_NS); return 0; } Here is the code for the testbench that I wrote as well: #include "HW4ece.h" SC_MODULE(averageTB) { int ij; int NumOfInputs; sc_signal<sc_logic> rst, clk, start, stop, enableReg, selMux, selTri; sc_signal<sc_lv<8>> inBus, outBus; accAverage_Top* myTop; SC_CTOR(averageTB) { myTop = new accAverage_Top("Top-module"); myTop->rst(rst); myTop->clk(clk); myTop->start(start); myTop->stop(stop); myTop->inBus(inBus); myTop->outBus(outBus); SC_THREAD(resetting); SC_THREAD(clocking); SC_THREAD(main_task); SC_METHOD(display); sensitive << clk << rst; } void resetting(); void clocking(); void main_task(); void display(); }; Quote Link to comment Share on other sites More sharing options...
Bas Arts Posted October 18, 2021 Report Share Posted October 18, 2021 What is the error? Quote Link to comment Share on other sites More sharing options...
maehne Posted October 18, 2021 Report Share Posted October 18, 2021 Skimming over your code snippets, I don't see a line, which would cause the error from your thread title. Try to reduce your code to a self-contained example, which exposes the problem. As the error message states, you cannot create new modules after elaboration has finished and simulation is running. Quote Link to comment Share on other sites More sharing options...
Bas Arts Posted October 19, 2021 Report Share Posted October 19, 2021 13 hours ago, maehne said: Skimming over your code snippets, I don't see a line, which would cause the error from your thread title. Try to reduce your code to a self-contained example, which exposes the problem. As the error message states, you cannot create new modules after elaboration has finished and simulation is running. Hmm yes, I should read the subject too... Quote Link to comment Share on other sites More sharing options...
Andy Goodrich Posted October 19, 2021 Report Share Posted October 19, 2021 The error message is coming from from sc_module_registery::insert(). The code has detected an attempt to add a module after the simulator has been started. It would help to see the header files, averageTB.h and HW4ece.h Quote Link to comment Share on other sites More sharing options...
PokeGent Posted October 21, 2021 Author Report Share Posted October 21, 2021 I found the issue, I was making modules in places that was not the SC_CTOR. Thanks for the help. 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.