PandA-2024.02
|
#include <fsm_controller.hpp>
Public Member Functions | |
fsm_controller (const ParameterConstRef Param, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type hls_flow_step_type=HLSFlowStep_Type::FSM_CONTROLLER_CREATOR) | |
Constructor. More... | |
~fsm_controller () override | |
Destructor. More... | |
Public Member Functions inherited from ControllerCreatorBaseStep | |
ControllerCreatorBaseStep (const ParameterConstRef Param, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type hls_flow_step_type) | |
Constructor. More... | |
~ControllerCreatorBaseStep () override | |
Destructor. More... | |
Public Member Functions inherited from HLSFunctionStep | |
HLSFunctionStep (const ParameterConstRef Param, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization=HLSFlowStepSpecializationConstRef()) | |
Constructor. More... | |
~HLSFunctionStep () override | |
Destructor. More... | |
bool | HasToBeExecuted () const override |
Check if this step has actually to be executed. More... | |
void | Initialize () override |
Initialize the step (i.e., like a constructor, but executed just before exec. More... | |
std::string | GetSignature () const final |
Return a unified identifier of this design step. More... | |
std::string | GetName () const final |
Return the name of this design step. More... | |
DesignFlowStep_Status | Exec () final |
Execute the step. More... | |
Public Member Functions inherited from HLS_step | |
HLS_step (const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization=HLSFlowStepSpecializationConstRef()) | |
Constructor. More... | |
~HLS_step () override | |
Destructor. More... | |
std::string | GetSignature () const override |
Return a unified identifier of this design step. More... | |
std::string | GetName () const override |
Return the name of this design step. More... | |
virtual std::string | GetKindText () const |
Return the name of the type of this frontend flow step. More... | |
DesignFlowStepFactoryConstRef | CGetDesignFlowStepFactory () const final |
Return the factory to create this type of steps. More... | |
void | ComputeRelationships (DesignFlowStepSet &design_flow_step_set, const DesignFlowStep::RelationshipType relationship_type) override |
Compute the relationships of a step with other steps. More... | |
Public Member Functions inherited from DesignFlowStep | |
DesignFlowStep (const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters) | |
Constructor. More... | |
virtual | ~DesignFlowStep () |
Destructor. More... | |
DesignFlowStep_Status | GetStatus () const |
Return the status of this design step. More... | |
virtual void | WriteDot (std::ostream &out) const |
Write the label for a dot graph. More... | |
bool | IsComposed () const |
Returns if this step is composed. More... | |
int | CGetDebugLevel () const |
Return the debug level of the step. More... | |
virtual void | PrintInitialIR () const |
Dump the initial intermediate representation. More... | |
virtual void | PrintFinalIR () const |
Dump the final intermediate representation. More... | |
Protected Member Functions | |
virtual void | add_correct_transition_memory (const std::string &state_representation, structural_managerRef SM) |
Set the correct NP functionality. More... | |
Protected Member Functions inherited from ControllerCreatorBaseStep | |
const CustomUnorderedSet< std::tuple< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef, HLSFlowStep_Relationship > > | ComputeHLSRelationships (const DesignFlowStep::RelationshipType relationship_type) const override |
Return the set of analyses in relationship with this design step. More... | |
void | Initialize () override |
Initialize the step (i.e., like a constructor, but executed just before exec. More... | |
virtual void | add_common_ports (structural_objectRef circuit, structural_managerRef SM) |
This member function adds the standard ports (clock, reset, done and command ones) to a circuit. More... | |
Protected Member Functions inherited from HLSFunctionStep | |
void | ComputeRelationships (DesignFlowStepSet &design_flow_step_set, const DesignFlowStep::RelationshipType relationship_type) override |
Compute the relationships of a step with other steps. More... | |
Private Member Functions | |
void | create_state_machine (std::string &parse) |
Generates the string representation of the FSM. More... | |
std::string | get_guard_value (const tree_managerRef TM, const unsigned int index, vertex op, const OpGraphConstRef data) |
Returns the value of the guard value of a case_label_expr default is not managed. More... | |
DesignFlowStep_Status | InternalExec () override |
Execute the step. More... | |
Additional Inherited Members | |
Public Types inherited from DesignFlowStep | |
enum | RelationshipType { DEPENDENCE_RELATIONSHIP, INVALIDATION_RELATIONSHIP, PRECEDENCE_RELATIONSHIP } |
The relationship type. More... | |
Static Public Member Functions inherited from HLSFunctionStep | |
static std::string | ComputeSignature (const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization, const unsigned int function_id) |
Compute the signature of a hls flow step. More... | |
Static Public Member Functions inherited from HLS_step | |
static std::string | EnumToName (const HLSFlowStep_Type hls_flow_step_type) |
Given a HLS flow step type, return the name of the type. More... | |
static const std::string | ComputeSignature (const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization) |
Compute the signature of a hls flow step. More... | |
Protected Attributes inherited from ControllerCreatorBaseStep | |
std::map< generic_objRef, unsigned int > | out_ports |
This contains all the ports that go from the controller to the datapath, used to enable the registers and to control muxes in the datapath. More... | |
std::map< vertex, unsigned int > | cond_ports |
This is the same as in_ports except that the first element is of type vertex. More... | |
std::map< vertex, unsigned int > | mu_ports |
This map put into relation fsm states and alldone multi_unbounded ports. More... | |
unsigned int | out_num |
Initialized after add_common_ports is called. It represents the current number of output ports. More... | |
unsigned int | in_num |
Initialized after add_common_ports is called. It represents the current number of input ports. More... | |
Protected Attributes inherited from HLSFunctionStep | |
std::map< unsigned int, unsigned int > | last_bb_ver |
last bb version of the called functions More... | |
std::map< unsigned int, unsigned int > | last_bitvalue_ver |
The version of bit value IR representation on which this step was applied. More... | |
const unsigned int | funId |
identifier of the function to be processed (0 means that it is a global step) More... | |
hlsRef | HLS |
HLS data structure of the function to be analyzed. More... | |
unsigned int | bb_version |
The version of bb intermediate representation on which this step was applied. More... | |
unsigned int | bitvalue_version |
The version of bitvalue on which this step was applied. More... | |
unsigned int | memory_version |
The version of memory representation on which this step was applied. More... | |
Protected Attributes inherited from HLS_step | |
const HLS_managerRef | HLSMgr |
information about all the HLS synthesis More... | |
const HLSFlowStep_Type | hls_flow_step_type |
The type of this step. More... | |
const HLSFlowStepSpecializationConstRef | hls_flow_step_specialization |
The information about specialization. More... | |
Protected Attributes inherited from DesignFlowStep | |
bool | composed |
True if this step represents a composition of design flow steps (e.g., a flow); must be set by specialized constructors. More... | |
const Wrefcount< const DesignFlowManager > | design_flow_manager |
The design flow manager. More... | |
const ParameterConstRef | parameters |
Set of input parameters. More... | |
int | debug_level |
The debug level. More... | |
const int | output_level |
The output level. More... | |
Static Protected Attributes inherited from HLS_step | |
static CustomUnorderedMap< std::string, HLSFlowStep_Type > | command_line_name_to_enum |
Map hls step name to enum. More... | |
Definition at line 52 of file fsm_controller.hpp.
fsm_controller::fsm_controller | ( | const ParameterConstRef | Param, |
const HLS_managerRef | HLSMgr, | ||
unsigned int | funId, | ||
const DesignFlowManagerConstRef | design_flow_manager, | ||
const HLSFlowStep_Type | hls_flow_step_type = HLSFlowStep_Type::FSM_CONTROLLER_CREATOR |
||
) |
Constructor.
design_flow_manager | is the design flow manager |
Definition at line 84 of file fsm_controller.cpp.
References DesignFlowStep::debug_level, DEBUG_LEVEL_NONE, GET_CLASS, DesignFlowStep::parameters, and ~fsm_controller().
|
overridedefault |
|
protectedvirtual |
Set the correct NP functionality.
state_representation | is the state representation of the FSM |
Reimplemented in controller_cs.
Definition at line 856 of file fsm_controller.cpp.
References structural_manager::add_NP_functionality(), NP_functionality::FSM, and structural_manager::get_circ().
Referenced by InternalExec().
|
private |
Generates the string representation of the FSM.
Getting first state (initial one). It will be also first state for resetting
adding reset state to machine encoding
analysis for each state to compute the default output
ensure that first_state is the really first one...
do some checks
write bypass assignments
Definition at line 154 of file fsm_controller.cpp.
References ALL_FINISHED, hls::allocation_information, conn_binding::bind_selector_port(), CASE_COND, FunctionBehavior::CFG, StateTransitionGraphManager::CGetAstg(), StateTransitionGraphManager::CGetStg(), CLOCK_PORT_NAME, generic_obj::COMMAND_PORT, ControllerCreatorBaseStep::cond_ports, container_to_string(), DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, default_COND, DONE_PORT_NAME, DONTCARE_COND, FALSE_COND, HLSFunctionStep::funId, reg_binding::get(), fu_binding::get(), fu_binding::get_assign(), StateTransitionGraphManager::get_entry_state(), StateTransitionGraphManager::get_exit_state(), AllocationInformation::get_fu(), get_guard_value(), GET_INDEX_CONST_NODE, liveness::get_live_in(), GET_NAME, reg_binding::get_register(), StorageValueInformation::get_storage_value_index(), reg_binding::get_used_regs(), conn_binding::GetSelectors(), HLSFunctionStep::HLS, HLS_step::HLSMgr, ControllerCreatorBaseStep::in_num, INDENT_DBG_MEX, input_vector_to_string(), insert(), StorageValueInformation::is_a_storage_value(), k, ControllerCreatorBaseStep::mu_ports, tree_helper::NormalizeTypename(), NOT_ALL_FINISHED, NULL_VERTEX, ControllerCreatorBaseStep::out_num, ControllerCreatorBaseStep::out_ports, DesignFlowStep::parameters, port_o_K, hls::Rconn, hls::registered_done_port, RESET_PORT_NAME, hls::Rfu, hls::Rliv, hls::Rreg, START_PORT_NAME, hls::STG, hls::storage_value_information, STR, lenet_tvm::target, THROW_ASSERT, THROW_ERROR, top(), TRUE_COND, and symmetry::value.
Referenced by InternalExec().
|
private |
Returns the value of the guard value of a case_label_expr default is not managed.
Definition at line 808 of file fsm_controller.cpp.
References OpGraph::CGetOpNodeInfo(), tree_node::get_kind(), tree_helper::get_multi_way_if_pos(), GET_NAME, GET_NODE, tree_manager::get_tree_node_const(), GET_TYPE, tree_helper::GetConstValue(), STR, THROW_ASSERT, and TYPE_MULTIIF.
Referenced by create_state_machine().
|
overrideprivatevirtual |
Execute the step.
top circuit creation
main circuit type
Set some descriptions and legal stuff
Implements HLSFunctionStep.
Definition at line 94 of file fsm_controller.cpp.
References ControllerCreatorBaseStep::add_common_ports(), add_correct_transition_memory(), FunctionBehavior::CGetBehavioralHelper(), ControllerCreatorBaseStep::cond_ports, hls::controller, create_state_machine(), DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERBOSE, HLSFunctionStep::funId, GENERATED_COPYRIGHT, GENERATED_LICENSE, structural_manager::get_circ(), BehavioralHelper::get_function_name(), HLSFunctionStep::HLS, HLS_step::HLSMgr, ControllerCreatorBaseStep::mu_ports, ControllerCreatorBaseStep::out_ports, PRINT_DBG_MEX, structural_object::set_black_box(), structural_manager::set_top_info(), hls::STG, SUCCESS, and THROW_ASSERT.