add more methods to link routing to circuit models in device annotation

This commit is contained in:
tangxifan 2020-02-12 10:08:54 -07:00
parent a31d6c6d1e
commit feccbc5780
2 changed files with 53 additions and 0 deletions

View File

@ -215,6 +215,24 @@ t_pb_graph_pin* VprDeviceAnnotation::physical_pb_graph_pin(t_pb_graph_pin* pb_gr
return physical_pb_graph_pins_.at(pb_graph_pin); return physical_pb_graph_pins_.at(pb_graph_pin);
} }
CircuitModelId VprDeviceAnnotation::rr_switch_circuit_model(const RRSwitchId& rr_switch) const {
/* Ensure that the rr_switch is in the list */
std::map<RRSwitchId, CircuitModelId>::const_iterator it = rr_switch_circuit_models_.find(rr_switch);
if (it == rr_switch_circuit_models_.end()) {
return CircuitModelId::INVALID();
}
return rr_switch_circuit_models_.at(rr_switch);
}
CircuitModelId VprDeviceAnnotation::rr_segment_circuit_model(const RRSegmentId& rr_segment) const {
/* Ensure that the rr_switch is in the list */
std::map<RRSegmentId, CircuitModelId>::const_iterator it = rr_segment_circuit_models_.find(rr_segment);
if (it == rr_segment_circuit_models_.end()) {
return CircuitModelId::INVALID();
}
return rr_segment_circuit_models_.at(rr_segment);
}
/************************************************************************ /************************************************************************
* Public mutators * Public mutators
***********************************************************************/ ***********************************************************************/
@ -412,4 +430,26 @@ void VprDeviceAnnotation::add_physical_pb_graph_pin(t_pb_graph_pin* operating_pb
} }
} }
void VprDeviceAnnotation::add_rr_switch_circuit_model(const RRSwitchId& rr_switch, const CircuitModelId& circuit_model) {
/* Warn any override attempt */
std::map<RRSwitchId, CircuitModelId>::const_iterator it = rr_switch_circuit_models_.find(rr_switch);
if (it != rr_switch_circuit_models_.end()) {
VTR_LOG_WARN("Override the annotation between rr_switch '%ld' and its circuit_model '%ld'!\n",
size_t(rr_switch), size_t(circuit_model));
}
rr_switch_circuit_models_[rr_switch] = circuit_model;
}
void VprDeviceAnnotation::add_rr_segment_circuit_model(const RRSegmentId& rr_segment, const CircuitModelId& circuit_model) {
/* Warn any override attempt */
std::map<RRSegmentId, CircuitModelId>::const_iterator it = rr_segment_circuit_models_.find(rr_segment);
if (it != rr_segment_circuit_models_.end()) {
VTR_LOG_WARN("Override the annotation between rr_segment '%ld' and its circuit_model '%ld'!\n",
size_t(rr_segment), size_t(circuit_model));
}
rr_segment_circuit_models_[rr_segment] = circuit_model;
}
} /* End namespace openfpga*/ } /* End namespace openfpga*/

View File

@ -12,6 +12,9 @@
/* Header from archfpga library */ /* Header from archfpga library */
#include "physical_types.h" #include "physical_types.h"
/* Header from vpr library */
#include "rr_graph_obj.h"
/* Header from openfpgautil library */ /* Header from openfpgautil library */
#include "openfpga_port.h" #include "openfpga_port.h"
#include "circuit_library.h" #include "circuit_library.h"
@ -66,6 +69,8 @@ class VprDeviceAnnotation {
*/ */
int physical_pb_pin_offset(t_port* pb_port) const; int physical_pb_pin_offset(t_port* pb_port) const;
t_pb_graph_pin* physical_pb_graph_pin(t_pb_graph_pin* pb_graph_pin) const; t_pb_graph_pin* physical_pb_graph_pin(t_pb_graph_pin* pb_graph_pin) const;
CircuitModelId rr_switch_circuit_model(const RRSwitchId& rr_switch) const;
CircuitModelId rr_segment_circuit_model(const RRSegmentId& rr_segment) const;
public: /* Public mutators */ public: /* Public mutators */
void add_pb_type_physical_mode(t_pb_type* pb_type, t_mode* physical_mode); void add_pb_type_physical_mode(t_pb_type* pb_type, t_mode* physical_mode);
void add_physical_pb_type(t_pb_type* operating_pb_type, t_pb_type* physical_pb_type); void add_physical_pb_type(t_pb_type* operating_pb_type, t_pb_type* physical_pb_type);
@ -83,6 +88,8 @@ class VprDeviceAnnotation {
void add_physical_pb_type_index_offset(t_pb_type* pb_type, const int& offset); void add_physical_pb_type_index_offset(t_pb_type* pb_type, const int& offset);
void add_physical_pb_pin_rotate_offset(t_port* pb_port, const int& offset); void add_physical_pb_pin_rotate_offset(t_port* pb_port, const int& offset);
void add_physical_pb_graph_pin(t_pb_graph_pin* operating_pb_graph_pin, t_pb_graph_pin* physical_pb_graph_pin); void add_physical_pb_graph_pin(t_pb_graph_pin* operating_pb_graph_pin, t_pb_graph_pin* physical_pb_graph_pin);
void add_rr_switch_circuit_model(const RRSwitchId& rr_switch, const CircuitModelId& circuit_model);
void add_rr_segment_circuit_model(const RRSegmentId& rr_segment, const CircuitModelId& circuit_model);
private: /* Internal data */ private: /* Internal data */
/* Pair a regular pb_type to its physical pb_type */ /* Pair a regular pb_type to its physical pb_type */
std::map<t_pb_type*, t_pb_type*> physical_pb_types_; std::map<t_pb_type*, t_pb_type*> physical_pb_types_;
@ -157,6 +164,12 @@ class VprDeviceAnnotation {
/* Pair a pb_graph_pin to a physical pb_graph_pin */ /* Pair a pb_graph_pin to a physical pb_graph_pin */
std::map<t_pb_graph_pin*, t_pb_graph_pin*> physical_pb_graph_pins_; std::map<t_pb_graph_pin*, t_pb_graph_pin*> physical_pb_graph_pins_;
/* Pair a Routing Resource Switch (rr_switch) to a circuit model */
std::map<RRSwitchId, CircuitModelId> rr_switch_circuit_models_;
/* Pair a Routing Segment (rr_segment) to a circuit model */
std::map<RRSegmentId, CircuitModelId> rr_segment_circuit_models_;
}; };
} /* End namespace openfpga*/ } /* End namespace openfpga*/