Jump to content

gurunath.kadam

Members
  • Content Count

    7
  • Joined

  • Last visited

  • Days Won

    1

gurunath.kadam last won the day on December 2 2013

gurunath.kadam had the most liked content!

About gurunath.kadam

  • Rank
    Member
  • Birthday May 24

Profile Information

  • Gender
    Male
  • Location
    Darmstadt, Germany
  1. gurunath.kadam

    sc_signal<vector<T> >

    Philipp, Torsten, Alan, Thank you for your prompt replies. Philipp, I followed what you said and it worked. All, Now I have problem with == operator, by looking at sc_signal.h. Exact error: Description Resource Path Location Type ‘std::vector<cdma_data, std::allocator<cdma_data> >’ is an inaccessible base of ‘CDMAVec<cdma_data>’ WNoC_Rev1 line 231, external location: /home/gurunath/Documents/systemc-2.3.0/include/sysc/communication/sc_signal.h C/C++ Problem no match for ‘operator<<’ in ‘os << ((const sc_core::sc_signal<std::vector<unsigned int> >*)this)->sc_core::sc_signal<std::vector<unsigned int> >::m_cur_val’ WNoC_Rev1 line 247, external location: /home/gurunath/Documents/systemc-2.3.0/include/sysc/communication/sc_signal.h C/C++ Problem no match for ‘operator<<’ in ‘std::operator<< <std::char_traits<char> >((* & os), ((const char*)" value = ")) << ((const sc_core::sc_signal<std::vector<unsigned int> >*)this)->sc_core::sc_signal<std::vector<unsigned int> >::m_cur_val’ WNoC_Rev1 line 255, external location: /home/gurunath/Documents/systemc-2.3.0/include/sysc/communication/sc_signal.h C/C++ Problem no match for ‘operator<<’ in ‘std::operator<< <std::char_traits<char> >((* & os), ((const char*)"new value = ")) << ((const sc_core::sc_signal<std::vector<unsigned int> >*)this)->sc_core::sc_signal<std::vector<unsigned int> >::m_new_val’ WNoC_Rev1 line 256, external location: /home/gurunath/Documents/systemc-2.3.0/include/sysc/communication/sc_signal.h C/C++ Problem ‘std::vector<cdma_data, std::allocator<cdma_data> >’ is an inaccessible base of ‘CDMAVec<cdma_data>’ WNoC_Rev1 line 265, external location: /home/gurunath/Documents/systemc-2.3.0/include/sysc/communication/sc_signal.h C/C++ Problem I think I am making a mistake while using sc_in<CDMAVec<cdma_data> > data_in etc. But looking at the code I am little bit lost. Thanks.
  2. gurunath.kadam

    sc_signal<vector<T> >

    Hi Philipp, Thank you for your reply! And thanks for the suggestions!! I am probably little embarrassed by the much needed spoon feeding thought!! I updated the code as suggested, but as of now I am getting another error, which I could not figure out. cdma_data.h: #ifndef CDMA_DATA_H_ #define CDMA_DATA_H_ #include "noc_package.h" struct cdma_data{ int data[MOD_SIZE]; inline bool operator ==(const cdma_data & cd) const { unsigned int check_int; check_int = 1; for (unsigned int i = 0; i < MOD_SIZE; i++){ if(cd.data[i] == data[i]) check_int++; } return (check_int == MOD_SIZE); }; inline friend void sc_trace(sc_trace_file * &tf, const cdma_data & cd, string & name) { for (unsigned int i = 0; i < MOD_SIZE; i++){ std::stringstream str; str << name << ".data_" << i; sc_trace(tf, cd.data[i], str.str()); } }; inline friend ostream & operator <<(ostream & os, const cdma_data & cd) { os << "[ "; for (unsigned int i = 0; i < MOD_SIZE; i++){ os << cd.data[i] << ", "; } os << "]"; return os; }; }; #endif /* CDMA_DATA_H_ */ cdma_vec.h : #ifndef CDMA_VEC_H_ #define CDMA_VEC_H_ #include "cdma_data.h" #include <vector> #include <iostream> template <class X> class CDMAVec : protected vector <X> { typedef std::vector<X> base_type; typedef CDMAVec this_type; public: // make some parts of the interface public using base_type::value_type; using base_type::iterator; using base_type::const_iterator; using base_type::begin; using base_type::end; using base_type::size; using base_type::operator []; using base_type::resize; using base_type::push_back; // no need for (empty) default constructor/destructor inline friend void sc_trace(sc_trace_file * &tf, const CDMAVec<X> & cv, const string & name) { for (size_t i = 0; i < cv.size(); ++i){ std::stringstream str; str << name << "_" << i; sc_trace(tf, cv[i], str.str()); //ERROR } }; inline friend ostream & operator <<(ostream & os, const CDMAVec<X> & cv) { for (size_t i = 0; i < cv.size(); ++i){ os << i << " " << cv[i] << std::endl; } return os; }; }; #endif /* CDMA_VEC_H_ */ error: Description Resource Path Location Type no matching function for call to ‘sc_trace(sc_core::sc_trace_file*&, const cdma_data&, std::basic_stringstream<char>::__string_type)’ cdma_vec.h /WNoC_Rev1/src line 41 C/C++ Problem As far as I know, the 'friend' keyword should have solved this problem, but there after I am not sure. Thanks. Does it have to do something with, CDMAVec<cdma_data> not being derived from sc_signal_in_if/sc_signal_in/sc_signal_inout<T>?! P.S. After the bad code I posted previously, I would like to ask experts to refer me to proper material to go through so as to save myself and others to go through such base level trouble again!!
  3. gurunath.kadam

    sc_signal<vector<T> >

    I am writing the new vector for type of struct. I am getting some errors. I will post both codes and errors here. cdma_data.h /* * cdma_data.h * * Created on: Sep 12, 2012 * Author: gurunath */ #ifndef CDMA_DATA_H_ #define CDMA_DATA_H_ #include "noc_package.h" struct cdma_data{ int data[MOD_SIZE]; inline bool operator ==(const cdma_data & cd) const { unsigned int check_int; check_int = 1; for (unsigned int i = 0; i < MOD_SIZE; i++){ if(cd.data[i] == data[i]) check_int++; } if (check_int == MOD_SIZE) return 1; else return 0; }; }; inline void sc_trace(sc_trace_file * &tf, const cdma_data & cd, string & name) { for (unsigned int i = 0; i < MOD_SIZE; i++){ sc_trace(tf, cd.data[i], name + ".data"); } } inline ostream & operator <<(ostream & os, const cdma_data & cd) { os << "[ "; for (unsigned int i = 0; i < MOD_SIZE; i++){ os << cd.data[i] << ", "; } os << "]"; return os; } #endif /* CDMA_DATA_H_ */ cdma_vec.h /* * cdma_vec.h * * Created on: Oct 30, 2012 * Author: gurunath */ #ifndef CDMA_VEC_H_ #define CDMA_VEC_H_ #include "cdma_data.h" #include <vector> #include <iostream> using namespace std; template <class X> class CDMAVec : public vector <X> { public: CDMAVec(void) : vector <X> () { } inline friend void sc_trace(sc_trace_file * &tf, const CDMAVec & cv<X>, const string & name) { unsigned int j = 0; for (size_t i = 0; i < cv.size(); ++i){ cv[i] -> sc_trace(tf, *cv[i], name + j); j++; } } }; #endif /* CDMA_VEC_H_ */ Errors: ../src/cdma_vec.h:24:69: error: expected ‘,’ or ‘...’ before ‘<’ token ../src/cdma_vec.h: In function ‘void sc_trace(sc_core::sc_trace_file*&, const CDMAVec<X>&)’: ../src/cdma_vec.h:28:34: error: ‘name’ was not declared in this scope There are other errors while using sc_in<CDMAVec> data_in; but as of now i am concentrating on this part. Any suggestions. Thank you.
  4. gurunath.kadam

    Deleting dynamic objects

    hi all, Normally, in C++, all dynamically created objects (pointer = new object) are deleted after their use is done to avoid memory leaks. This operation can be carried out in a destructor or special function as well. I have seen many SystemC (done by some experts) codes where such objects are not deleted. Is that not required in SC? Also now I am attempting to create a vector of pointers to objects. Shall I delete these objects later or does SC take care of this (I think SC can not do that)? Thank you.
  5. gurunath.kadam

    sc_signal<vector<T> >

    Hi all, I am creating some sc_signal<vector<T> > ports with a user defined T. I have already found a proper link for the same (answer provided by AR/Ravi, inheriting from STL vector). http://www.accellera...g=msg00004.html But now my question is, I am defining other ports where T will be sc_bv, double etc. So shall I write above code for each of the variable type or is it ok with all? (I am particularly worried about << and ==). Thank you. P.S. Will next IEEE1666 talk about sc_vector? Will some provision for above scenario provided in later versions?
  6. gurunath.kadam

    sc_fifo size

    Hi guys, I got the mistake i was making. For future reference (check MISTAKE and CORRECTION comments): Mistake: SC_MODULE(fifo_rx){ sc_in<bool> clk; //etc decl. void fifo_rx_write(); void fifo_rx_read(); sc_fifo<sc_lv<FLIT_SIZE> > fifo_rx1; //Declare SC_CTOR(fifo_rx){ //------Initializations-------// fifo_rx_full.initialize(0); dout.initialize(0); data_step = 0; //----------METHODs--------------// SC_METHOD(fifo_rx_write); sensitive << clk.pos(); SC_METHOD(fifo_rx_read); sensitive << clk.pos(); sc_fifo<sc_lv<FLIT_SIZE> > fifo_rx1 (Wi_BUFFER_SIZE * 4); //Define // **MISTAKE** } }; Correct: SC_MODULE(fifo_rx){ //etc. decl. void fifo_rx_write(); void fifo_rx_read(); sc_fifo<sc_lv<FLIT_SIZE> > fifo_rx1; //Declare SC_CTOR(fifo_rx): fifo_rx1 (Wi_BUFFER_SIZE * 4){ // **CORECTION** //------Initializations-------// fifo_rx_full.initialize(0); dout.initialize(0); data_step = 0; //----------METHODs--------------// SC_METHOD(fifo_rx_write); sensitive << clk.pos(); SC_METHOD(fifo_rx_read); sensitive << clk.pos(); } }; WHY: Although I am not expert on C++, this is happening because (int) size_ is a constructor variable, so should be passed while constructor is being implemented. In 1st code it was passed after the constructor ran and therefore SC implemented fifo with default size. (Experts can correct or give more info about it.) Thank you. Gurunath
  7. gurunath.kadam

    sc_fifo size

    Hi all, I am defining the sc_fifo as, sc_fifo<sc_lv<FLIT_SIZE> > fifo_rx1 (BUFFER_SIZE); and BUFFER_SIZE and FLIT_SIZE are defined in another header file as, const unsigned int FLIT_SIZE = 39; const int BUFFER_SIZE = 50; The problem I encounter is, whenever I change the BUFFER_SIZE, I do not get any change in the performance of my system. And I checked that sc_fifo is getting defined at default size of 16 (with num_free() ). As I understand the size_ variable in sc_fifo class is of int type, so I am not sure what is the problem exactly, Help is appreciated. Thank you. Sincerely, Gurunath
×