Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/11/2013 in all areas

  1. Adding an option for you. You might want to use it like as follows: class hci_test { public: unsigned char* host_hci_pkt_arr = new unsigned char [2]; hci_test(){ host_hci_pkt_arr[0] = 0x01; host_hci_pkt_arr[1] = 0x02; } ~hci_test(){ delete [] host_hci_pkt_arr ; } }; Enable c++11 option in your compiler if you want to have it! Regards, Sumit
    2 points
  2. 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 "
    2 points
  3. apfitch

    array inside class

    That's just C++ - you need to allocate the memory in the constructor, and de-allocate it in the destructor, regards Alan P.S. Another way I find is useful to help remember things like this is that sequential code in C/C++ really belongs in a function. So writing this: host_hci_pkt_arr = new(nothrow) unsigned char [2]; host_hci_pkt_arr[0] = 0x01; host_hci_pkt_arr[1] = 0x02; in a class doesn't make sense, it belongs in a function (in this particular case the class constructor).
    1 point
  4. For the macros, which are part of the official IEEE Std 1666-2011, the index of this freely available LRM is your friend: Look for all upper-case identifiers starting with either SC_ or TLM_. If they are a macro and not a constant, it is indicated in the index. If you need all macros defined by an implementation of SystemC and TLM, probably a "grep #define" on the sources is your best option.
    1 point
  5. Assertions in SystemC are not so powerful as they are in SystemVerilog. The assert condition is tested instantaneously and does not allow to express any time constraints. Still, they are very useful to test invariants inside your design. If you use the sc_assert macro of SystemC, you will get the context reported from which the assertion was triggered. Please note that this will terminate the simulation as it is considered to be of fatal severity. Use the SC_REPORT_* macros to generate messages with other severity levels. SCV mainly adds support for randomization and transaction tracing to
    1 point
×
×
  • Create New...