From 62e4f14e3099bb4c262ba398ecec22980957f7b2 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Mon, 17 Feb 2020 17:26:27 -0700 Subject: [PATCH] add lb_rr_graph to device annotation --- .../src/annotation/vpr_device_annotation.cpp | 18 ++++++++++++++++++ .../src/annotation/vpr_device_annotation.h | 6 ++++++ openfpga/src/base/openfpga_context.h | 1 - 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/openfpga/src/annotation/vpr_device_annotation.cpp b/openfpga/src/annotation/vpr_device_annotation.cpp index 5b36e3885..9be30591d 100644 --- a/openfpga/src/annotation/vpr_device_annotation.cpp +++ b/openfpga/src/annotation/vpr_device_annotation.cpp @@ -241,6 +241,14 @@ ArchDirectId VprDeviceAnnotation::direct_annotation(const size_t& direct) const return direct_annotations_.at(direct); } +LbRRGraph VprDeviceAnnotation::physical_lb_rr_graph(t_pb_graph_node* pb_graph_head) const { + /* Ensure that the rr_switch is in the list */ + if (0 == physical_lb_rr_graphs_.count(pb_graph_head)) { + return LbRRGraph(); + } + return physical_lb_rr_graphs_.at(pb_graph_head); +} + /************************************************************************ * Public mutators ***********************************************************************/ @@ -470,4 +478,14 @@ void VprDeviceAnnotation::add_direct_annotation(const size_t& direct, const Arch direct_annotations_[direct] = arch_direct_id; } +void VprDeviceAnnotation::add_physical_lb_rr_graph(t_pb_graph_node* pb_graph_head, const LbRRGraph& lb_rr_graph) { + /* Warn any override attempt */ + if (0 < physical_lb_rr_graphs_.count(pb_graph_head)) { + VTR_LOG_WARN("Override the physical lb_rr_graph for pb_graph_head '%s'!\n", + pb_graph_head->pb_type->name); + } + + physical_lb_rr_graphs_[pb_graph_head] = lb_rr_graph; +} + } /* End namespace openfpga*/ diff --git a/openfpga/src/annotation/vpr_device_annotation.h b/openfpga/src/annotation/vpr_device_annotation.h index 5c083e367..0ecff4371 100644 --- a/openfpga/src/annotation/vpr_device_annotation.h +++ b/openfpga/src/annotation/vpr_device_annotation.h @@ -19,6 +19,7 @@ #include "openfpga_port.h" #include "circuit_library.h" #include "arch_direct.h" +#include "lb_rr_graph.h" /* Begin namespace openfpga */ namespace openfpga { @@ -73,6 +74,7 @@ class VprDeviceAnnotation { CircuitModelId rr_switch_circuit_model(const RRSwitchId& rr_switch) const; CircuitModelId rr_segment_circuit_model(const RRSegmentId& rr_segment) const; ArchDirectId direct_annotation(const size_t& direct) const; + LbRRGraph physical_lb_rr_graph(t_pb_graph_node* pb_graph_head) const; public: /* Public mutators */ 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); @@ -93,6 +95,7 @@ class VprDeviceAnnotation { 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); void add_direct_annotation(const size_t& direct, const ArchDirectId& arch_direct_id); + void add_physical_lb_rr_graph(t_pb_graph_node* pb_graph_head, const LbRRGraph& lb_rr_graph); private: /* Internal data */ /* Pair a regular pb_type to its physical pb_type */ std::map physical_pb_types_; @@ -176,6 +179,9 @@ class VprDeviceAnnotation { /* Pair a direct connection (direct) to a annotation which contains circuit model id */ std::map direct_annotations_; + + /* Logical type routing resource graphs built from physical modes */ + std::map physical_lb_rr_graphs_; }; } /* End namespace openfpga*/ diff --git a/openfpga/src/base/openfpga_context.h b/openfpga/src/base/openfpga_context.h index a8b37dcf7..5726cbba9 100644 --- a/openfpga/src/base/openfpga_context.h +++ b/openfpga/src/base/openfpga_context.h @@ -11,7 +11,6 @@ #include "tile_direct.h" #include "module_manager.h" #include "openfpga_flow_manager.h" -#include "lb_rr_graph.h" #include "device_rr_gsb.h" /********************************************************************