Jump to content

Philipp A Hartmann

Members
  • Content Count

    506
  • Joined

  • Last visited

  • Days Won

    122

Everything posted by Philipp A Hartmann

  1. You can write a transactor, converting the TLM-2.0 transactions to/from the existing SystemC subsystem interface. /Philipp
  2. As the error says (emphasis mine) you need a default constructor (a constructor without arguments) in your case. In the module, you create an instance of 'decimal' without explicitly initializing it in the constructor of 'seprate_digit'. Theoretically, you could use an initializer list: SC_CTOR (seprate_digit) : in("in"), clk("clk"), d("d") // port names -> recommended practice , decimal(0,0,0,0) // <-- explicitly initialize decimal member Since you use 'decimal' as a signal type, you'll definitely need a default constructor. This could look like the following decimal() /* : dec0(), dec1(), dec2(), dec3() */ // optional, as sc_int has an explicit default constructor {} Secondly, you'll need to define more helper functions to use sc_signal with your own data types, see http://www.doulos.com/knowhow/systemc/faq/#q1 Greetings from Oldenburg, Philipp NB: Why do you post the question three times in 10 minutes? ;-)
  3. Rahul, after fixing the missing '$' at the beginning of your vcd dump, I got the following error on GTKwave: GTKWave Analyzer v3.3.49 (w)1999-2013 BSI Near byte 206, $VAR parse error encountered with 'SystemC.Enable' Near byte 252, $VAR parse error encountered with 'SystemC.output' No symbols in VCD file..nothing to do! As you can see, there is an error in your VCD file (at least according to GTKwave): You use spaces in your signal names. Replace those with '_' or something similar, and your VCD viewer should be happy. hth, Philipp
  4. Sumit, personally I'm indeed interested in proposals towards extended interfaces for extracting information from SystemC simulations. In fact, there is some activity in that area underway, but please don't count on any short-term availability for now. You may be interested in my recent presentation at ESCUG'28. Introspection in general is on the charter of the CCIWG. In this working group, we're currently focusing on configuration first. Some parts may still be needed from the language/kernel side of things, as we currently don't even have a safe, reliable mechanism to extract information during the simulation. Interfaces to provide tracing data to some backends could be improved as well. As Hans already said, commercial tools already provide powerful analysis backends. IMHO, this backend side is out of the scope of standardization. In general, the Accellera SystemC working groups are usually always quite busy and have limited resources to work on all of the interesting improvements that you can think of. On the other hand, with the new SystemC community uploads area here at accellera.org, you can easily share your own experiments and proposals, even without formally joining the Accellera Systems Initiative. Greetings from Oldenburg, Philipp
  5. Yutetsu, thanks for considering to upload the tool to the SystemC community uploads. I didn't check the licensing terms of the upload area before, but when you try to upload files there, you will be asked to confirm the following: As the Apache License less restrictive than the GPLv2 (but still GPLv2 compatible), it's up to you whether you want to your tool available under these terms. Alternatively, you can eventually upload a short technical report, describing the functionaliy of the tool and add an external link to the GitHub repository. Thanks, Philipp
  6. Kocha, this looks like a nice utility and may be useful to the SystemC community in general. Have you considered to upload/share this in the new SystemC community uploads area? Greetings from Oldenburg, Philipp
  7. The 2.0.1 LRM is very old. SystemC became an IEEE standard in the meantime, and luckily the same example is now part of the IEEE Std. 1666-2011 (see 7.10.1, Table 32). The ranges mentioned there match the ones you were expecting. Greetings from Oldenburg, Philipp
  8. As you may have noticed, only the exception-related SystemC classes (sc_report, sc_unwind_exception) use exception specifications (and only the plain throw()). These are required by C++03, see http://www.cplusplus.com/reference/exception/exception/. Have you experienced problems (except for potential deprecation warnings) in C++11 mode on some compilers (clang?). Can you share the compiler flags and the corresponding error messages? /Philipp
  9. Feel free to share the list of affected classes here. (I assume, it's mostly the pre-defined interfaces and channels being on that list). /Philipp
  10. In general, issues related to weak vtables are not that widely known, I think. Nevertheless, since this is only related to the compilation/(dynamic) linking performance of the library, I don't think that there is an immediate need for any changes to the proof-of-concept implementation. Commercial vendors may of course perform their own optimizations in this area. Greetings from Oldenburg, Philipp
  11. Sumit, thanks for reporting this. This part of the code is not used from within the standard API. Thus, I think it may be Ok to have this missing currently. If we'd wanted to fix this, we probably should add SC_CSD to the "not yet implemented" case here (to be safe). The proof-of-concept implementation of the standardised API uses other parts of the library for string conversions (including SC_CSD). Greetings from Oldenburg, Philipp
  12. You should make sure that SC_INCLUDE_FX is consistently defined through all header files, preferably by setting it on the compiler command-line (option -DSC_INCLUDE_FX). I would suspect that you included systemc.h already from somewhere else before defining SC_INCLUDE_FX locally. Did you try your example separately? It compiles mostly fine here, except for the fact that the module is called "rand" which locally shadows the "rand()" function, you try to call from the process. Greetings from Oldenburg, Philipp
  13. Sumit, yes, you can safely remove the storage class specifier "register" from sc_nbutils.h. It's only a hint for the compiler, and today's compilers usually now way better which variables to put in registers (and e.g. loop variables will probably end there anyhow). But why do you want to bother? Does your compiler complain about these? Please keep in mind, that this is still a reserved keyword in C/C++. You don't want to re-#define this token, do you? Greetings from Oldenburg, Philipp
  14. If I understand you correctly, you want to have a preprocessor switch: #if defined(DEBUG) # define PRINT_MY_DEBUG( Some, Args ) \ print_debug_impl( (Some), (Args) ) #else # define PRINT_MY_DEBUG( Some, Args ) \ ((void)0) /* empty statement */ #endif // DEBUG void print_debug_impl( ... ); // real function implementation In the example above, the preprocessor symbol DEBUG is checked, whether or not to enable calls to the print_debug_impl function through the PRINT_MY_DEBUG function macro. You can define such symbols in the source, or via the command-line of your compiler (usually "-D<symbol>[=<value>]", i.e. here -DDEBUG). hth, Philipp
  15. Indeed, you're right, Alan. I stand corrected. I apologize for the false allegations. /Philipp
  16. Well, did you actually try to browse the provided website? ;-) http://www.embecosm.com/resources/software//Philipp
  17. On the above webpage, I don't see any references to the original authors of this work. In the provided whitepaper the page, no author information is given either. On the other hand, the article is a verbatim copy of an older article from IP-SOC/2005: http://www.design-reuse.com/articles/12918/reusing-verilog-ip-cores-in-systemc-environment-by-v2sc.html (by Leila Mahmoudi Ayough, Ali Haj Abutalebi, Ali Iranmanesh and Moji Atarodi). I think, it would be polite to acknowledge the original authors explicitly. /Philipp
  18. In case you don't want to download files from unknown sources, you can build the Doxygen documentation from the SystemC source tree directly: cd $SYSTEMC_HOME make -C objdir doxygen # assuming the configure-created Makefiles are located in the ./objdir/ subdirectory Afterwards point your browser to docs/sysc/doxygen/html/index.html # SystemC 2.3.0 docs/tlm/doxygen/html/index.html # TLM 2.0.2 The Doxygen configuration file templates can be found in docs/*/doxygen/ as well, in case you prefer different options. Greetings from Oldenburg, Philipp
  19. Prasanna, yes, the time resolution is limited to femtoseconds in IEEE 1666-2011. It is even guaranteed that SC_FS = 0, which means you can't easily add an SC_AS to your own implementation without the risk of breaking models relying on the SC_[timeunit] enum values (provided that you even have access to the sc_time source code). Do you need these small time values for event notifications and/or delays? Then you're currently out of luck. In case you can control the overall simulation, then you can "slow down" the simulated time by a factor of 1000, interpreting seconds as microseconds. But this is of course dangerous, since some parts of the model may rely on the physical meaning of e.g. sc_time.to_seconds() values. If you need this small resolution for internal computations only, you can resort to your own time type with small conversion functions from/to sc_time, e.g. based on the to_seconds() function returning a plain double (and therefore relying on its physical meaning as well, see above). Greetings from Oldenburg, Philipp
  20. Hans, Yes, you can (no pun intended). Here, you try to pass pin by value, which invokes a (deprecated, non-naming) copy-constructor, taking a non-const reference to dbusin. Since the simulation is already running (as it is said in the error message), this port creation fails. Add the missing & to pass pin by const-reference (as probably intended anyway). /Philipp
  21. See IEEE 1666-2011, Section 4.2.12 (emphasis mine): In other words, even if an implementation chooses to use "real" OS threads to implement SC_[C]THREAD processes, the usual way to guarantee the above is to ensure mutual exclusion between the thread activations. Greetings from Oldenburg, Philipp
  22. The function to set attributes for TDF MoC elaboration is called set_attributes() (plural form). You should be able to find such an error quite quickly by either adding simple debugging messages ("printf-debugging") or by using a proper debugger. Greetings from Oldenburg, Philipp
  23. As said in my initial reply, you wouldn't be able to catch any dynamic sensitivity (next_trigger) with this approach. Secondly, how do you implement the suspension of the method "afterwards"? During the following update phase? This wouldn't catch any following immediate notifications of the "scheduled method" in the current evaluation phase. There are more fundamental problems to solve than "just" copying the static sensitivity. I would suggest to wrap the user function call in a helper function containing the interaction with your scheduler class, instead of using the process control statements. Alternatively, you can add a separate statement to mark a method as schedulable (but this would still not catch dynamic sensitivity in the user method): SC_METHOD( user_method ); schedulable(); sensitive << ...; // put _after_ schedulable() statement! // add to some base class, could eventually be implemented as a free function as well void schedulable() { // pseudo code static std::map<sc_process_handle, sc_event*> ev_map; // put in the scheduler sc_process_handle h = sc_get_current_process_handle(); sensitive << *(ev_map[h] = new sc_event); dont_initialize(); // create wrapper method SC_METHOD( sensitivity_method ); // mark "h" as runnable here // senstitivity in user code again } Greetings from Oldenburg, Philipp
  24. Sam, That's not fully correct. In C++, you can't (directly) consider the return-type of a function (e.g: for overloading) to adapt the behaviour. You need to resort to intermediate values instead. In case of sc_fix(ed)/sc_fxnum, this intermediate value is sc_fxval, a variable-precision fixed-point value. Objects of this type always carry the required amount of bits during run-time and the assignment to another finite-precision type (sc_fxnum et.al.) handles the quantisation and overflow. AFAICS, you want to build a container class template for arithmetic types that provides element-wise operators. In order to deal with such intermediate values, there are several options depending on the level of generality you need to achieve and the constraints on the C++ language features, you can rely on. Disclaimer: The following snippets are fully untested. Simplest solution: Return a Vector<sc_fxval> instead (and provide an appropriate assignment operator/conversion constructor): Vector<sc_fxval,N> operator>> (unsigned m) const { Vector<sc_fxval,N> tmp; for (int i=0; i<N; i++) tmp.m_array[i] = m_array[i]>>m; return tmp; } Of course, this will limit the use of this shift operator in your Vector template to classes, where the result of the shift operator on the elements can be reasonably converted to sc_fxval. As a second option, you can use C++11's decltype and new function declaration syntax: auto operator>> (unsigned m) const -> Vector< decltype(T() >> m), N > { typedef decltype( T() >> m ) return_type; Vector<return_type,N> tmp; for (int i=0; i<N; i++) tmp.m_array[i] = m_array[i]>>m; return tmp; } This should work correctly for arbitrary shift operators and return an array of shift results. Since your compiler may not support these shiny new features of C++11, you can use a traits class with (partial) specialisation: template< typename T > struct vector_element_traits; // partial specialisation for sc_fixed template< int WordLength, int IntegerWordLength, sc_o_mode Overflow, sc_q_mode Quantization > struct vector_element_traits< sc_fixed<WordLength, IntegerWordLength, Overflow, Quantization > > { typedef sc_fxval right_shift_result; }; // ... Vector<typename vector_element_traits<T>::right_shift_result,N> operator>> (unsigned m) const { Vector<typename vector_element_traits<T>::right_shift_result,N> > tmp; for (int i=0; i<N; i++) tmp.m_array[i] = m_array[i]>>m; return tmp; } Last but not least, you can defer the evaluation of the element-wise operator by using expression templates to the implementation of the assignment operator of the vector. But this may be a bit too advanced for tonight. ;-) Greetings from Oldenburg, Philipp
×
×
  • Create New...