Jump to content


  • Content Count

  • Joined

  • Last visited

  1. When I load for simulation, it simply crashes. Now, I change C file I/O to C++ stream mode in Modelsim 10.1. It can run, and can write text before wait() call in a SC_CTHREAD. After wait(), no content is written to the text file. i.e. from the attached file, only "writing this to a file1." and "writing this to a file2. are written, no the next line text written. I put a breakpoint at line 75 of the attached fir.cpp. It does stop there after running, but no content writing happens of that line. BTW, I still cannot paste text to this forum editor by right click mouse. If I use the paste button above the editor window, there is such warning box, see attached please. I never see this before. Now I use IE on Windows 7. Thanks, fir.zip
  2. Hi, I have a code run well with Microsoft Visio Studio Express 10.0, but I would like to run with Modelsim which has MINGW4.2.1. I find that the file write operation fails. If I comment out the file operation part, it works. What requirement for SystemC 2.3.1 work with Modelsim? The code is attached below. Thanks, kalman_abstract1a.zip
  3. Hi, I write to a text file in a MC_CTHREAD. I find that it can write before an IO write method and wait(). Then, nothing is written to the file any more. I do not know where this is written on the manual. Could you explain it to me? I attach the text file in this post. In this file, the MC_CTHREAD function can write "shift[0000000000]" to the text file while it cannot write "shift[0]" to the text file. Is there some rule about this? Thanks,
  4. Hi, I don't know what is wrong that I cannot paste text to a post. I have tried Google Chrom and Microsoft Explore. Can you paste when writing a post? I cannot upload image too. When I open the upload image box, it cannot even close the dialogue box. Can you load image? Thanks,
  5. Hi, I get a little progress. Before the read function, I want to implement a write text file (a log file) first. I want to close the file when a counter reaches the maximum number in module A. When the counter reaches the maximum number, it issues an sc_evnt. This sc_event will notify a method B. Is it possible first? Now, I do not know how to trigger the method B. I only have an example of the clock.pos() as event: SC_METHOD(exitfile); sensitive << clk. pos(); But, "sensitive << fileclose.pos();" does not work to substitute the second line. I have check the manual without finding how to notify a method example. Thanks,
  6. Hi, I want to simulate a FIR filter, which reads a text file content as input data. I have tried with open a text file and call a function (entry) as a parameter, but it fails compilation. Because I cannot paste the code on this window, I attach the text .h file in the attachment. Please tell me how to access a text file in a method. Or you can tell me what is the best way to read text data file into the SystemC simulator. Thanks, stimulus.zip
  7. Hi, I download 2.3.1, compile the new library. Then, change the new library path in Microsoft Visio Studio Express 10.0 project path for the include files and library systemc.lib.The problem is still there. I search "sc_outmaster" from 2.3.1 systemc.h (and systemc) and tlm.h (and tlm). There is no such definition. What is wrong? Can you compile a file having variable "sc_outmaster"? Thanks,
  8. Hi, Sorry, I find the answer #define SC_INCLUDE_FX
  9. I attach the files in case one can try to run it. Thanks, key_pc.zip
  10. Hi, I try to run the following code from FUNCTIONAL SPECIFICATION FOR SYSTEMC 2 . 0 There are several key words are undefined. For example, "sc_link_mp" "sc_outmaster" etc. are not recognized by the compiler. What is wrong with this? Those keywords are not supported now? Thanks, #include <systemc.h> #include "key.h" #include "ctrl.h" #include "fun.h" #include "disp.h" int key::array1[MYMAX] = { 1,2,3,4,5 }; int key::array2[MYMAX] = {1,3,5,7,9 }; int sc_main(int argc, char* argv[]) { sc_link_mp<int > cmd; sc_link_mp<int > in1; sc_link_mp<int > in2; sc_link_mp<int > op1out; sc_link_mp<int > op2out; sc_link_mp<int > cmd_out; sc_link_mp<int > result; sc_link_mp<int > display; key k1("key"); k1.cmd(cmd); k1.op1(in1); k1.op2(in2); k1.clk(clock); ctrl c1("ctrl"); c1.cmd_in(cmd); c1.op1_in(in1); c1.op2_in(in2); c1.op1_out(op1out); c1.op2_out(op2out); c1.cmd_out(cmd_out); c1.result(result); c1.display(display); fun f1("fun"); f1.op1(op1out); f1.op2(op2out); f1.cmd(cmd_out); f1.result(result); disp d1("display"); d1.din(display); sc_start(50); return (0); };
  11. Hi, A class can have several constructors. Can a module have two constructors? I try to do that, but it fails. I don't know whether it is allowed or the code is wrong: #include <systemc.h> SC_MODULE(myclk) { sc_in<bool> reset, sig; sc_in<bool> input_valid; sc_in<bool> CLK; SC_CTOR(myclk) { SC_METHOD(outp); sensitive << CLK.pos(); } SC_CTOR(myclk, sig) { input_valid = sig; SC_METHOD(outq); sensitive << CLK.pos(); } void outp(); void outq(sc_signal<bool>, sc_signal<bool>); }; The error message is: # In file included from clk_g_head.cpp:2: # myclk.h:18:21: error: macro "SC_CTOR" passed 2 arguments, but takes just 1 # In file included from clk_g_head.cpp:2: # myclk.h:18: error: function definition does not declare parameters # In file included from myclk.cpp:37: # myclk.h:18:21: error: macro "SC_CTOR" passed 2 arguments, but takes just 1 # In file included from myclk.cpp:37: # myclk.h:18: error: function definition does not declare parameters # ** Error: (sccom-6142) Compilation failed. # # # ** Error: C:/modeltech_10.1c/win32/sccom failed. # Error in macro C:\Users\Jeff\modelsim_systemC\clk_gen\run1.do line 25 # C:/modeltech_10.1c/win32/sccom failed. # while executing # "sccom -g myclk.cpp clk_g_head.cpp" I do not find the answer after to look it on the manual. Thanks,
  12. Hi, When I try the following module, I find that the blue color initialization works while the red part is used, it does not work. SC_MODULE(mytop) { sc_signal<bool> mysig; sc_clock clk; myclk mod; SC_CTOR(mytop) : mysig("mysig"), mod("mod"), clk("ccllkk", 20, 0.5) { mod.outp(); mod.CLK(clk); } }; SC_MODULE_EXPORT(mytop); .......... SC_MODULE(mytop) { sc_signal<bool> mysig; line 7: sc_clock clk("myclock", 20, 0.5); myclk mod; SC_CTOR(mytop) : mysig("mysig"), mod("mod") { mod.outp(); mod.CLK(clk); } }; SC_MODULE_EXPORT(mytop); ......... When the above red cannot pas compilation, the error messages are: # # clk_g_head.cpp:7: error: expected identifier before string constant # clk_g_head.cpp:7: error: expected ',' or '...' before string constant # clk_g_head.cpp: In constructor 'mytop::mytop(sc_core::sc_module_name)': # clk_g_head.cpp:13: error: no match for call to '(sc_core::sc_in<bool>) (<unresolved overloaded function type>)' # C:\modeltech_10.1c\include\systemc/sc_signal_ports.h:640: note: candidates are: void sc_core::sc_in<bool>::operator()(const sc_core::sc_signal_in_if<bool>&) # C:\modeltech_10.1c\include\systemc/sc_signal_ports.h:649: note: void sc_core::sc_in<bool>::operator()(sc_core::sc_port<sc_core::sc_signal_in_if<bool>, 1, SC_ONE_OR_MORE_BOUND>&) # C:\modeltech_10.1c\include\systemc/sc_signal_ports.h:658: note: void sc_core::sc_in<bool>::operator()(sc_core::sc_port<sc_core::sc_signal_inout_if<bool>, 1, SC_ONE_OR_MORE_BOUND>&) # ** Error: (sccom-6142) Compilation failed. # # # ** Error: C:/modeltech_10.1c/win32/sccom failed. # Error in macro C:\Users\Jeff\modelsim_systemC\clk_gen\run1.do line 25 # C:/modeltech_10.1c/win32/sccom failed. # while executing # "sccom -g myclk.cpp clk_g_head.cpp" # # Model Technology ModelSim SE sccom 10.1c compiler 2012.07 Jul 27 2012 # # Exported modules: # mytop # # Model Technology ModelSim SE sccom 10.1c compiler 2012.07 Jul 27 2012 What is wrong? Please help me because I am new to both SystemC and C++ yet. Thanks again.
  13. Thank you for your reply. Now, I have the left question on its purpose, see below please. If you think it is out of date, what code would you write? I am new to SystemC now. Please help me on the analysis and an example good style code for this clock generator. void clock_generator() { static bool first = true; if (first || sc_time_stamp().to_default_time_units() == 0) { first = false; clock.write(0); } else { bool nextClockValue = (clock.read() == true) ? false : true; clock.write(nextClockValue); } clock_event.notify(100, SC_NS); }
  14. Hi, After I define fixed point, the last line d(SC_OFF); of #define SC_INCLUDE_FX #include <systemc.h> #include "fir_data.h" void fir_data::entry() { int state; sc_int<8> sample_tmp; sc_ufixed<16,16> d; d(SC_OFF); is complained by compiler: # fir_data.cpp:44: error: no match for call to '(sc_dt::sc_ufixed<16, 16, SC_TRN, SC_WRAP, 0>) (sc_dt::sc_switch)' # C:\modeltech_10.1c\include\systemc/sc_fxnum.h:3372: note: candidates are: const sc_dt::sc_fxnum_subref sc_dt::sc_fxnum::operator()(int, int) const # C:\modeltech_10.1c\include\systemc/sc_fxnum.h:3383: note: sc_dt::sc_fxnum_subref sc_dt::sc_fxnum::operator()(int, int) # C:\modeltech_10.1c\include\systemc/sc_fxnum.h:3415: note: const sc_dt::sc_fxnum_subref sc_dt::sc_fxnum::operator()() const # C:\modeltech_10.1c\include\systemc/sc_fxnum.h:3422: note: sc_dt::sc_fxnum_subref sc_dt::sc_fxnum::operator()() # ** Error: (sccom-6142) Compilation failed. # # # ** Error: C:/modeltech_10.1c/win32/sccom failed. # Error in macro C:\Users\Jeff\modelsim_systemC\fir_clk\run0.do line 25 What is wrong with my code? Thanks,
  15. Thanks. I got my answer. It is about fixed point switch.
  • Create New...