Jump to content

Ganesan R

Members
  • Content count

    4
  • Joined

  • Last visited

  1. Initialization of nested sc_vector< sc_vector< > >

    Can you suggest any good book on C++ library where I can begin? I want to know how to use modern C++ library and lambda functions.
  2. How to use sc_fifo vector

    Apropos to my earlier post I tried to define sc_fifo as array. But I am still unable to populate individual sc_fifo array member. Advise from senior members like Phillipp A Hartmann is eagerly awaited. Thanks. / scfifo_ex1.cpp : Defines the entry point for the console application. // #include "systemc.h" #include <stdio.h> SC_MODULE(exfifo) { SC_CTOR(exfifo) { //SC_METHOD(fifo_pop); sc_fifo <int> (packet_fifo[1])(5); } /*void fifo_pop(void) { int val; if (ex1.packet_fifo.nb_read(val)) cout << "\n hi \n"; else cout << "\n no \n"; WAIT(2, SC_NS); }*/ sc_fifo<int> packet_fifo[5]; }; int sc_main(int argc, char* argv[]) { cout << "Maha Ganapatim Veera Nangai Gnanananda\n"; exfifo example_fifo("ex1"); sc_start(10, SC_NS); return 0; } Severity Code Description Project File Line Suppression State Error (active) E0144 a value of type "int" cannot be used to initialize an entity of type "sc_core::sc_fifo<int> [1]" scfifo_ex1 c:\Users\acer\Documents\Visual Studio 2017\Projects\scfifo_ex1\scfifo_ex1\scfifo_ex1.cpp 13 Severity Code Description Project File Line Suppression State Error C3074 an array cannot be initialized with a parenthesized initializer scfifo_ex1 c:\users\acer\documents\visual studio 2017\projects\scfifo_ex1\scfifo_ex1\scfifo_ex1.cpp 13 R. Ganesan accelera.rtf
  3. How to use sc_fifo vector

    Dear Sir, I am new to SystemC. Pl. advise how to access ex1[0] etc. in the following program: #include "systemc.h" #include <stdio.h> SC_MODULE(exfifo) { SC_CTOR(exfifo) { SC_METHOD(fifo_pop); sc_fifo<int> packet_fifo(5); } void fifo_pop(void) { int val; if ((ex1[0].packet_fifo).nbread(val)) cout << "\n hi \n"; WAIT(2, SC_NS); }   };     int sc_main(int argc, char* argv[]) { cout << "Maha Ganapatim Veera Nangai Gnanananda\n"; sc_vector<exfifo>("ex1", 4); sc_start(10, SC_NS); return 0; } Throwing ex1 undeclared identifier. Left side of packet_fifo must have class/struct/union Appreciate your help. If things are to be done differently, pl. indicate complete steps as I am a newbie. Thanks.
  4. Dear Sir, I am new to System C. The problem is number of forums offering support to system c problems are few. As such I want help in understanding why this elementary program is not compiling. It returns error C2039: 'con_arrayfifo' : is not a member of 'arrayfifo'. Now the program: #include <systemc.h> SC_MODULE(arrayfifo) { SC_CTOR(arrayfifo) { SC_METHOD(con_arrayfifo); } }; void arrayfifo::con_arrayfifo (void) { //delcare the fifo //sc_fifo<int> rowfifo[n]; } int sc_main(int , char*[] ) { int m,n; cout << "Sadguru Jai Jai \n"; cout << "Enter the value of m: \t"; cin >> m; cout << "Enter the value of n: \t"; cin >> n; cout << m <<"\t" << n <<"\n"; arrayfifo arrayfifo1("arr_fifo"); //con_arrayfifo(m,n); //sc_fifo<int> rowfifo[n]; return 0; } The commented lines are intentional to find out why this program is not compiling. Thanks in advance for your patience and reply back. R. Ganesan
×