Jump to content

David Black

Members
  • Content count

    257
  • Joined

  • Last visited

  • Days Won

    56

David Black last won the day on July 9

David Black had the most liked content!

6 Followers

About David Black

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

1,173 profile views
  1. Looks to me like you are declaring sc_clock objects inside the constructor on the stack, which will then be immediately destroyed at the end of construction. They should be class members. Also, you appear to have the intent of using PHREADs; however, SystemC is not thread-safe unless you take special precautions. I would also suggest you consider using std::unique_ptr<> instead managing pointers yourself. Safety first.
  2. TLM2 is completely different from RTL type of connection. Interface won't work. Nor is there timing you can count on since it could be either AT or LT without timing. You also need to specify if you are interfacing between SV and SC or is this native SV UVM to UVM TLM2.
  3. David Black

    A void value confusion

    Based on what I see, the * shouldn't even be there at all since the -> takes care of it. Either use: mNeuron->dendrit[index].write(value); or (*mNeuron).dendrit[index].write(value); However, I'm more concerned that you're not using ports to access members of a module (assuming Dendrit_Set is not part of module Neuron). That violates a rather fundamental principle of SystemC. It's legal C++, but questionable SystemC.
  4. David Black

    SystemC linking problem in Ubuntu

    On the surface I would say you have a problem with your own code, but I cannot say much more because you did not share the code with us. At a minimum I would need to see main.cpp, but if you have other source files (e.g. state.cpp, which I would expect since any self-respecting C++ coder would put each class into its own CLASSNAME.cpp and CLASSNAME.h (or .hpp) file). Note: This has nothing to do with Ubuntu and likely little to do with the SystemC version.
  5. David Black

    Passing event to SC_CTHREAD macro

    The only use I see for SC_CTHREAD is synthesis tools, and this is really just a legacy issue and a vendor tools issue. The same SC_THREAD could have been used for posedge_event. This would change the coding of wait in your code though: wait(5); // 5 clock delay becomes for(int i=5; i--;) wait();// prior to C++17 which could easily be addressed with: void nWait(size_t n) { while(n--) wait(); } and allows nWait(5);
  6. I went and looked at the website where this stuff was supposed to be and found problems. I then dug around and found an archived copy, did a quick sanity check, and I've now published it on GitHub under github.com/dcblack/SCFTGU_BOOK As noted, I am working on a modern version, but time is limited.
  7. David Black

    Implement sc_trace for std::string

    Perhaps you would be willing to share your work as an Apache 2.0 licensed github project with the minimal code needed and a screen snapshot of the results.
  8. David Black

    reset method or thread

    Reset is accomplished by throwing an exception. You cannot perform cleanup *before*, but you can perform cleanup on the way out in two manners. First, automatically created objects will of course run their destructors as guaranteed by C++. Second, you can catch exceptions by strategic placement of try-catch blocks and looking for the appropriate sc_exception. It is required by SystemC that you rethrow after catching; otherwise, you will corrupt the SystemC kernel.
  9. David Black

    sc_spawn and anthoer process

    sc_spawn creates same kind of processes as sC_METHOD, SC_THREAD, etc, but is not limited to the elaboration phase. Please either read the official documentation for IEEE-1666 (available as pdf free via Accellera) or get a good book on SystemC or take a class.
  10. David Black

    Non Constructible but Copyable !

    A derived class could inherit this.
  11. David Black

    make check return fail

    I am able to reproduce the problem and will attempt a fix. Unless you are using async_request_update() in your code, you can safely ignore this problem for now. CORRECTION: While there is a bug with the following deprecated feature issue, this does not solve the problem. Stay tuned for a real fix. There is a bug in the implementation of SystemC due to Apple removing support for POSIX sem_init, which is a non-required API by the POSIX standard. See <https://stackoverflow.com/questions/1413785/sem-init-on-os-x/24617282> for details. [Pure speculation: I suspect the reason for removing support was that Apple has recently moved to an all 64-bit coding model. Potentially because they are positioning themselves to be able to port quickly to Arm v8A lacking Aarch32 on certain hardware.] When building on OSX using Cmake I noticed a clue: I use the adage, "A warning is usually a potential bug leading to a real error." Never ignore warnings from compilations. Yes, I know there is a lot of code out there with superfluous warnings. Shame on them for leaving them in. So if you see a warning, track it down. If it is truly a don't care (rarely), then it can be overridden with a #pragma. Almost all warnings can be fixed with proper coding. I am going to attempt a fix to sc_host_semaphore.h, but if you're in a hurry go to Linux.
  12. Yes, SystemC is doing exactly what is supposed to do. Perfect behavior and standard reaction when you don't understand event driven simulators. In Verilog/SystemVerilog, this behavior is called non-blocking assignment (NBA). In VHDL, this is the behavior of a signal.
  13. David Black

    system c beginner

    Here is a short list of topics in no particular order you need to be comfortable with in order to be have an easier time learning SystemC: [Note: Others might chime in with variations on this list (add/subtract), and this is not necessarily a complete list, but I am fairly certain if you are able to comfortably use the topics I list below, you will have very little trouble syntactically with learning SystemC. In addition to C++, it helps if you have some familiarity with event driven simulation (e.g. SystemVerilog or VHDL). Also, if you have deep knowledge in another OO language (e.g. Java or SystemVerilog), you might have an easier time learning the C++ part.] Difference between declaration and definition Pass by value vs pass by reference Use of const (5 distinct cases) Casting C++ style (4 types) Implicit vs explicit conversions Use of function overloading and how to deal with ambiguity issues Use of std::string Use of streaming I/O How to declare, define and use classes Definition of default constructor Purpose and syntax of copy constructor How to declare and use namespaces Operator overloading as member functions and global functions. The difference between overloading and overriding. Relationship between class and struct How to extend classes and multiple inheritance Purpose of public and private Storage types and lifetimes: static, automatic, dynamic How to properly use new and delete Use of pointers and understanding of issues with pointer arithmetic Use of arrays and issues Advantages and use of std::vector<> Use of try-catch and throw Use of initializer list in constructor and a proper understanding of the order of construction Polymorphism and RTTI RAII Rule of 4 (6 if using C++11 or later) How and where to define templates/generic programming (does not need to be deep knowledge - just the basics) Use of templates and nested templates. Definition of full and partial template specialization. Different types of constructors and destructors Use of virtual inheritance (hint: it's not polymorphism) Extra topics: More STL including at least std::map<>, std::set<> Boost Modern C++ users (2011 onward) should know about: nullptr Uniform initialization Use of auto Use of ranged for Lambda definition, binding and use constexpr std::unique_ptr<>m std::shared_ptr<>
  14. David Black

    System C quite different from c++

    First, the title of this post is completely nonsensical. SystemC is a library written in C++ and everything about it is C++. It is much more likely that you simply are not very proficient with C++. One aspect of SystemC I always warn newbies about is that SystemC uses pretty much all of the features of C++. You really cannot get by with just thinking C++ is merely a better C. You have to really know about polymorphism, function/operator overloading, templates, exception handling, STL libraries, and all things C++. If you do not, I suggest you get some deeper learning on C++. Your problem is that sc_module disallows copy construction. Prior to C++11, this was accomplished by declaring the copy constructor private, which is why you are getting the error. sc_vector really is a better way of creating an array of modules, and it looks as if somebody has given you this hint.
  15. David Black

    what is "argc" and "argv[]" in systemc?

    Doesn't make as much sense to those who use Windows and Visual Studio. Much more understandable if you use Linux. Tip: You can access those two arguments from anywhere in your SystemC design using the two functions: sc_argc() and sc_argv(), which are in the sc_core namespace. Keep in mind that they only provide access to c_str values. If you want to interpret a numeric value from the command-line, you will need to convert it yourself.
×