The Sparta Modeling Framework
|
A simple pipeline. More...
#include <Pipeline.hpp>
Classes | |
class | PipelineIterator |
An iterator class for Pipeline class. More... | |
Public Types | |
enum class | Precedence { NONE , FORWARD , BACKWARD , NUM_OF_PRECEDENCE } |
using | size_type = uint32_t |
using | value_type = DataT |
using | EventHandle = std::unique_ptr< EventT > |
using | EventHandleList = std::list< EventHandle > |
using | EventList = std::list< EventT * > |
using | EventMatrix = std::array< EventList, NUM_SCHEDULING_PHASES > |
using | iterator = PipelineIterator< false > |
using | const_iterator = PipelineIterator< true > |
Public Member Functions | |
iterator | begin () |
const_iterator | begin () const |
const_iterator | cbegin () const |
iterator | end () |
const_iterator | end () const |
const_iterator | cend () const |
Pipeline (EventSet *es, const std::string &name, const uint32_t num_stages, const Clock *clk) | |
Construct a Pipeline object by existed event set. | |
Pipeline (const std::string &name, const uint32_t num_stages, const Clock *clk) | |
Construct a Pipeline object. | |
template<SchedulingPhase sched_phase = SchedulingPhase::Tick> | |
void | registerHandlerAtStage (const uint32_t &id, const SpartaHandler &handler) |
Register event handler for a designated pipeline stage. | |
void | setPrecedenceBetweenStage (const uint32_t &pid, const uint32_t &cid) |
Specify precedence between two different stages within the same pipeline instance. | |
template<class DataT2 , class EventT2 > | |
void | setPrecedenceBetweenPipeline (const uint32_t &pid, Pipeline< DataT2, EventT2 > &c_pipeline, const uint32_t &cid) |
Specify precedence between two stages from different pipeline instances. | |
void | setDefaultStagePrecedence (const Precedence &default_precedence) |
Specify precedence of pipeline stage-handling events as forward/backward stage order. | |
template<typename EventType > | |
void | setProducerForPipelineUpdate (EventType &ev_handler) |
Specify producer event for the pipeline update event. | |
template<typename EventType > | |
void | setConsumerForPipelineUpdate (EventType &ev_handler) |
Specify consumer event for the pipeline update event. | |
template<typename EventType > | |
void | setProducerForStage (const uint32_t &id, EventType &ev_handler) |
Specify producer event for a designated pipeline stage. | |
template<typename EventType > | |
void | setConsumerForStage (const uint32_t &id, EventType &ev_handler) |
Specify consumer event for a designated pipeline stage. | |
EventList & | getEventsAtStage (const uint32_t &id, const SchedulingPhase phase=SchedulingPhase::Tick) |
Get events at a stage for a particular scheduling phase. | |
bool | isEventRegisteredAtStage (const uint32_t &id) const |
Check if any event is registered at a designated pipeline stage. | |
void | activateEventAtStage (const uint32_t &id) |
Activate event for a designated pipeline stage. | |
void | deactivateEventAtStage (const uint32_t &id) |
Deactivate event for a designated pipeline stage. | |
void | append (const DataT &item) |
Append data to the beginning of the pipeline. | |
void | append (DataT &&item) |
Append data to the beginning of the pipeline. | |
bool | isAppended () const |
Is the pipe already appended data? | |
const DataT & | readAppendedData () const |
Get the data just appended; it will assert if no data appended. | |
void | writeStage (const uint32_t &stage_id, const DataT &item) |
Modify a specific stage of the pipeline. | |
void | writeStage (const uint32_t &stage_id, DataT &&item) |
Modify a specific stage of the pipeline. | |
void | invalidateStage (const uint32_t &stage_id) |
Invalidate a specific stage of the pipeline. | |
void | stall (const uint32_t &stall_stage_id, const uint32_t &stall_cycles, const bool crush_bubbles=false, const bool suppress_events=true) |
Stall the pipeline up to designated stage for a specified number of cycles. | |
bool | isStalledOrStalling () const |
Check if the pipeline will be stalled the very next cycle. | |
bool | isStalledOrStallingAtStage (const uint32_t &stage_id) const |
Check if the designated pipeline stage will be stalled the very next cycle. | |
void | flushStage (const uint32_t &flush_stage_id) |
Flush a specific stage of the pipeline using stage id. | |
void | flushStage (const const_iterator &const_iter) |
Flush a specific stage of the pipeline using const iterator. | |
void | flushStage (const iterator &iter) |
Flush a specific stage of the pipeline using non-const iterator. | |
void | flushAllStages () |
Flush all stages of the pipeline. | |
void | flushAppend () |
Flush the data just appended. | |
void | setContinuing (const bool value) |
set whether the update event is continuing or not | |
const DataT & | operator[] (const uint32_t &stage_id) const |
Access (read-only) a specific stage of the pipeline. | |
DataT & | operator[] (const uint32_t &stage_id) |
Access a specific stage of the pipeline. | |
const DataT & | at (const uint32_t &stage_id) const |
Access (read-only) a specific stage of the pipeline. | |
DataT & | at (const uint32_t &stage_id) |
Access a specific stage of the pipeline. | |
bool | isValid (const uint32_t &stage_id) const |
Indicate the validity of a specific pipeline stage. | |
bool | isLastValid () const |
Indicate the validity of the last pipeline stage. | |
bool | isAnyValid () const |
Indicate the validity of the whole pipeline. | |
uint32_t | numValid () const |
Indicate the number of valid pipeline stages. | |
bool | empty () const |
Indicate no valid pipeline stages. | |
uint32_t | size () const |
Indicate the pipeline size. | |
uint32_t | capacity () const |
Indicate the pipeline capacity. | |
void | performOwnUpdates () |
Ask pipeline to perform its own update. | |
void | update () |
Manually update pipeline (i.e. data-movement and event-scheduling) | |
template<SchedulingPhase phase = SchedulingPhase::Collection> | |
void | enableCollection (TreeNode *parent) |
Enable pipeline collection. | |
bool | isCollected () const |
Check if pipeline is collecting. | |
A simple pipeline.
The sparta::Pipeline class is intended to provide an efficient and flexible event scheduling framework for modeling generic pipeline concept.
It contains a sparta::Pipe, and couples event-scheduling (i.e. control-flow path), with the data-movement (i.e. data-flow path) provided by sparta::Pipe.
Template parameter DataT specifies the type of data flowing through pipeline stages, and EventT can be specified by 2 Event types: PhasedUniqueEvent (default) and PhasedPayloadEvent<DataT>. The difference between both types is related to what kind of SpartaHandler modelers are going to register at stages. With default PhasedUniqueEvent, you can register a SpartaHandler with no data; or, with PhasedPayloadEvent<DataT>, you can register a SpartaHandler with data of type DataT. Pipeline will prepare payload and pass data of the stage to every handler.
The sparta::Pipeline is able to provide modelers with the following design capability:
Definition at line 62 of file Pipeline.hpp.
using sparta::Pipeline< DataT, EventT >::const_iterator = PipelineIterator<true> |
Definition at line 219 of file Pipeline.hpp.
using sparta::Pipeline< DataT, EventT >::EventHandle = std::unique_ptr<EventT> |
Definition at line 67 of file Pipeline.hpp.
using sparta::Pipeline< DataT, EventT >::EventHandleList = std::list<EventHandle> |
Definition at line 68 of file Pipeline.hpp.
using sparta::Pipeline< DataT, EventT >::EventList = std::list<EventT*> |
Definition at line 69 of file Pipeline.hpp.
using sparta::Pipeline< DataT, EventT >::EventMatrix = std::array<EventList, NUM_SCHEDULING_PHASES> |
Definition at line 70 of file Pipeline.hpp.
using sparta::Pipeline< DataT, EventT >::iterator = PipelineIterator<false> |
Definition at line 218 of file Pipeline.hpp.
using sparta::Pipeline< DataT, EventT >::size_type = uint32_t |
Definition at line 65 of file Pipeline.hpp.
using sparta::Pipeline< DataT, EventT >::value_type = DataT |
Definition at line 66 of file Pipeline.hpp.
|
strong |
Definition at line 76 of file Pipeline.hpp.
|
inline |
Construct a Pipeline object by existed event set.
es | The pointer to existed event set |
name | The name of Pipeline object |
num_stages | The number of pipeline stages |
clk | The clock this pipeline synchronized to |
Definition at line 237 of file Pipeline.hpp.
|
inline |
Construct a Pipeline object.
name | The name of Pipeline object |
num_stages | The number of pipeline stages |
clk | The clock this pipeline synchronized to |
Definition at line 275 of file Pipeline.hpp.
|
inline |
Activate event for a designated pipeline stage.
id | The stage number |
Definition at line 589 of file Pipeline.hpp.
|
inline |
Append data to the beginning of the pipeline.
item | The data to be appended to the front of pipeline |
Definition at line 622 of file Pipeline.hpp.
|
inline |
Append data to the beginning of the pipeline.
item | The data to be appended to the front of pipeline |
Definition at line 632 of file Pipeline.hpp.
|
inline |
Access a specific stage of the pipeline.
stage_id | The stage number |
Definition at line 829 of file Pipeline.hpp.
|
inline |
Access (read-only) a specific stage of the pipeline.
stage_id | The stage number |
Definition at line 822 of file Pipeline.hpp.
|
inline |
Definition at line 221 of file Pipeline.hpp.
|
inline |
Definition at line 222 of file Pipeline.hpp.
|
inline |
Indicate the pipeline capacity.
Definition at line 854 of file Pipeline.hpp.
|
inline |
Definition at line 223 of file Pipeline.hpp.
|
inline |
Definition at line 227 of file Pipeline.hpp.
|
inline |
Deactivate event for a designated pipeline stage.
id | The stage number |
Definition at line 607 of file Pipeline.hpp.
|
inline |
Indicate no valid pipeline stages.
Definition at line 848 of file Pipeline.hpp.
|
inline |
Enable pipeline collection.
parent | A pointer to the parent treenode for which to add Collectable objects under. |
Definition at line 903 of file Pipeline.hpp.
|
inline |
Definition at line 225 of file Pipeline.hpp.
|
inline |
Definition at line 226 of file Pipeline.hpp.
|
inline |
Flush all stages of the pipeline.
Definition at line 777 of file Pipeline.hpp.
|
inline |
Flush the data just appended.
Definition at line 786 of file Pipeline.hpp.
|
inline |
Flush a specific stage of the pipeline using const iterator.
const_iter | A const iterator pointing to a specific pipeline stage |
Definition at line 761 of file Pipeline.hpp.
|
inline |
Flush a specific stage of the pipeline using non-const iterator.
iter | A non-const iterator pointing to a specific pipeline stage |
Definition at line 770 of file Pipeline.hpp.
|
inline |
Flush a specific stage of the pipeline using stage id.
stage_id | The stage number |
Definition at line 743 of file Pipeline.hpp.
|
inline |
Get events at a stage for a particular scheduling phase.
id | The stage number |
Definition at line 550 of file Pipeline.hpp.
|
inline |
Invalidate a specific stage of the pipeline.
stage_id | The stage number |
Definition at line 681 of file Pipeline.hpp.
|
inline |
Indicate the validity of the whole pipeline.
Definition at line 842 of file Pipeline.hpp.
|
inline |
Is the pipe already appended data?
Definition at line 640 of file Pipeline.hpp.
|
inline |
Check if pipeline is collecting.
Definition at line 908 of file Pipeline.hpp.
|
inline |
Check if any event is registered at a designated pipeline stage.
id | The stage number |
Definition at line 573 of file Pipeline.hpp.
|
inline |
Indicate the validity of the last pipeline stage.
Definition at line 839 of file Pipeline.hpp.
|
inline |
Check if the pipeline will be stalled the very next cycle.
Definition at line 722 of file Pipeline.hpp.
|
inline |
Check if the designated pipeline stage will be stalled the very next cycle.
Definition at line 732 of file Pipeline.hpp.
|
inline |
Indicate the validity of a specific pipeline stage.
stage_id | The stage number |
Definition at line 836 of file Pipeline.hpp.
|
inline |
Indicate the number of valid pipeline stages.
Definition at line 845 of file Pipeline.hpp.
|
inline |
Access a specific stage of the pipeline.
stage_id | The stage number |
Definition at line 815 of file Pipeline.hpp.
|
inline |
Access (read-only) a specific stage of the pipeline.
stage_id | The stage number |
Definition at line 808 of file Pipeline.hpp.
|
inline |
Ask pipeline to perform its own update.
Definition at line 865 of file Pipeline.hpp.
|
inline |
Get the data just appended; it will assert if no data appended.
Definition at line 649 of file Pipeline.hpp.
|
inline |
Register event handler for a designated pipeline stage.
id | The stage number for registration |
handler | The SpartaHandler to be registered for the designated pipeline stage |
Definition at line 293 of file Pipeline.hpp.
|
inline |
Specify consumer event for the pipeline update event.
ev_handler | The consumer event handler |
Definition at line 487 of file Pipeline.hpp.
|
inline |
Specify consumer event for a designated pipeline stage.
id | The stage number |
ev_handler | The consumer event handler |
Definition at line 526 of file Pipeline.hpp.
|
inline |
set whether the update event is continuing or not
value | true for continuing, false for non-continuing |
This will change the continuing property of ev_pipeline_update_. The purpose of this is to determine whether data moving through this pipeline should prevent simulation from ending or not. If this event is continuing, then the Pipeline will keep calling this event as long as there are items in the Pipeline. These events will block the simulator from exiting.
Definition at line 799 of file Pipeline.hpp.
|
inline |
Specify precedence of pipeline stage-handling events as forward/backward stage order.
default_precedence | default precedence (can be either forward or backward) between pipeline stages |
Definition at line 425 of file Pipeline.hpp.
|
inline |
Specify precedence between two stages from different pipeline instances.
pid | The stage number of producer stage-handling event |
c_pipeline | The consumer pipeline |
cid | The stage number of the consumer pipeline stage-handling event |
Definition at line 392 of file Pipeline.hpp.
|
inline |
Specify precedence between two different stages within the same pipeline instance.
pid | The stage number of producer stage-handling event |
cid | The stage number of consumer stage-handling event |
Definition at line 354 of file Pipeline.hpp.
|
inline |
Specify producer event for the pipeline update event.
ev_handler | The producer event handler |
Definition at line 471 of file Pipeline.hpp.
|
inline |
Specify producer event for a designated pipeline stage.
id | The stage number |
ev_handler | The producer event handler |
Definition at line 502 of file Pipeline.hpp.
|
inline |
Indicate the pipeline size.
Definition at line 851 of file Pipeline.hpp.
|
inline |
Stall the pipeline up to designated stage for a specified number of cycles.
stall_stage_id | The stage that causes the pipeline stall |
stall_cycles | The total number of stall cycles |
crush_bubbles | Allow stages before the stall point to move forward into empty slots |
suppress_event | Suppress events of stages before the stall point |
Definition at line 699 of file Pipeline.hpp.
|
inline |
Manually update pipeline (i.e. data-movement and event-scheduling)
Definition at line 886 of file Pipeline.hpp.
|
inline |
Modify a specific stage of the pipeline.
stage_id | The stage number |
item | The modified data for this designated stage |
Definition at line 660 of file Pipeline.hpp.
|
inline |
Modify a specific stage of the pipeline.
stage_id | The stage number |
item | The modified data for this designated stage |
Definition at line 671 of file Pipeline.hpp.
|
friend |
Definition at line 84 of file Pipeline.hpp.