The Sparta Modeling Framework
Loading...
Searching...
No Matches
sc_main.cpp
1
2
5#include "SpartaSystemCSimulator.hpp"
6
7#define REPORT_DEFINE_GLOBALS // so sad...
8#include "reporting.h"
9
10int sc_main(int argc, char *argv[])
11{
12 // Part of the SystemC initiator
13 REPORT_ENABLE_ALL_REPORTING ();
14
16 sparta::app::CommandLineSimulator cls("", DEFAULTS);
17 int err_code = 0;
18 if(!cls.parse(argc, argv, err_code)){
19 sparta_assert(false, "Command line parsing failed"); // Any errors already printed to cerr
20 }
21 sparta_assert(err_code == 0);
22
23 // Enable/create the sparta simulator
26
27 cls.populateSimulation(&sim);
28 cls.runSimulator(&sim);
29 // sim.run(10000); // run up to 10K ns. Can use sparta::Scheduler::INDEFINITE
30
31 return 0;
32}
Class for creating a simulator based on command-line arguments.
A simple time-based, event precedence based scheduler.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
A class that lets you schedule events now and in the future.
Command line simulator front-end class with argument parsing Works in conjunction with sparta::app::S...
Optional default values for the simulator which can be customized and provided by anyone instantiatin...
Top level constructor for the SystemC example TLM simulator.