Jump to content

dakupoto

Members
  • Content Count

    252
  • Joined

  • Last visited

  • Days Won

    8

Reputation Activity

  1. Like
    dakupoto got a reaction from rtmc in How should I design multiple writers?   
    Hello Sir,
    As you have found out yourself, multiple writer feature is not supported
    by the built-in channel classes. Have you looked into the possibility of
    creating your own channel ? Alternatively, have you considered the
    option of a shared memory with multiple readers and writers, coupled
    with blocking reads/writes -- please check the built-in concurrency control
    classes as sc_mutex, sc_semaphore. Hope that helps.
  2. Like
    dakupoto got a reaction from Rashmi11 in syntax for copying the bit vector , systemC 2.3.1 version   
    Hello,
     A bit vector is a C++ RTL vector. So, have you looked into the possibility
    of using a copy constructor ? I am sure the basic C++ STL vector supports
    a cop constructor, so this ought to work.
  3. Like
    dakupoto got a reaction from VKrishnamurthy in Passing maps within Constructors in SystemC struct   
    Hello Sir,
    If I understand your query correctly, you want to create
    a module and pass in a number of Map objects through the
    constructor. Is that correct ?
    If yes, the scheme is fairly straightforward.
    1. Create four Map objects and then pass them in via the
    module constructor initialization list -- standard C++
    trick.
    You have mentioned something about the Map objects being
    private. In that case, the above scheme will not work, as
    the Maps must be created before being passed in via the
    module constructor initialization list. These Maps will
    be visible to other modules as well. To make the Maps
    private, declare and define them inside your own module
    Hope that helps.
     
  4. Like
    dakupoto got a reaction from David Black in Writing / reading unsigned long long using double channel   
    Hello Sir,
    Have you considered the possibility of using bit vectors of sizes specified by
    you, instead of using 'long long' etc., After all, in a real world hardware, all
    numbers are stored as bit vectors, so although it might appear somewhat
    of a low-level approach, it would be far more intuitive, and there would not
    be any of the casting issues that you face. Hope that helps.
  5. Like
    dakupoto got a reaction from karthickg in Using sc_event_or_list to set static sensitivity of spawned processes   
    Hello Sir,
    Please note that for all static processes the data elements/structures and associated
    kernel operations are determined at the time of elaboration, before simulation. On the
    other hand, everything related to dynamic processes is determined at runtime. So how
    would the simulation kernel create a sensitivity list for something that does not exist at
    the time of elaboration ?  There appears to be some confusion here.
  6. Like
    dakupoto got a reaction from kimjhun310 in Can I close sc_trace_file dynamically at any time?   
    Hello Sir,
    Echoing essentailly what Mr. Alan has said, please
    note also that the sc_trace file object is not very
    flexible, to achieve the goals that you have stated.
     
    You could create your own customized trace file
    object -- SystemC is just a ANSI C++ library. One
    can create a custom trace file that can be plotted
    with e.g., gnuplot or Excel without any problems.
    The advantage is that one could for example,
    write to the custom trace file if some condition
    is satisfied -- just use appropriate guards.
    Hope that helps.
  7. Like
    dakupoto got a reaction from karandeep963 in Dynamic module instance creation   
    Hello Sir,
    I would wait for the gurus on this forum to address your query
    in detail, but rigt off, it appears to be a difficult goal to achieve.
    First of all, please keep in mind the physical picture -- would it
    be possible, in a real system with real integrated circuits, to
    achieve your goal ? That is, how would it be possible, for
    example to not use 2 out of 4 input ports of a microcontroller,
    and then later use the previously unused ports, WITHOUT
    making too many significant changes ? In my humble opinion,
    that is not an easy task. In software, one can do a lot of things
    that have no bearing/relationship with the real world. Hope that
    helps.
  8. Like
    dakupoto got a reaction from carter in start systemc   
    Hello Sir,
    You would need to know C++ like the back of your hand to
    effectively program in SystemC. SystemC is a ANSI C++
    library.
  9. Like
    dakupoto got a reaction from rajit.a in role of dynamic processes   
    In perfect agreement with what Phillipp has said, if one is trying to analyze/model hardware,
    absolutely do not use dynamic processes, as there is no such thing as creating hardware
    "on the fly". But if one is examing software, one could use dynamic processes.  
  10. Like
    dakupoto got a reaction from amitk3553 in role of dynamic processes   
    In perfect agreement with what Phillipp has said, if one is trying to analyze/model hardware,
    absolutely do not use dynamic processes, as there is no such thing as creating hardware
    "on the fly". But if one is examing software, one could use dynamic processes.  
  11. Like
    dakupoto got a reaction from David Black in Installation Problem with SystemC 2.3.0 and Ubuntu 64 bit   
    Hello Sir,
    If as you say you are a beginner to C/C++, please brush up on your C/C++ very well,
    before you attempt SystemC. SystemC is basically a C++ library and is based on one
    of the most advanced features of the language - "templates". If you plunge into SystemC
    right off, you will run into rough weather. So please devote at least a month or so so,
    get grips on the C++ langauge features and then get into SystemC. Hope that helps.
  12. Like
    dakupoto got a reaction from amitk3553 in How to implement i2c clock synchronization using systemc?   
    Hello Sir/Madam,
    Real world on chip clock synchronization is achieved
    with a bautiful analog scheme - phase locked loop(PLL).
    A phase locked loop can be implemnted in both SystemC
    and SystemC-AMS very easily. An alternative is to use
    derived clocks - master clock triggering several other
    clocks - the derived clock runs at the same frequency
    as the master clock as:
    clkout.write(clkin.read());
    Hope that helps.
  13. Like
    dakupoto got a reaction from karandeep963 in sc_bool to sc_logic   
    Hello Sir,
    It appears that there are some fundamental issues that need attention.
    1. The AND gate module looks fine -- what exactly is the error message ?
    2. HDLs as Verilog/VHDL were designed keeping in mind the special
    requirements of simulating hardware -- concurrency, clocks, etc., SystemC
    is a C++ library, and C++ was NOT designed to address the special
    requirements of hardware design, so one cannot hope to achieve
    identical end result with SystemC that one does with Verilog/VHDL.
    A lot of times, workarounds are required.
    Hope that helps.
  14. Like
    dakupoto got a reaction from karandeep963 in sc_bool to sc_logic   
    Hello Sir,
    First of all, are you sure there is any data type "sc_bool" ? If so, what is the
    difference between the built-in C++ datatype "bool" and "sc_bool" ? Using
    the standard C++ bool datatype the conversion from bool to sc_bool is
    simple, using string literals.
    Let us suppose there is a Boolean variable 'bb' and a sc_logic variable
    sc_l as:
     
    bool bb;
    sc_dt::sc_logic sc_l;
    /* some processing * here .. */
    sc_l = bb == true ? '1' : '0';
    /* Reverse conversion */
    bb = sc_l == '1' ? true : false;
     
    Note that sc_logic can take on two other values:
    'X' : dont't care state
    'Z' : high impedance state
     
    Hope that helps.
  15. Like
    dakupoto got a reaction from agrawalyogesh04 in Installation Problem with SystemC 2.3.0 and Ubuntu 64 bit   
    Hello Sir,
    If as you say you are a beginner to C/C++, please brush up on your C/C++ very well,
    before you attempt SystemC. SystemC is basically a C++ library and is based on one
    of the most advanced features of the language - "templates". If you plunge into SystemC
    right off, you will run into rough weather. So please devote at least a month or so so,
    get grips on the C++ langauge features and then get into SystemC. Hope that helps.
  16. Like
    dakupoto got a reaction from amitk3553 in destruct objects   
    Hello Sir,
    May we request that you get a good reference book on C++ and read it up ?
    The destructor for a class is ALWAYS placed inside the class, for example:
    class foo
    {
     foo(){}
    ~foo(){} /* destructor */
    };
    Most importantly, a destructor is NEVER, EVER invoked by the programmer.
    A destructor is invoked ONLY by the runtime system when the instance of a
    class(the object) is destroyed.
    Hope that helps.
  17. Like
    dakupoto got a reaction from amitk3553 in Pass Parameter   
    Hello Sir.
    Let us clear the confusion here. May I suggest the following -- very widely used in both C++/
    SystemC.
    1. Put all test case classes in a ".h" file. When you want to use say "testcase_001" in a "*.cpp"
    file, just use include the appropriate header file (that is the *.h file with the test case classes)
    Will always work.
    2. Make sure that each test case class has a no arguments constructor.
    3. When you want to create an instance of a test case class, just do so by invoking the no
    arguments constructor.
    4. If you use the 'new' operator to create an array, please use a "delete [] <arrayname>;" in
    the class destructor. You will save yourself lots of trouble and misery by staying away from
    the new and delete.
    5. Please use a destructor in each class
    Hope that helps.
  18. Like
    dakupoto got a reaction from karandeep963 in array inside class   
    Hello,
    Please note that SystemC is just a C++ library. So, there is no reason why an array
    cannot be declared, initialized and used inside a class. But there are some problems:
    1. unsigned char* host_hci_pkt_arr == this is just a pointer to a single unsigned char
    NOT an array of pointers to unsigned chars. Why not :
    unsigned char* host_hci_pkt_arr[<SOME_SIZE>];
    This is declaring array of pointers to an array of SOME_SIZE, explicitly. You could then
    fill the elements in as : host_hci_pkt_arr[0] = "0x01";
    2. The moment you use the "new" operator, you have to use the corresponding "delete"
    to clear memory in the destructor. On the other hand, by explicitly declaring the array
    as above, the compiler and runtime system takes care of memory allocation/deallocation.
    It appears that you are trying to model packets, and realistically a packet consists of a
    large number of bytes. If there are a large number of packets moving around, that are
    created dynamically, and then not deleted when the container object is deleted, one is
    looking at annoying memory leak issues.
    HTH.
  19. Like
    dakupoto got a reaction from amitk3553 in array inside class   
    Hello,
    Please note that SystemC is just a C++ library. So, there is no reason why an array
    cannot be declared, initialized and used inside a class. But there are some problems:
    1. unsigned char* host_hci_pkt_arr == this is just a pointer to a single unsigned char
    NOT an array of pointers to unsigned chars. Why not :
    unsigned char* host_hci_pkt_arr[<SOME_SIZE>];
    This is declaring array of pointers to an array of SOME_SIZE, explicitly. You could then
    fill the elements in as : host_hci_pkt_arr[0] = "0x01";
    2. The moment you use the "new" operator, you have to use the corresponding "delete"
    to clear memory in the destructor. On the other hand, by explicitly declaring the array
    as above, the compiler and runtime system takes care of memory allocation/deallocation.
    It appears that you are trying to model packets, and realistically a packet consists of a
    large number of bytes. If there are a large number of packets moving around, that are
    created dynamically, and then not deleted when the container object is deleted, one is
    looking at annoying memory leak issues.
    HTH.
  20. Like
    dakupoto got a reaction from mohitnegi in solution for problem ...   
    Hello,
    If you have read my responses to three recent queries on
    this newsgroup, you like the others, have run into a fundamental
    drawback/problem of C++ templates. The reason why your
    fifo works with single characters only is because during the
    crucial SystemC elaboration step, the size (number of bits)
    for a single character is known to the compiler. Also note
    that the SystemC built-in sc_fifo module can tackle built-in
    C++ primitive data types(char, double, float int ....) ONLY.
    As a character string can be of any size, it is an user
    defined data type, and so the user has to provide the
    mechanism to handle it.  
    So, to transfer character strings via a custom fifo, a good
    option would be to:
    1. Declare a custom interface - subclass of sc_core::sc_interface
    2. Create a class that implements the interface - must ensure
    FIFO order in the input/output. This would be the character
    string FIFO.
    3. Create custom ports to read/write character strings from/to
    custom channel
     
    Yes, it is rather messy, but it is straightforward. Hope this helps.
  21. Like
    dakupoto got a reaction from karandeep963 in solution for problem ...   
    Hello,
    If you have read my responses to three recent queries on
    this newsgroup, you like the others, have run into a fundamental
    drawback/problem of C++ templates. The reason why your
    fifo works with single characters only is because during the
    crucial SystemC elaboration step, the size (number of bits)
    for a single character is known to the compiler. Also note
    that the SystemC built-in sc_fifo module can tackle built-in
    C++ primitive data types(char, double, float int ....) ONLY.
    As a character string can be of any size, it is an user
    defined data type, and so the user has to provide the
    mechanism to handle it.  
    So, to transfer character strings via a custom fifo, a good
    option would be to:
    1. Declare a custom interface - subclass of sc_core::sc_interface
    2. Create a class that implements the interface - must ensure
    FIFO order in the input/output. This would be the character
    string FIFO.
    3. Create custom ports to read/write character strings from/to
    custom channel
     
    Yes, it is rather messy, but it is straightforward. Hope this helps.
  22. Like
    dakupoto got a reaction from karandeep963 in problem with constructor   
    The poster has most probably woken up in the morning to
    realize that his important class project is due that evening.
  23. Like
    dakupoto got a reaction from milind.shende5 in what is the best strategy to model A2D converter ? SC or SC-AMS   
    Hello Sir,
    There is no need to use a while loop, except
    perhaps in some special case, in the TDF
    framework. The TDF framework offers a set of
    methods that can be overriden and if used
    correctly/wisely will remove the need for a
    while loop.
    In the 'set_attributes()' method, one can
    use the built-in 'set_timestep()' method to
    set when data is read in from an input port,
    or read out to an output port. So at tick or
    sub-interval of the total simulation time,
    data is read in/out as specified.
    But this is what is done in pure SystemC as
    well, for a SC_THREAD or SC_CTHREAD. There
    A sensitivity list defines the triggering
    event, often a clock, at which the thread
    has to respond. So the thread is set up as
    an infinite loop, that 'waits' for a triggering
    event.
    So, SystemC-AMS provides a cleaner design
    that does not force the designer to explicitly
    track the triggering event. In the 'processing'
    method, the actual processing is done.
    Hope that helps.
      
  24. Like
    dakupoto got a reaction from milind.shende5 in Cannot find commonsrcs.h and gendatatrace.h files in systemc-ams package   
    I am very sorry for your troubles. Actually the publisher Springer has a link from their own
    Web site to a FTP site from where the source code tarball might be downloaded, PROVIDED
    you buy from Springer itself. Amazon has not yet included a FTP URL. Currently, Amazon
    and Springer are trying to work out a solution. So please wait, something will be worked out.
    Both commonsrcs.h and gendatatrace.h contain utility code.
    commonsrcs.h provides utility classes to create some signal sources as square wave, triangle
    wave.
    gendatatrace.h provides utility classes to format output data for plotting with Gnuplot.
    Please supply me an email at dakupoto@gmail.com and I can email the two files to you.
  25. Like
    dakupoto got a reaction from karandeep963 in Lose data by sc_fifo   
    Hello Sir,
    It appears that you are trying to analyse some network protocol(or something 
    like that) and it is not working. There are a few issues with your modules, as 
    listed below:
    1. For both your transmitter and receiver, what are the triggering events for
    your threads ? A clock ? A change in data coming over the port ? In short,
    what events are your threads "waiting" on ?
    2. Most importantly, as mentioned with reference to another poster on this
    newsgroup, the reason sc_fifo works with the built-in data types is that at
    the time of elaboration, the space required to store a built-in data type is
    already known - 'x' bytes for int, 'y' bytes for float, etc., Here you have your
    own data type, "Some_struct" and to transfer your own data type between
    the transmitter and receiver,  your need your custom channel and port. To
    achieve this:
    A. You would have to declare a custom interface that is a sub-class of 
    sc_core::sc_interface
    B. You would have to create a class that implements the custom interface -
    the actual channel
    C. Create a custom port to read/write data from/to your custom channel
     
    There is no other option - using syntactic sugar as reinterpret_cast would
    not work. You have run into a core limitation of C++ templates. Hope that
    helps.
×
×
  • Create New...