The Sparta Modeling Framework
Loading...
Searching...
No Matches
SysCSpartaSchedulerAdapter.hpp File Reference

Glue code that connect the Sparta scheduler to SystemC. More...

#include <climits>
#include "sparta/kernel/Scheduler.hpp"
#include "sparta/events/Event.hpp"
#include "sysc/kernel/sc_event.h"
#include "sysc/kernel/sc_time.h"
#include "sysc/kernel/sc_module.h"
#include "sysc/communication/sc_clock.h"

Go to the source code of this file.

Classes

class  sparta::SysCSpartaSchedulerAdapter
 Class that "connects" Sparta to SystemC. More...
 

Namespaces

namespace  sparta
 Macros for handling exponential backoff.
 

Macros

#define SC_SPARTA_SCHEDULER_NAME   "SysCSpartaSchedulerAdapter"
 
#define SC_SPARTA_STOP_EVENT_NAME   "sc_ev_stop_simulation"
 

Functions

Clock::Cycle sparta::sparta_sysc_utils::calculateSpartaOffset (const sparta::Clock *sparta_clk, sc_core::sc_time::value_type sysc_offset)
 

Detailed Description

Glue code that connect the Sparta scheduler to SystemC.

Definition in file SysCSpartaSchedulerAdapter.hpp.

Macro Definition Documentation

◆ SC_SPARTA_SCHEDULER_NAME

#define SC_SPARTA_SCHEDULER_NAME   "SysCSpartaSchedulerAdapter"

The name of the scheduler adapter

Definition at line 96 of file SysCSpartaSchedulerAdapter.hpp.

◆ SC_SPARTA_STOP_EVENT_NAME

#define SC_SPARTA_STOP_EVENT_NAME   "sc_ev_stop_simulation"

The name of the SystemC event used to stop simulation

Definition at line 100 of file SysCSpartaSchedulerAdapter.hpp.

Function Documentation

◆ calculateSpartaOffset()

Clock::Cycle sparta::sparta_sysc_utils::calculateSpartaOffset ( const sparta::Clock sparta_clk,
sc_core::sc_time::value_type  sysc_offset 
)
inline

Utility to convert SystemC time to Sparta time for scheduling events/sending data across ports

Parameters
sparta_clkThe Clock to use for the conversion
sysc_offsetThe SystemC offset to convert
Returns
The sparta::Clock::Cycle that be used to schedule an event/send data

Since the Sparta scheduler is not re-entrant at the current tick, we might need to stop forward progress and report an issue (currently not doing this). Reason for this:

  1. Scheduling advancement is toggled between SysC and Sparta. SysC advances first, the Sparta. The expectation is that all events on the Sparta scheduler have been scheduled from the SysC side and that nothing new (0-cycle) will appear
  2. When the Sparta scheduler is finished with its current time quantum (return from the call to Scheduler::run), it will assume time is not advanced by 1 tick. In other words, time for scheduling anything this tick is now oever. Scheduling something 0-cycle (or 0-tick) is meaningless.

Definition at line 56 of file SysCSpartaSchedulerAdapter.hpp.

Here is the call graph for this function: