Jump to content

Philipp A Hartmann

  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Philipp A Hartmann

  1. Philipp A Hartmann

    Delay for more than 64 bits value

    Side note: Can you try to keep your reply outside of the "[ quote ]" blocks? Otherwise, it's hard to parse what's new and what's quoted. It is as accurate as you can be in SystemC. As David said in his reply, the SystemC time is represented as a 64-bit value itself. You can adjust the resolution (as a power of 10) with the function call (before using sc_time for the first time!): sc_set_time_resolution( 10, SC_NS ); to increase the maximum simulation time (but lose local precision). In case of very big differences, I would suggest to generate a warning and ignore the notification. It is unlikely, that you need/want both very high time resolution (below a single clock cycle) and very long simulated time periods (several years). Greetings from Oldenburg, Philipp
  2. Philipp A Hartmann

    Delay for more than 64 bits value

    What about something like this: sc_time delay = (x+1) * sc_time(50,SC_NS) * (val_2 - val_1); Greetings from Oldenburg, Philipp
  3. Philipp A Hartmann


    Have a look at the (brief) introductions to TLM-2.0, given by John Aynsley at Youtube: [media=] For a more detailed coverage of TLM-2.0, you can watch more videos on the Accellera website, e.g. TLM-2.0 in Action The OSCI TLM-2.0 Standard and Synthesis Subset Greetings from Oldenburg, Philipp
  4. Do you see a comppiler error, or is the file physically missing on your system? The official release of the Accellera SystemC PoC simulator contains this file. Make sure you have correctly unpacked the archive. $ md5sum systemc-2.3.0.tgz c26b9116f29f1384e21ab8abdb2dd70f systemc-2.3.0.tgz Secondly, you need to add the top-level include directory (<install-directory>/include) to your compiler's include path during compilation, but this is needed for SystemC itself already. Greetings from Oldenburg, Philipp
  5. Philipp A Hartmann

    systemc and image

    I would say, an "image" is already "binary" in most cases. For the other cases, you may find the following documentation very useful: How to Ask Questions the Smart Way Greetings from Oldenburg, Philipp
  6. Philipp A Hartmann

    Pthread error

    First note: You should not run your simulations as the root user. If you want to link statically against SystemC (libsystemc.a), you need to add "-pthread" to your compiler and linker flags (on Linux). This dependency is caused by the "async_request_update" feature in SystemC 2.3.0. Alternatively, you can add "--disable-async-updates" to your SystemC configure options, if you don't need this functionality. Greetings from Oldenburg, Philipp
  7. Philipp A Hartmann

    SystemC 2.2 cthread async reset

    There is no way to model an asynchronous reset with a thread process in SystemC 2.2. If you need to stick with the old version, I'm afraid you need to use method processes instead. Greetings from Oldenburg, Philipp
  8. Philipp A Hartmann

    Conversion dec to hex

    How do you see, whether a value has a decimal or hexadecimal representation? Most probably, it is stored in some form of binary in the memory. ;-) But you can directly assign both hex literals (C++ feature) and hex strings (SystemC datatypes feature) to sc_uint variables: #include <systemc.h> int sc_main(int,char*[]) { sc_uint<32> pippo; // ... pippo = 0x2A; // assign from hex literal pippo = "0x0A2"; // assign from hex string std::cout << pippo // decimal value by default << "=" << pippo.to_string(SC_HEX) // SystemC hex representation << " (0x" << std::hex << pippo <<")" // C++ hex representation (with manual '0x' prefix) << std::endl; return 0; } Gotcha: In SystemC, hex strings are signed literals by default. When dealing with unsigned variables (sc_uint, et.al), you should make sure that the hex string contains a leading 0 to avoid unexpected sign extension, when converting from the hex string. Greetings from Oldenburg, Philipp
  9. Philipp A Hartmann

    SystemC grammar

    Hmm, how would the grammar of "just a SystemC/TLM program" be simpler than parsing plain C++? I'd say that if you indeed would want to define a specific grammar for SystemC/TLM programs, this would be way more complex instead. IMHO, any (decent) SystemC/TLM language frontend needs to contain (or be based on) a plain C++ frontend. For detailed references to existing projects, you should check the references in the survey paper I mentioned. Greetings from Oldenburg, Philipp
  10. Philipp A Hartmann

    SystemC 2.3 installation problems on ubuntu

    Ok, I think you have messed up the file permissions in your "objdir" directory by calling "configure" through sudo. (Why?!) You should start afresh by removing the "objdir" directory first, or try the following from within a "new" build directory. Call "configure" without the "CPPFLAGS=-fpermissive" (Where did you get that from anyway?), and compile as regular user. Afterwards you can install via sudo: ../configure --prefix=/usr/local/systemc-2.3 make sudo make install Greetings from Oldenburg, Philipp
  11. Philipp A Hartmann

    SystemC 2.3 installation problems on ubuntu

    In general, a failing libtool indicates a local problem with your environment. Please check for free space, directory permission, etc. You use a filesystem with sipport for symbolic links, right? (i.e. not NTFS, FAT32)? Do you try to cross-compile? That said, can you please post the output of the call (incl. the parameters given to) the 'configure' script? You somehow added -fpermissive to the compiler flags, which is a bad, if not very bad idea. /Philipp
  12. Philipp A Hartmann

    DCAST exception for SC_THREAD call in constructor VS2012-W8

    Make sure you have the RTTI-information enabled in your VC++ project and that the /vmg switch is added to your compiler settings. See INSTALL file in the SystemC package: http://msdn.microsof...y/we6hfdy0.aspx http://msdn.microsof...y/yad46a6z.aspx Greetings from Oldenburg, Philipp
  13. Philipp A Hartmann

    SystemC grammar

    SystemC(/TLM) is not a first-class language on its own. Instead, it is a C++ class library. Therefore, you can find the language definition in the C++ standard itself, see http://isocpp.org/std/the-standard). That said, you should probably not try to write a C++ parser from scratch. Instead, you may want to look at existing (open-source) parsers, like Clang/LLVM or GCC. There are several projects working on reconstructing the SystemC elements from a C++/SystemC model (SystemC frontends). There has been an overview paper at FDL'2010 about this (Maguet et.al, A Theoretical and Experimental Review of SystemC Front-ends"). Greetings from Oldenburg, Philipp
  14. Not without changing core parts of the kernel.
  15. Of course, Alan is right. You may have a functional error in your model, if B is blocked indefinitely. But of course this depends on what you are modelling. In SystemC 2.3, you can use the new process control functions (kill, reset, throw_it), to interrupt a blocked thread. See section 5.6.6 of IEEE Std. 1666-2011. For sending custom "interrupts", a user-defined throw_it may be the most appropriate solution. But beware, that your models may not be exception-safe and can leak resources or invalidate internal invariants if not coded correctly. SC_THREAD(A); SC_THREAD(; sc_process_handle B_handle = sc_get_current_process_handle(); //... // in A(): B_handle.throw_it( my_exception() ); // in B() try { C_socket->b_transport( ... ); // blocked by a wait internally } catch ( const my_exception& ex ) { // do some cleanup } Similarly, you need to make sure, that C can cope with being interrupted by an exception! Greetings from Oldenburg, Philipp
  16. Philipp A Hartmann

    Bug on ?: operator for sc_int class ?

    Yes, synthesis of C++ data types (like the SystemC ones) is hard and comes with a lot of corner cases. Although I don't know CAPH, two comments: You mention a "type inference phase". The rules for (integer) arithmetics are quite complex in C (and thus in C++). Make sure, that you get the integer promotion rules and the (un)signedness correct. This is quite hard to debug. Hopefully, a good C++ frontend handles most of the work for you here. Inserting the "correct" cast will be very difficult as well. You should rely on the unary operator '+' in this particular case instead: When you detect an expression in one of the operands, make the other one an expression as well by prepending a '+'. This should work for all reasonable arithmetic types and allows you to rely on the C++ rules. Moreover, it will be more efficient (during post-synthesis simulation). Greetings from Oldenburg, Philipp
  17. Philipp A Hartmann

    Bug on ?: operator for sc_int class ?

    It's not a bug in SystemC, C++, nor in your compiler. It's just a restriction of the conditional operator ?: in C++. As the compiler error tells you, you need to have expressions of the same type in both operands. The list of allowed conversions is quite restricted (see e.g. here). Now, sc_int<N> is of class type, whereas the arithmetics are done interallly based on 64-bit integral types. Therefore, you need to cast the result back to sc_int<N> explicitly, or trick both operands to be artihmetic expressions: x<0 ? sc_int<n>(-x) : x; or x<0 ? -x : +x; Greetings from Oldenburg, Philipp NB: I replaced the explicit subtraction "0-x" with a unary minus for clarity and efficiency.
  18. Philipp A Hartmann

    need of delta cycles for correct values

    Usually: yes. At least if you delay the request and data signals within your interconnect models by the same amount of delta cycles (e.g. by forwarding values via explicit processes instead of just port/signal bindings). /Philipp
  19. Philipp A Hartmann

    need of delta cycles for correct values

    Without seeing any details, you most probably need the delta cycles to allow the request line to drop to zero again. You need at least one wait statement on each control path in your process loop, to yield back to the simulation kernel (SystemC uses a cooperative scheduling approach). Without seeing the master code (and the interconnect models, etcpp.), it's quite impossible to say why you need two delta cycles, though. A minor question: How do you tell, if the signal "is kept high", when you only wait for two delta cycles between checking the request line? Your ISS runs without consuming any simulation time? You may want to rethink your synchronisation mechanism. Greetings from Oldenburg, Philipp
  20. Philipp A Hartmann

    sc_bind undefined

    To use the dynamic process features (like sc_bind and sc_spawn), you need to define the preprocessor symbol SC_INCLUDE_DYNAMIC_PROCESSES before including SystemC: #define SC_INCLUDE_DYNAMIC_PROCESSES #include <systemc> In SystemC 2.3.0, this should work reliably, even if SystemC has been already included before. To make sure that this define is in place at all times, you might want to add the define to your compiler options. Greetings from Oldenburg, Philipp
  21. Philipp A Hartmann

    Error in Simulation with NC-SC Sim ( Cadence )

    You can't call constructors in the class definition directly. You need to initialise members in the constructor: axi_master_transactor<> amt; axi_traffic_generator<> atg; SC_CTOR(axi_master_top) : amt("amt") , atg("atg", 2, 4, 0x0000000000000100, 1, 0, 8 ) { /* ... */ } Greetiings from Oldenburg, Philipp
  22. Philipp A Hartmann

    General Understanding

    This is very hard to tell, without any details about your model or the individual components. Options include Use less memory in your model (and look for memory leaks). Buy more physical memory from your favourite hardware shop. Switch to a 64-bit simulation (assuming you have enough physical memory), since 32-bit processes are usually limited to a 2GB address space. Do you allocate (very) large memories (i.e. arrays) in your model?
  23. Philipp A Hartmann

    General Understanding

    You run out of memory and a "new" expression throws an exception.
  24. Philipp A Hartmann

    2.3.0 with Visual 2010 "Unknown compiler"

    You can either ignore the warning, or increase the maximum known version to 1700 (= Visual C++ 2012) in src/sysc/packages/boost/config/compiler/visualc.hpp:162. /Philipp
  25. There is no fixed limit on the size of sc_vector instances, as they are using a std::vector of pointers internally, which has now hard-coded limit either. Apart from the size of the FRAME module itself (in terms of members, etc), you need to consider the required stack allocations for any SC_THREAD processes in the modules as well. If you really need such high numbers of modules, you should try to use SC_METHOD processes whenever possible. Another option may be to reduce the allocated stack size via the set_stack_size() function. Greetings from Oldenburg, Philipp