/// Testbench for the GreenControl analysis (GreenAV) example int sc_main(int argc, char *argv[]) { // GreenControl Core instance gs::ctr::GC_Core core; // GreenConfig Plugin gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin(&cnfdatabase); // GreenAV Plugin gs::av::GAV_Plugin analysisPlugin("AnalysisPlugin"); // Leave out the plugin completely to show that the simulation does not crash (but does not analyze of course) AVnewStatCalc tool("AVnewStatCalc"); AVnewStatCalcFormulaTest formulaTest("AVnewStatCalcFormulaTest"); // Add user defined calculation functions to Calculator class // This function will be usable by any Calculator<int> and Calculator_bit<int> gs::av::Calculator<int>::addFunc(&average,"average"); // This function will be usable by any Calculator<double> and Calculator_bit<double> gs::av::Calculator<double>::addFunc(&Surrounding_Class::divide_by_three,"div3"); std::cout << "-------------------- SIMULATION START -----------------------" << std::endl; sc_core::sc_start(); std::cout << "-------------------- SIMULATION ENDED -----------------------" << std::endl; //ShowSCObjects::showSCObjects(); return EXIT_SUCCESS; }
/// main int sc_main(int argc, char* argv[]) { /// GreenControl Core instance gs::ctr::GC_Core core("ControlCore"); // GreenConfig Plugin gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin("ConfigPlugin", &cnfdatabase); SlaveMem s1("Slave1",3); s1.setAddress(0x4000,0x400F); //Slave s2("Slave2",3); // zweiter Parameter: ACK-Delay in Taktzyklen //s2.setAddress(0x5000,0x500F); Master m1("M1"); m1.init_port.target_addr = 0x4000; m1.init_port(s1.target_port); sc_core::sc_start(); std::cout << std::endl << "Simulation stopped"<<std::endl; return 0; }
int sc_main(int argc, char** argv) { //sc_core::sc_report_handler::set_actions(sc_core::SC_ERROR, sc_core::SC_ABORT); // make a breakpoint in SystemC file sc_stop_here.cpp //sc_core::sc_report_handler::set_actions(sc_core::SC_WARNING, sc_core::SC_ABORT); // make a breakpoint in SystemC file sc_stop_here.cpp // Configure warnings about accesses to write protected register bits: sc_core::sc_report_handler::set_actions("/GreenSocs/GreenReg/write_protected/unequal_current", sc_core::SC_DISPLAY); sc_core::sc_report_handler::set_actions("/GreenSocs/GreenReg/write_protected/unequal_zero", sc_core::SC_DO_NOTHING); sc_core::sc_report_handler::set_actions("/GreenSocs/GreenReg/write_protected/bit_range_access", sc_core::SC_DISPLAY); sc_core::sc_report_handler::set_actions("/GreenSocs/GreenReg/write_protected/bit_access", sc_core::SC_DISPLAY); int opt = 0; if (argc!=2) {helpMsg;} else { opt = atoi(argv[1]); std::cout << "You gave " << opt << "\n"; if ((opt!=1) && (opt!=2) && (opt!=3) && (opt!=4)) helpMsg; } /// GreenControl and GreenConfig gs::ctr::GC_Core core("ControlCore"); gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin(&cnfdatabase); newMod nmod("newMod", opt); std::cout << "\nEntering sc_start : simulation starting\n"; sc_core::sc_start(); // (1000, SC_NS); // Start the simulation std::cout << "Exited sc_start : simulation finished\n\n"; return( 0); }
/// Testbench for the example GreenConfig int sc_main(int argc, char *argv[]) { /// GreenControl Core instance gs::ctr::GC_Core core; // GreenConfig Plugin gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin(&cnfdatabase); // Configuration with GreenConfig config files gs::cnf::ConfigFile_Tool configTool("ConfigFileTool"); configTool.parseCommandLine(argc, argv); // parses the command line for --configfile configTool.config("array_test1.cfg"); // reads in a config file ArrayOwnerModule owner ("Owner"); ArrayUserModule user ("User"); //ShowSCObjects::showSCObjects(); sc_core::sc_report_handler::set_actions(sc_core::SC_ERROR, sc_core::SC_ABORT); std::cout << "------ Simulation start ---------" << std::endl; sc_core::sc_start(); std::cout << "------ Simulation stopped ---------" << std::endl; return EXIT_SUCCESS; }
/// main int sc_main(int argc, char* argv[]) { //sc_report_handler::set_actions(SC_ERROR, SC_ABORT); /// GreenControl Core instance gs::ctr::GC_Core core; // GreenConfig Plugin gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin(&cnfdatabase); SlaveMemBidir s1("Slave1",3); s1.setAddress(0x4000,0x400F); BidirModule m1("M1"); m1.bidir_port.target_addr = 0x4000; // connect initiators and targets m1.bidir_port(s1.target_port); //ShowSCObjects::showSCObjects(); sc_core::sc_start(); std::cout << std::endl << "Simulation stopped"<<std::endl; return 0; }
/// main int sc_main(int, char**) { // sc_report_handler::set_actions(SC_ERROR, SC_ABORT); #ifdef USE_GPSOCKET /// GreenControl Core instance gs::ctr::GC_Core core("ControlCore"); // GreenConfig Plugin gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin("ConfigPlugin", &cnfdatabase); #endif sillysort m("sillysort"); simplememory s("simplememory"); m.init_port(s.target_port); sc_core::sc_start(-1); return 0; }
/// main int sc_main(int, char**) { // sc_report_handler::set_actions(SC_ERROR, SC_ABORT); #ifdef USE_GPSOCKET /// GreenControl Core instance gs::ctr::GC_Core core(); // GreenConfig Plugin gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin(&cnfdatabase); #endif gs::gp::SimpleBusProtocol<32> p("Protocol", 10); gs::gp::fixedPriorityScheduler s("Scheduler"); gs::gp::GenericRouter<32> r("Router"); r.protocol_port(p); p.router_port(r); p.scheduler_port(s); sillysort m("sillysort"); simplememory s1("simplememory1"); s1.target_port.base_addr = 0x0; s1.target_port.high_addr = 0x10; simplememory s2("simplememory2"); s2.target_port.base_addr = 0x11; s2.target_port.high_addr = 0xFFFF; m.init_port(r.target_socket); r.init_socket(s1.target_port); r.init_socket(s2.target_port); // m.init_port(s.target_port); sc_core::sc_start(); return 0; }
/// main int sc_main(int argc, char* argv[]) { /// GreenControl Core instance gs::ctr::GC_Core core("ControlCore"); // GreenConfig Plugin gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin("ConfigPlugin", &cnfdatabase); SlaveMem s1("Slave1",3); s1.setAddress(0x4000,0x4FFF); Master m1("M1"); m1.init_port.target_addr = 0x4000; /* // Use generic router gs::gp::SimpleBusProtocol<32> p("Protocol", sc_core::sc_time(10, sc_core::SC_NS)); gs::gp::fixedPriorityScheduler s("Scheduler"); gs::gp::GenericRouter<32> r("Router"); r.protocol_port(p); p.router_port(r); p.scheduler_port(s); // connect initiators and targets to the generic router /////////////////// m1.init_port(r.target_socket); r.init_socket(s1.target_port); */ // direct connect without router m1.init_port(s1.target_port); sc_core::sc_start(); std::cout << std::endl << "Simulation stopped"<<std::endl; return 0; }
/// main int sc_main(int argc, char* argv[]) { /// GreenControl Core instance gs::ctr::GC_Core core("ControlCore"); // GreenConfig Plugin gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin("ConfigPlugin", &cnfdatabase); TestSlave sl("Slave",3); sl.setAddress(0x4000,0x400F); TestMaster ma("Master"); ma.init_port.target_addr = 0x4000; ma.init_port(sl.target_port); sc_core::sc_start(); std::cout << std::endl << "Simulation stopped"<<std::endl; return 0; }
int sc_main(int argc, char** argv){ /// GreenControl Core instance gs::ctr::GC_Core core; // GreenConfig Plugin gs::cnf::ConfigDatabase* cnfdatabase = new gs::cnf::ConfigDatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin(cnfdatabase); gs::av::GAV_Plugin analysisPlugin(gs::av::STDOUT_OUT); // Master and Slave b_master_qk m("M"); ExplicitLTTarget s("S"); m.socket(s.socket); // Register the command and address that is processed in the target gs::av::GAV_Api::getApiInstance()->add_to_default_output( gs::av::TXT_TD_FILE_OUT, s.current_command ); gs::av::GAV_Api::getApiInstance()->add_to_default_output( gs::av::TXT_TD_FILE_OUT, s.current_addr ); // Register the end of a transaction (as seen by the master) gs::av::GAV_Api::getApiInstance()->add_to_default_output( gs::av::TXT_TD_FILE_OUT, m.done_transaction ); sc_core::sc_start(); return 0; }
int sc_main(int argc, char** argv){ bool provoke_bind_error=false; if (argc>1){ if (std::string(argv[1])=="provoke_bind_error") provoke_bind_error=true; } #ifdef USE_GS_MONITOR /// GreenControl Core instance gs::ctr::GC_Core core("ControlCore"); // GreenConfig Plugin gs::cnf::ConfigDatabase cnfdatabase("ConfigDatabase"); gs::cnf::ConfigPlugin configPlugin(&cnfdatabase); gs::av::GAV_Plugin analysisPlugin("AnalysisPlugin", gs::av::STDOUT_OUT); #endif simple_b_gs_secure_adapter* a; if (!provoke_bind_error) a=new simple_b_gs_secure_adapter("A"); simple_b_gs_master m("M"); simple_b_gs_slave s0("S0",true, false); simple_b_gs_slave_hier s1("S1", false, true); ExplicitLTTarget s2("S2"); simple_b_gs_secure_slave s3("S3"); #ifdef USE_GS_MONITOR gs::socket::monitor<>* mon1=0, *mon2=0, *mon3=0, *mon4=0, *mon5=0; mon1=gs::socket::connect_with_monitor<32, tlm::tlm_base_protocol_types>(m.socket0, s0.socket); mon2=gs::socket::connect_with_monitor<32, tlm::tlm_base_protocol_types>(m.socket1, s1.socket); mon3=gs::socket::connect_with_monitor<32, tlm::tlm_base_protocol_types>(m.socket2, s2.socket); #else m.socket0(s0.socket); m.socket1(s1.socket); m.socket2(s2.socket); #endif if (provoke_bind_error) m.socket3(s3.socket); else{ #ifdef USE_GS_MONITOR mon4=gs::socket::connect_with_monitor<32, tlm::tlm_base_protocol_types>(m.socket3, a->t_socket); mon5=gs::socket::connect_with_monitor<32, tlm::tlm_base_protocol_types>(a->i_socket, s3.socket); #else m.socket3(a->t_socket); a->i_socket(s3.socket); #endif } #ifdef USE_GS_MONITOR #define TEXT_OUT(mon) \ if (mon) \ gs::av::GAV_Api::getApiInstance(NULL)->add_to_default_output(\ gs::av::TXT_FILE_OUT, \ gs::cnf::GCnf_Api::getApiInstance(NULL)->getPar(mon->get_param().getName())) TEXT_OUT(mon1); TEXT_OUT(mon2); TEXT_OUT(mon3); TEXT_OUT(mon4); TEXT_OUT(mon5); #undef TEXT(OUT) #endif sc_core::sc_start(); #ifdef USE_GS_MONITOR delete mon1; delete mon2; delete mon3; delete mon4; delete mon5; #endif return 0; }