katang

Members
  • Content count

    32
  • Joined

  • Last visited

  1. What is illegal in what I am trying to do? #include "systemc.h" SC_MODULE (BIT_ADDER) { SC_CTOR (BIT_ADDER) { SC_METHOD (process); } void process(); }; class testbench: sc_core::sc_module { public: testbench(sc_core::sc_module_name nm); virtual void test(void) = 0; }; class testbench_adder: public testbench, BIT_ADDER { public: testbench_adder(sc_core::sc_module_name nm); void test(); }; void BIT_ADDER::process() {} SC_HAS_PROCESS(testbench); testbench::testbench(sc_core::sc_module_name nm) : sc_core::sc_module(nm) {} SC_HAS_PROCESS(testbench_adder); testbench_adder::testbench_adder(sc_core::sc_module_name nm) : testbench::testbench(nm), BIT_ADDER("UUT") { SC_THREAD(test); } void testbench_adder::test() { }
  2. I am working in a CMake environment, compiling, building, documenting and packaging my app. It works fine, except when SystemC is involved. The other libraries, including flex, Qt, gtest, etc. do not cause similar messages. The other options work fine also for SystemC, but when attempting to make a Debian package, I receive the message CPack: Create package CPackDeb: - Generating dependency list CMake Error at /usr/share/cmake-3.5/Modules/CPackDeb.cmake:530 (message): CPackDeb: dpkg-shlibdeps: 'dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory dpkg-shlibdeps: error: couldn't find library libsystemc-2.3.1.so needed What is special with SystemC, or what do I wrong?
  3. I want to make some static testing (like complex submodule names are properly assembled or some utility modules work as expected), SystemC unrelated, using gtest. In the SetUp() and TearDown() methods I define individual environments for the individual tests. I receive tons of messages that the object already defined. What is true, but I want exactly test different instances. Can I reset SystemC somehow or switch off registering the objects when unit testing? (I say again, it is not SystemC related functionality, but embedded in mainly SystemC source files)
  4. In my enhanced version, the compiler said the operator must take exactly one argument. I really cannot find out why. #ifndef scMWE_h #define scMWE_h #include <systemc> #include <iostream> struct Transfer_Type { int Select; int Content; std::ostream& operator << (std::ostream& os, const Transfer_Type& I) { return os; } }; SC_MODULE(scMWE) { scMWE(sc_core::sc_module_name nm); sc_core::sc_fifo<Transfer_Type> from; }; #endif
  5. Thank you, I really missed the point
  6. I want to define a FIFO of user-defined structures. The program below presents with message: no match for 'operator <<' If I change <Transfer> to <int>, int compiles fine. #ifndef scMWE_h #define scMWE_h #include <systemc> #include <iostream> typedef struct { int Select; int Content; } Transfer, *TransferPtr; SC_MODULE(scMWE) { scMWE(sc_core::sc_module_name nm); sc_core::sc_fifo<Transfer> from; }; #endif #include "scMWE.h" SC_HAS_PROCESS(scMWE); scMWE::scMWE(sc_core::sc_module_name nm) : sc_core::sc_module(nm) {}
  7. Hm, I am starting to be proud of my ability to hide so many mistakes in a short MWE. :) What is the reason that the compiler claims "invalid static_cast" rather than wrong signature? (the rest of mistakes is just a consequence of the first unfixed one)
  8. Here goes the code: #ifndef scMWE_h #define scMWE_h #include <systemc> #include <iostream> SC_MODULE(scMWE) { scMWE(sc_core::sc_module_name nm); void WritePseudo(int A ); sc_core::sc_fifo_in<int> in[4]; }; #endif #include "scMWE.h" SC_HAS_PROCESS(scMWE); scMWE::scMWE(sc_core::sc_module_name nm) : sc_core::sc_module(nm) { SC_METHOD(WritePseudo); // sensitive << in; } void scMWE:: WritePseudo(int A) { std::cout << "MWE:A" << A << std::endl; }
  9. I am using the alternative style offered in book SCFTGU. In the .cpp file, I am using a normal contructor. The SC_HAS_PROCESS(MyObj); compiles OK, the SC_METHOD(MySub); ditto, but next to it sensitive << in; is refused with error message 'invalid static cast'. I guess that somehow the SC_CTOR() call is missing. What is the correct syntax?
  10. Yes, I want to synthesize the design, and that is why I am looking for ideas for components which enable this. To your second question: are there chances that standard components like sc_fifo and sc_semaphore are not supported? Till now this did not cross my mind.
  11. With reference to http://www.cplusplus.com/forum/general/1754/ Is there a syntax variant which allows to put templated member function in the .cpp file?
  12. I am following the alternative style in book SCFTGU, and I wanted to put two closely related modules in the same source file. I collected the experience that using SC_HAS_PROCESS for the second module in the same source file provokes error message. Why is it so?
  13. Hello @Ameya, thanks for the hint. I found https://github.com/systemc/systemc-2.3/blob/master/docs/LRM.pdf which is 12 years old, from outside V2.3, from inside V2.1. Is it the up-to-date version? Concerning my question. Using modules, has its price both in SW and HW. In SW, parameters are passed, stack space used and the execution is slowed down when compared to the "inline" implementation. In HW, instead of using hierarchical design, I can also include the body of the sub-modules, which may result in hard-to understand, inflexible but more effective designs, say using direct wiring rather than using ports, I guess. BTW, during synthesis, "inline" has any effect?
  14. with reference to http://stackoverflow.com/questions/4923292/using-existing-unit-test-frameworks-with-systemc the Error: (E546) sc_start called after sc_stop has been called seems to be logical. Can it have side effects, should (can) it be suppressed, or can the system be re-initialized, or is a better way for unit testing? A related question: in a testing environment it would be advantageous for me, to use some SystemC-handled functions as normal C++ function (I mean to make some unit tests). I guess BEFORE calling sc_start, I can do so. Am I right, or they may have side effects? Is it safe to make unit tests together with SystemC-style testing, or which are the limitations?
  15. My task is to implement what in C++ would be an ordered queue. I.e. my consumer wants to "see" a FIFO, and several consumers put data independently (i.e in parallel) and the channel inserts the received data at the right position. My idea is to start with sc_fifo, and sc_semaphore to write contents. Then I need method for inserting the new content at the right position, with the goal to synthesize the design. Is there a better idea to start with? What is the "best" approach to implement insertion, in terms of resource usage and speed?