Jump to content

Search the Community

Showing results for tags 'sc_fifo;init'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Accellera Systems Initiative
    • Information
    • Announcements
    • In the News
  • SystemC
    • SystemC Language
    • SystemC AMS (Analog/Mixed-Signal)
    • SystemC TLM (Transaction-level Modeling)
    • SystemC Verification (UVM-SystemC, SCV)
    • SystemC CCI Public Review
  • UVM (Universal Verification Methodology)
    • Methodology and BCL Forum
    • UVM SystemVerilog Discussions
    • Simulator Specific Issues
    • 1800.2-2017 Early Adopter Release
    • UVM Commercial Announcements
    • UVM 1.2 Public Review
  • Portable Stimulus
    • Portable Stimulus Discussion
    • IP-XACT Discussion
  • IEEE 1735/IP Encryption
    • IEEE 1735/IP Encryption Discussion
  • OCP (Open Core Protocol)
  • UCIS (Unified Coverage Interoperability Standard)
  • Commercial Announcements
    • Announcements


  • SystemC
  • UVM
  • UCIS
  • IEEE 1735/IP Encryption


  • Community Calendar

Found 1 result

  1. How to initialize sc_fifo

    In running the following program I am getting error: Debug assertion failed, vector subscript out of range. I gather that the problem lies in initializing sc_fifo. As I am newbie to system C, any help in initializing sc_fifo will be deeply appreciated. sc_fifo.h #ifndef SC_FIFO_E_H_ #define SC_FIFO_E_H_ #include <iostream> #include "systemc.h" class sc_fifo_e { sc_fifo_e() { sc_fifo<int>a(10); } public: sc_fifo<int>a; }; #endif sc_fifo_array.h SC_FIFO_ARRAY_H_ #define SC_FIFO_ARRAY_H_ #include <iostream> #include "systemc.h" #include <sc_fifo_e.h> SC_MODULE(sc_fifo_array) { public: SC_HAS_PROCESS(sc_fifo_array); void drain_packets(void); void p_source(void); sc_fifo_array(sc_module_name name_):sc_module(name_) { sc_vector<sc_vector<sc_fifo_e> >q[4][4]; SC_METHOD(drain_packets); SC_THREAD(p_source); } public: sc_vector<sc_vector < sc_fifo_e> > q; int i,j,k; }; void sc_fifo_array::drain_packets(void) { int val; if (q[0][0].a.nb_read(val)) cout<<"packets received\n"; else cout<<"Fifo empty\n"; next_trigger(4,SC_NS); } void sc_fifo_array::p_source(void) { int val=1000; for (; ;) { wait(3, SC_NS); val++; q[0][0].a.write(val); std::cout<<sc_time_stamp()<<"p_thread wrote:"<<val<<std::endl; } } #endif Main program: #include <iostream> #include <systemc> #include <sc_fifo_e.h> #include<sc_fifo_array.h> int sc_main(int argc, char *argv[]) { sc_fifo_array e1("e1"); sc_start(10,SC_NS); cout<<"Hare Ram\n"; return EXIT_SUCCESS; } Thanks.