Ganesan R Posted December 2, 2017 Report Share Posted December 2, 2017 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. Quote Link to comment Share on other sites More sharing options...
Ganesan R Posted December 2, 2017 Author Report Share Posted December 2, 2017 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 Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted December 2, 2017 Report Share Posted December 2, 2017 Hello, SystemC is a C++ library. You should master C++ before learning SystemC, which is just a C++ library. It will be a wisely spent time, since C++ is used in many industries. After you learn C++ you will be able to understand and fix errors in your code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.