diff --git a/utils/route_diag/src/main.cpp b/utils/route_diag/src/main.cpp index 7160794cc7..e9a8ccd3a8 100644 --- a/utils/route_diag/src/main.cpp +++ b/utils/route_diag/src/main.cpp @@ -292,7 +292,7 @@ int main(int argc, const char **argv) { alloc_routing_structs(chan_width, vpr_setup.RouterOpts, - &vpr_setup.RoutingArch, + vpr_setup.RoutingArch, vpr_setup.Segments, Arch.directs, is_flat); diff --git a/vpr/src/analytical_place/detailed_placer.cpp b/vpr/src/analytical_place/detailed_placer.cpp index 75001fe4c4..9b84e1cf6f 100644 --- a/vpr/src/analytical_place/detailed_placer.cpp +++ b/vpr/src/analytical_place/detailed_placer.cpp @@ -65,7 +65,7 @@ AnnealerDetailedPlacer::AnnealerDetailedPlacer(const BlkLocRegistry& curr_cluste place_delay_model = PlacementDelayModelCreator::create_delay_model(vpr_setup.PlacerOpts, vpr_setup.RouterOpts, (const Netlist<>&)clustered_netlist, - &vpr_setup.RoutingArch, + vpr_setup.RoutingArch, vpr_setup.Segments, arch.Chans, arch.directs, diff --git a/vpr/src/base/SetupVPR.cpp b/vpr/src/base/SetupVPR.cpp index dc692cdcd1..2555663661 100644 --- a/vpr/src/base/SetupVPR.cpp +++ b/vpr/src/base/SetupVPR.cpp @@ -38,10 +38,12 @@ static void SetupNocOpts(const t_options& Options, t_noc_opts* NocOpts); static void SetupServerOpts(const t_options& Options, t_server_opts* ServerOpts); -static void SetupRoutingArch(const t_arch& Arch, t_det_routing_arch* RoutingArch); + +static void SetupRoutingArch(const t_arch& Arch, t_det_routing_arch& RoutingArch); + static void SetupTiming(const t_options& Options, const bool TimingEnabled, t_timing_inf* Timing); static void SetupSwitches(const t_arch& Arch, - t_det_routing_arch* RoutingArch, + t_det_routing_arch& RoutingArch, const std::vector& arch_switches); static void SetupAnalysisOpts(const t_options& Options, t_analysis_opts& analysis_opts); static void SetupPowerOpts(const t_options& Options, t_power_opts* power_opts, t_arch* Arch); @@ -97,7 +99,7 @@ void SetupVPR(const t_options* options, t_analysis_opts* analysisOpts, t_noc_opts* nocOpts, t_server_opts* serverOpts, - t_det_routing_arch* routingArch, + t_det_routing_arch& routingArch, std::vector** packerRRGraphs, std::vector& segments, t_timing_inf* timing, @@ -231,9 +233,9 @@ void SetupVPR(const t_options* options, SetupTiming(*options, timingenabled, timing); SetupPackerOpts(*options, packerOpts); SetupAPOpts(*options, *apOpts); - routingArch->write_rr_graph_filename = options->write_rr_graph_file; - routingArch->read_rr_graph_filename = options->read_rr_graph_file; - routingArch->read_rr_edge_override_filename = options->read_rr_edge_override_file; + routingArch.write_rr_graph_filename = options->write_rr_graph_file; + routingArch.read_rr_graph_filename = options->read_rr_graph_file; + routingArch.read_rr_edge_override_filename = options->read_rr_edge_override_file; for (auto has_global_routing : arch->layer_global_routing) { device_ctx.inter_cluster_prog_routing_resources.emplace_back(has_global_routing); @@ -355,17 +357,17 @@ static void SetupTiming(const t_options& Options, const bool TimingEnabled, t_ti * from the arch file with the special switches that VPR needs. */ static void SetupSwitches(const t_arch& Arch, - t_det_routing_arch* RoutingArch, + t_det_routing_arch& RoutingArch, const std::vector& arch_switches) { auto& device_ctx = g_vpr_ctx.mutable_device(); int switches_to_copy = (int)arch_switches.size(); int num_arch_switches = (int)arch_switches.size(); - find_ipin_cblock_switch_index(Arch, RoutingArch->wire_to_arch_ipin_switch, RoutingArch->wire_to_arch_ipin_switch_between_dice); + find_ipin_cblock_switch_index(Arch, RoutingArch.wire_to_arch_ipin_switch, RoutingArch.wire_to_arch_ipin_switch_between_dice); /* Depends on device_ctx.num_arch_switches */ - RoutingArch->delayless_switch = num_arch_switches++; + RoutingArch.delayless_switch = num_arch_switches++; /* Alloc the list now that we know the final num_arch_switches value */ device_ctx.arch_switch_inf.resize(num_arch_switches); @@ -377,32 +379,32 @@ static void SetupSwitches(const t_arch& Arch, } /* Delayless switch for connecting sinks and sources with their pins. */ - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].set_type(SwitchType::MUX); - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].name = std::string(VPR_DELAYLESS_SWITCH_NAME); - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].R = 0.; - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].Cin = 0.; - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].Cout = 0.; - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].set_Tdel(t_arch_switch_inf::UNDEFINED_FANIN, 0.); - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].power_buffer_type = POWER_BUFFER_TYPE_NONE; - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].mux_trans_size = 0.; - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].buf_size_type = BufferSize::ABSOLUTE; - device_ctx.arch_switch_inf[RoutingArch->delayless_switch].buf_size = 0.; - VTR_ASSERT_MSG(device_ctx.arch_switch_inf[RoutingArch->delayless_switch].buffered(), "Delayless switch expected to be buffered (isolating)"); - VTR_ASSERT_MSG(device_ctx.arch_switch_inf[RoutingArch->delayless_switch].configurable(), "Delayless switch expected to be configurable"); + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].set_type(SwitchType::MUX); + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].name = std::string(VPR_DELAYLESS_SWITCH_NAME); + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].R = 0.; + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].Cin = 0.; + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].Cout = 0.; + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].set_Tdel(t_arch_switch_inf::UNDEFINED_FANIN, 0.); + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].power_buffer_type = POWER_BUFFER_TYPE_NONE; + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].mux_trans_size = 0.; + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].buf_size_type = BufferSize::ABSOLUTE; + device_ctx.arch_switch_inf[RoutingArch.delayless_switch].buf_size = 0.; + VTR_ASSERT_MSG(device_ctx.arch_switch_inf[RoutingArch.delayless_switch].buffered(), "Delayless switch expected to be buffered (isolating)"); + VTR_ASSERT_MSG(device_ctx.arch_switch_inf[RoutingArch.delayless_switch].configurable(), "Delayless switch expected to be configurable"); - device_ctx.all_sw_inf[RoutingArch->delayless_switch] = device_ctx.arch_switch_inf[RoutingArch->delayless_switch]; + device_ctx.all_sw_inf[RoutingArch.delayless_switch] = device_ctx.arch_switch_inf[RoutingArch.delayless_switch]; - RoutingArch->global_route_switch = RoutingArch->delayless_switch; + RoutingArch.global_route_switch = RoutingArch.delayless_switch; - device_ctx.delayless_switch_idx = RoutingArch->delayless_switch; + device_ctx.delayless_switch_idx = RoutingArch.delayless_switch; //Warn about non-zero Cout values for the ipin switch, since these values have no effect. //VPR do not model the R/C's of block internal routing connection. // //Note that we don't warn about the R value as it may be used to size the buffer (if buf_size_type is AUTO) - if (device_ctx.arch_switch_inf[RoutingArch->wire_to_arch_ipin_switch].Cout != 0.) { + if (device_ctx.arch_switch_inf[RoutingArch.wire_to_arch_ipin_switch].Cout != 0.) { VTR_LOG_WARN("Non-zero switch output capacitance (%g) has no effect when switch '%s' is used for connection block inputs\n", - device_ctx.arch_switch_inf[RoutingArch->wire_to_arch_ipin_switch].Cout, Arch.ipin_cblock_switch_name[0].c_str()); + device_ctx.arch_switch_inf[RoutingArch.wire_to_arch_ipin_switch].Cout, Arch.ipin_cblock_switch_name[0].c_str()); } } @@ -412,18 +414,18 @@ static void SetupSwitches(const t_arch& Arch, * Since checks are already done, this just copies values across */ static void SetupRoutingArch(const t_arch& Arch, - t_det_routing_arch* RoutingArch) { - RoutingArch->switch_block_type = Arch.SBType; - RoutingArch->R_minW_nmos = Arch.R_minW_nmos; - RoutingArch->R_minW_pmos = Arch.R_minW_pmos; - RoutingArch->Fs = Arch.Fs; - RoutingArch->directionality = BI_DIRECTIONAL; + t_det_routing_arch& RoutingArch) { + RoutingArch.switch_block_type = Arch.SBType; + RoutingArch.R_minW_nmos = Arch.R_minW_nmos; + RoutingArch.R_minW_pmos = Arch.R_minW_pmos; + RoutingArch.Fs = Arch.Fs; + RoutingArch.directionality = BI_DIRECTIONAL; if (!Arch.Segments.empty()) { - RoutingArch->directionality = Arch.Segments[0].directionality; + RoutingArch.directionality = Arch.Segments[0].directionality; } /* copy over the switch block information */ - RoutingArch->switchblocks = Arch.switchblocks; + RoutingArch.switchblocks = Arch.switchblocks; } static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts) { diff --git a/vpr/src/base/SetupVPR.h b/vpr/src/base/SetupVPR.h index 9492da360d..7470a1fd0c 100644 --- a/vpr/src/base/SetupVPR.h +++ b/vpr/src/base/SetupVPR.h @@ -18,7 +18,7 @@ void SetupVPR(const t_options* Options, t_analysis_opts* AnalysisOpts, t_noc_opts* NocOpts, t_server_opts* ServerOpts, - t_det_routing_arch* RoutingArch, + t_det_routing_arch& RoutingArch, std::vector** PackerRRGraphs, std::vector& Segments, t_timing_inf* Timing, diff --git a/vpr/src/base/place_and_route.cpp b/vpr/src/base/place_and_route.cpp index e910d02418..6fd8dc87f2 100644 --- a/vpr/src/base/place_and_route.cpp +++ b/vpr/src/base/place_and_route.cpp @@ -48,7 +48,7 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list, const t_arch* arch, bool verify_binary_search, int min_chan_width_hint, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, NetPinsMatrix& net_delay, const std::shared_ptr& timing_info, @@ -83,13 +83,13 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list, graph_type = e_graph_type::GLOBAL; graph_directionality = e_graph_type::BIDIR; } else { - graph_type = (det_routing_arch->directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); - graph_directionality = (det_routing_arch->directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); + graph_type = (det_routing_arch.directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); + graph_directionality = (det_routing_arch.directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); } VTR_ASSERT(!net_delay.empty()); - if (det_routing_arch->directionality == BI_DIRECTIONAL) + if (det_routing_arch.directionality == BI_DIRECTIONAL) udsd_multiplier = 1; else udsd_multiplier = 2; @@ -116,14 +116,14 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list, } /* Constraints must be checked to not break rr_graph generator */ - if (det_routing_arch->directionality == UNI_DIRECTIONAL) { + if (det_routing_arch.directionality == UNI_DIRECTIONAL) { if (current % 2 != 0) { VPR_FATAL_ERROR(VPR_ERROR_ROUTE, "Tried odd chan width (%d) in uni-directional routing architecture (chan width must be even).\n", current); } } else { - if (det_routing_arch->Fs % 3) { + if (det_routing_arch.Fs % 3) { VPR_FATAL_ERROR(VPR_ERROR_ROUTE, "Fs must be three in bidirectional mode.\n"); } @@ -158,7 +158,7 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list, } } - if ((current * 3) < det_routing_arch->Fs) { + if ((current * 3) < det_routing_arch.Fs) { VTR_LOG("Width factor is now below specified Fs. Stop search.\n"); final = high; break; @@ -350,7 +350,7 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list, prev2_success = prev_success; prev_success = success; current--; - if (det_routing_arch->directionality == UNI_DIRECTIONAL) { + if (det_routing_arch.directionality == UNI_DIRECTIONAL) { current--; /* width must be even */ } } diff --git a/vpr/src/base/place_and_route.h b/vpr/src/base/place_and_route.h index e595a2cded..da27077cfa 100644 --- a/vpr/src/base/place_and_route.h +++ b/vpr/src/base/place_and_route.h @@ -29,7 +29,7 @@ int binary_search_place_and_route(const Netlist<>& placement_net_list, const t_arch* arch, bool verify_binary_search, int min_chan_width_hint, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, NetPinsMatrix& net_delay, const std::shared_ptr& timing_info, diff --git a/vpr/src/base/vpr_api.cpp b/vpr/src/base/vpr_api.cpp index 560b3e2d52..b841c23bd3 100644 --- a/vpr/src/base/vpr_api.cpp +++ b/vpr/src/base/vpr_api.cpp @@ -293,7 +293,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a &vpr_setup->AnalysisOpts, &vpr_setup->NocOpts, &vpr_setup->ServerOpts, - &vpr_setup->RoutingArch, + vpr_setup->RoutingArch, &vpr_setup->PackerRRGraph, vpr_setup->Segments, &vpr_setup->Timing, @@ -830,7 +830,7 @@ void vpr_place(const Netlist<>& net_list, vpr_setup.AnalysisOpts, vpr_setup.NocOpts, arch.Chans, - &vpr_setup.RoutingArch, + vpr_setup.RoutingArch, vpr_setup.Segments, arch.directs, g_vpr_ctx.atom().flat_placement_info(), @@ -848,7 +848,7 @@ void vpr_place(const Netlist<>& net_list, } void vpr_load_placement(t_vpr_setup& vpr_setup, - const std::vector directs) { + const std::vector& directs) { vtr::ScopedStartFinishTimer timer("Load Placement"); const auto& device_ctx = g_vpr_ctx.device(); @@ -1044,7 +1044,7 @@ RouteStatus vpr_route_fixed_W(const Netlist<>& net_list, fixed_channel_width, vpr_setup.RouterOpts, vpr_setup.AnalysisOpts, - &vpr_setup.RoutingArch, + vpr_setup.RoutingArch, vpr_setup.Segments, net_delay, timing_info, @@ -1081,7 +1081,7 @@ RouteStatus vpr_route_min_W(const Netlist<>& net_list, &arch, router_opts.verify_binary_search, router_opts.min_channel_width_hint, - &vpr_setup.RoutingArch, + vpr_setup.RoutingArch, vpr_setup.Segments, net_delay, timing_info, @@ -1121,7 +1121,7 @@ RouteStatus vpr_load_routing(t_vpr_setup& vpr_setup, void vpr_create_rr_graph(t_vpr_setup& vpr_setup, const t_arch& arch, int chan_width_fac, bool is_flat) { auto& device_ctx = g_vpr_ctx.mutable_device(); - auto det_routing_arch = &vpr_setup.RoutingArch; + t_det_routing_arch& det_routing_arch = vpr_setup.RoutingArch; auto& router_opts = vpr_setup.RouterOpts; e_graph_type graph_type; @@ -1130,8 +1130,8 @@ void vpr_create_rr_graph(t_vpr_setup& vpr_setup, const t_arch& arch, int chan_wi graph_type = e_graph_type::GLOBAL; graph_directionality = e_graph_type::BIDIR; } else { - graph_type = (det_routing_arch->directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); - graph_directionality = (det_routing_arch->directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); + graph_type = (det_routing_arch.directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); + graph_directionality = (det_routing_arch.directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); } t_chan_width chan_width = init_chan(chan_width_fac, arch.Chans, graph_directionality); @@ -1293,7 +1293,7 @@ void vpr_setup_vpr(t_options* Options, t_analysis_opts* AnalysisOpts, t_noc_opts* NocOpts, t_server_opts* ServerOpts, - t_det_routing_arch* RoutingArch, + t_det_routing_arch& RoutingArch, std::vector** PackerRRGraph, std::vector& Segments, t_timing_inf* Timing, @@ -1518,7 +1518,7 @@ void vpr_power_estimation(const t_vpr_setup& vpr_setup, /* Initialize the power module */ bool power_error = power_init(vpr_setup.FileNameOpts.PowerFile.c_str(), - vpr_setup.FileNameOpts.CmosTechFile.c_str(), &Arch, &vpr_setup.RoutingArch); + vpr_setup.FileNameOpts.CmosTechFile.c_str(), &Arch, vpr_setup.RoutingArch); if (power_error) { VTR_LOG_ERROR("Power initialization failed.\n"); } @@ -1529,8 +1529,7 @@ void vpr_power_estimation(const t_vpr_setup& vpr_setup, VTR_LOG("Running power estimation\n"); /* Run power estimation */ - e_power_ret_code power_ret_code = power_total(&power_runtime_s, vpr_setup, - &Arch, &vpr_setup.RoutingArch); + e_power_ret_code power_ret_code = power_total(&power_runtime_s, vpr_setup, &Arch, vpr_setup.RoutingArch); /* Check for errors/warnings */ if (power_ret_code == POWER_RET_CODE_ERRORS) { diff --git a/vpr/src/base/vpr_api.h b/vpr/src/base/vpr_api.h index 28324e60da..54d4f8bf5c 100644 --- a/vpr/src/base/vpr_api.h +++ b/vpr/src/base/vpr_api.h @@ -82,7 +82,7 @@ void vpr_place(const Netlist<>& net_list, ///@brief Loads a previous placement void vpr_load_placement(t_vpr_setup& vpr_setup, - const std::vector directs); + const std::vector& directs); /* Routing */ @@ -186,7 +186,7 @@ void vpr_setup_vpr(t_options* Options, t_analysis_opts* AnalysisOpts, t_noc_opts* NocOpts, t_server_opts* ServerOpts, - t_det_routing_arch* RoutingArch, + t_det_routing_arch& RoutingArch, std::vector** PackerRRGraph, std::vector& Segments, t_timing_inf* Timing, diff --git a/vpr/src/place/delay_model/PlacementDelayModelCreator.cpp b/vpr/src/place/delay_model/PlacementDelayModelCreator.cpp index e58cb4b953..1ec59f4ed1 100644 --- a/vpr/src/place/delay_model/PlacementDelayModelCreator.cpp +++ b/vpr/src/place/delay_model/PlacementDelayModelCreator.cpp @@ -27,9 +27,9 @@ std::unique_ptr PlacementDelayModelCreator::create_delay_model(const t_placer_opts& placer_opts, const t_router_opts& router_opts, const Netlist<>& net_list, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, - t_chan_width_dist chan_width_dist, + const t_chan_width_dist& chan_width_dist, const std::vector& directs, bool is_flat) { vtr::ScopedStartFinishTimer timer("Computing placement delta delay look-up"); @@ -38,7 +38,7 @@ PlacementDelayModelCreator::create_delay_model(const t_placer_opts& placer_opts, alloc_routing_structs(chan_width, router_opts, det_routing_arch, segment_inf, directs, is_flat); - const RouterLookahead* router_lookahead = get_cached_router_lookahead(*det_routing_arch, + const RouterLookahead* router_lookahead = get_cached_router_lookahead(det_routing_arch, router_opts.lookahead_type, router_opts.write_router_lookahead, router_opts.read_router_lookahead, diff --git a/vpr/src/place/delay_model/PlacementDelayModelCreator.h b/vpr/src/place/delay_model/PlacementDelayModelCreator.h index c92b67d485..c003d85e03 100644 --- a/vpr/src/place/delay_model/PlacementDelayModelCreator.h +++ b/vpr/src/place/delay_model/PlacementDelayModelCreator.h @@ -22,9 +22,9 @@ class PlacementDelayModelCreator { static std::unique_ptr create_delay_model(const t_placer_opts& placer_opts, const t_router_opts& router_opts, const Netlist<>& net_list, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, - t_chan_width_dist chan_width_dist, + const t_chan_width_dist& chan_width_dist, const std::vector& directs, bool is_flat); }; diff --git a/vpr/src/place/place.cpp b/vpr/src/place/place.cpp index 646e2a6dee..39d6cd24f8 100644 --- a/vpr/src/place/place.cpp +++ b/vpr/src/place/place.cpp @@ -33,8 +33,8 @@ void try_place(const Netlist<>& net_list, const t_router_opts& router_opts, const t_analysis_opts& analysis_opts, const t_noc_opts& noc_opts, - t_chan_width_dist chan_width_dist, - t_det_routing_arch* det_routing_arch, + const t_chan_width_dist& chan_width_dist, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, const std::vector& directs, const FlatPlacementInfo& flat_placement_info, diff --git a/vpr/src/place/place.h b/vpr/src/place/place.h index c7c3d9f875..235dbc0042 100644 --- a/vpr/src/place/place.h +++ b/vpr/src/place/place.h @@ -10,8 +10,8 @@ void try_place(const Netlist<>& net_list, const t_router_opts& router_opts, const t_analysis_opts& analysis_opts, const t_noc_opts& noc_opts, - t_chan_width_dist chan_width_dist, - t_det_routing_arch* det_routing_arch, + const t_chan_width_dist& chan_width_dist, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, const std::vector& directs, const FlatPlacementInfo& flat_placement_info, diff --git a/vpr/src/power/power.cpp b/vpr/src/power/power.cpp index 888507ae80..1b88e2e831 100644 --- a/vpr/src/power/power.cpp +++ b/vpr/src/power/power.cpp @@ -7,7 +7,7 @@ * or email: * vtr.power.estimation@gmail.com * - * If you are using power estimation for your researach please cite: + * If you are using power estimation for your research please cite: * * Jeffrey Goeders and Steven Wilton. VersaPower: Power Estimation * for Diverse FPGA Architectures. In International Conference on @@ -65,7 +65,7 @@ static t_rr_node_power* rr_node_power; /************************* Function Declarations ********************/ /* Routing */ static void power_usage_routing(t_power_usage* power_usage, - const t_det_routing_arch* routing_arch, + const t_det_routing_arch& routing_arch, bool is_flat); /* Tiles */ @@ -111,7 +111,7 @@ void power_init_pb_pins_rec(t_pb_graph_node* pb_node); void power_uninit_pb_pins_rec(t_pb_graph_node* pb_node); void power_pb_pins_init(); void power_pb_pins_uninit(); -void power_routing_init(const t_det_routing_arch* routing_arch); +void power_routing_init(const t_det_routing_arch& routing_arch); /************************* FUNCTION DEFINITIONS *********************/ /** @@ -783,7 +783,7 @@ static void dealloc_mux_graph_rec(t_mux_node* node) { * Calculates the power of the entire routing fabric (not local routing */ static void power_usage_routing(t_power_usage* power_usage, - const t_det_routing_arch* routing_arch, + const t_det_routing_arch& routing_arch, bool is_flat) { auto& power_ctx = g_vpr_ctx.power(); auto& cluster_ctx = g_vpr_ctx.clustering(); @@ -988,9 +988,9 @@ static void power_usage_routing(t_power_usage* power_usage, connectionbox_fanout = 0; switchbox_fanout = 0; for (t_edge_size iedge = 0; iedge < rr_graph.num_edges(rr_id); iedge++) { - if (rr_graph.edge_switch(rr_id, iedge) == routing_arch->wire_to_rr_ipin_switch) { + if (rr_graph.edge_switch(rr_id, iedge) == routing_arch.wire_to_rr_ipin_switch) { connectionbox_fanout++; - } else if (rr_graph.edge_switch(rr_id, iedge) == routing_arch->delayless_switch) { + } else if (rr_graph.edge_switch(rr_id, iedge) == routing_arch.delayless_switch) { /* Do nothing */ } else { switchbox_fanout++; @@ -1180,7 +1180,7 @@ void power_pb_pins_uninit() { } } -void power_routing_init(const t_det_routing_arch* routing_arch) { +void power_routing_init(const t_det_routing_arch& routing_arch) { t_edge_size max_fanin; t_edge_size max_IPIN_fanin; t_edge_size max_seg_to_IPIN_fanout; @@ -1234,9 +1234,9 @@ void power_routing_init(const t_det_routing_arch* routing_arch) { case e_rr_type::CHANX: case e_rr_type::CHANY: for (t_edge_size iedge = 0; iedge < rr_graph.num_edges(rr_node_idx); iedge++) { - if (rr_graph.edge_switch(rr_node_idx, iedge) == routing_arch->wire_to_rr_ipin_switch) { + if (rr_graph.edge_switch(rr_node_idx, iedge) == routing_arch.wire_to_rr_ipin_switch) { fanout_to_IPIN++; - } else if (rr_graph.edge_switch(rr_node_idx, iedge) != routing_arch->delayless_switch) { + } else if (rr_graph.edge_switch(rr_node_idx, iedge) != routing_arch.delayless_switch) { fanout_to_seg++; } } @@ -1304,7 +1304,7 @@ void power_routing_init(const t_det_routing_arch* routing_arch) { bool power_init(const char* power_out_filepath, const char* cmos_tech_behavior_filepath, const t_arch* arch, - const t_det_routing_arch* routing_arch) { + const t_det_routing_arch& routing_arch) { auto& power_ctx = g_vpr_ctx.mutable_power(); bool error = false; @@ -1386,8 +1386,7 @@ bool power_uninit() { delete[] rr_node_power; /* Free mux architectures */ - for (std::map::iterator it = power_ctx.commonly_used->mux_info.begin(); - it != power_ctx.commonly_used->mux_info.end(); it++) { + for (auto it = power_ctx.commonly_used->mux_info.begin(); it != power_ctx.commonly_used->mux_info.end(); it++) { t_power_mux_info* mux_info = it->second; for (mux_size = 1; mux_size <= mux_info->mux_arch_max_size; mux_size++) { dealloc_mux_graph(mux_info->mux_arch[mux_size].mux_graph_head); @@ -1710,7 +1709,7 @@ static void power_print_summary(FILE* fp, const t_vpr_setup& vpr_setup) { * and prints it to the output file * - run_time_s: (Return value) The total runtime in seconds (us accuracy) */ -e_power_ret_code power_total(float* run_time_s, const t_vpr_setup& vpr_setup, const t_arch* arch, const t_det_routing_arch* routing_arch) { +e_power_ret_code power_total(float* run_time_s, const t_vpr_setup& vpr_setup, const t_arch* arch, const t_det_routing_arch& routing_arch) { t_power_usage total_power; t_power_usage sub_power_usage; clock_t t_start; @@ -1722,7 +1721,7 @@ e_power_ret_code power_total(float* run_time_s, const t_vpr_setup& vpr_setup, co power_zero_usage(&total_power); - if (routing_arch->directionality == BI_DIRECTIONAL) { + if (routing_arch.directionality == BI_DIRECTIONAL) { power_log_msg(POWER_LOG_ERROR, "Cannot calculate routing power for bi-directional architectures"); return POWER_RET_CODE_ERRORS; diff --git a/vpr/src/power/power.h b/vpr/src/power/power.h index 42191fafe2..36630921b0 100644 --- a/vpr/src/power/power.h +++ b/vpr/src/power/power.h @@ -1,3 +1,5 @@ +#pragma once + /********************************************************************* * The following code is part of the power modelling feature of VTR. * @@ -19,9 +21,6 @@ * This is the top-level file for power estimation in VTR */ -#ifndef __POWER_H__ -#define __POWER_H__ - /************************* INCLUDES *********************************/ #include @@ -308,11 +307,9 @@ struct t_mux_node { bool power_init(const char* power_out_filepath, const char* cmos_tech_behavior_filepath, const t_arch* arch, - const t_det_routing_arch* routing_arch); + const t_det_routing_arch& routing_arch); bool power_uninit(); /* Top-Level Function */ -e_power_ret_code power_total(float* run_time_s, const t_vpr_setup& vpr_setup, const t_arch* arch, const t_det_routing_arch* routing_arch); - -#endif /* __POWER_H__ */ +e_power_ret_code power_total(float* run_time_s, const t_vpr_setup& vpr_setup, const t_arch* arch, const t_det_routing_arch& routing_arch); diff --git a/vpr/src/power/power_callibrate.h b/vpr/src/power/power_callibrate.h index eb387b4e3d..48852da4ea 100644 --- a/vpr/src/power/power_callibrate.h +++ b/vpr/src/power/power_callibrate.h @@ -19,8 +19,7 @@ * againt SPICE. */ -#ifndef __POWER_MISC_H__ -#define __POWER_MISC_H__ +#pragma once /************************* INCLUDES *********************************/ #include "power.h" @@ -49,4 +48,3 @@ float power_usage_mux_for_callibration(int num_inputs, float transistor_size); float power_usage_lut_for_callibration(int num_inputs, float transistor_size); float power_usage_ff_for_callibration(int num_inputs, float transistor_size); void power_print_callibration(); -#endif diff --git a/vpr/src/route/route.cpp b/vpr/src/route/route.cpp index cad0cf1b7a..ca1589fdea 100644 --- a/vpr/src/route/route.cpp +++ b/vpr/src/route/route.cpp @@ -16,7 +16,7 @@ bool route(const Netlist<>& net_list, int width_fac, const t_router_opts& router_opts, const t_analysis_opts& analysis_opts, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, NetPinsMatrix& net_delay, std::shared_ptr timing_info, @@ -40,8 +40,8 @@ bool route(const Netlist<>& net_list, graph_type = e_graph_type::GLOBAL; graph_directionality = e_graph_type::BIDIR; } else { - graph_type = (det_routing_arch->directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); - graph_directionality = (det_routing_arch->directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); + graph_type = (det_routing_arch.directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); + graph_directionality = (det_routing_arch.directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); } /* Set the channel widths */ @@ -119,7 +119,7 @@ bool route(const Netlist<>& net_list, route_budgets budgeting_inf(net_list, is_flat); // This needs to be called before filling intra-cluster lookahead maps to ensure that the intra-cluster lookahead maps are initialized. - const RouterLookahead* router_lookahead = get_cached_router_lookahead(*det_routing_arch, + const RouterLookahead* router_lookahead = get_cached_router_lookahead(det_routing_arch, router_opts.lookahead_type, router_opts.write_router_lookahead, router_opts.read_router_lookahead, @@ -139,7 +139,7 @@ bool route(const Netlist<>& net_list, mut_router_lookahead->compute_intra_tile(); } route_ctx.cached_router_lookahead_.set(cache_key, std::move(mut_router_lookahead)); - router_lookahead = get_cached_router_lookahead(*det_routing_arch, + router_lookahead = get_cached_router_lookahead(det_routing_arch, router_opts.lookahead_type, router_opts.write_router_lookahead, router_opts.read_router_lookahead, diff --git a/vpr/src/route/route.h b/vpr/src/route/route.h index 082a417008..5d519228d0 100644 --- a/vpr/src/route/route.h +++ b/vpr/src/route/route.h @@ -21,7 +21,7 @@ bool route(const Netlist<>& net_list, int width_fac, const t_router_opts& router_opts, const t_analysis_opts& analysis_opts, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, NetPinsMatrix& net_delay, std::shared_ptr timing_info, diff --git a/vpr/src/route/route_utils.cpp b/vpr/src/route/route_utils.cpp index 687ca44d06..c5f498a950 100644 --- a/vpr/src/route/route_utils.cpp +++ b/vpr/src/route/route_utils.cpp @@ -466,7 +466,7 @@ vtr::vector>> set_net /** Wrapper for create_rr_graph() with extra checks */ void try_graph(int width_fac, const t_router_opts& router_opts, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, t_chan_width_dist chan_width_dist, const std::vector& directs, @@ -479,8 +479,8 @@ void try_graph(int width_fac, graph_type = e_graph_type::GLOBAL; graph_directionality = e_graph_type::BIDIR; } else { - graph_type = (det_routing_arch->directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); - graph_directionality = (det_routing_arch->directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); + graph_type = (det_routing_arch.directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); + graph_directionality = (det_routing_arch.directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); } /* Set the channel widths */ diff --git a/vpr/src/route/route_utils.h b/vpr/src/route/route_utils.h index 19f14e7cdb..5cac4fbb04 100644 --- a/vpr/src/route/route_utils.h +++ b/vpr/src/route/route_utils.h @@ -143,7 +143,7 @@ vtr::vector>> set_net /** Wrapper for create_rr_graph() with extra checks */ void try_graph(int width_fac, const t_router_opts& router_opts, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, t_chan_width_dist chan_width_dist, const std::vector& directs, diff --git a/vpr/src/route/router_delay_profiling.cpp b/vpr/src/route/router_delay_profiling.cpp index d87fd754df..28c553c5d8 100644 --- a/vpr/src/route/router_delay_profiling.cpp +++ b/vpr/src/route/router_delay_profiling.cpp @@ -245,7 +245,7 @@ vtr::vector calculate_all_path_delays_from_rr_node(RRNodeId src void alloc_routing_structs(const t_chan_width& chan_width, const t_router_opts& router_opts, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, const std::vector& directs, bool is_flat) { @@ -257,7 +257,7 @@ void alloc_routing_structs(const t_chan_width& chan_width, if (router_opts.route_type == GLOBAL) { graph_type = e_graph_type::GLOBAL; } else { - graph_type = (det_routing_arch->directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); + graph_type = (det_routing_arch.directionality == BI_DIRECTIONAL ? e_graph_type::BIDIR : e_graph_type::UNIDIR); } create_rr_graph(graph_type, diff --git a/vpr/src/route/router_delay_profiling.h b/vpr/src/route/router_delay_profiling.h index f137e143df..082349a9a0 100644 --- a/vpr/src/route/router_delay_profiling.h +++ b/vpr/src/route/router_delay_profiling.h @@ -54,7 +54,7 @@ vtr::vector calculate_all_path_delays_from_rr_node(RRNodeId src void alloc_routing_structs(const t_chan_width& chan_width, const t_router_opts& router_opts, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, std::vector& segment_inf, const std::vector& directs, bool is_flat); diff --git a/vpr/src/route/rr_graph.cpp b/vpr/src/route/rr_graph.cpp index a6219c5b89..718a21ca9f 100644 --- a/vpr/src/route/rr_graph.cpp +++ b/vpr/src/route/rr_graph.cpp @@ -737,7 +737,7 @@ static void build_intra_cluster_rr_graph(e_graph_type graph_type, * @param det_routing_arch Contain the information from architecture file * @param load_rr_graph Indicate whether the RR graph is loaded from a file */ -static int get_delayless_switch_id(t_det_routing_arch* det_routing_arch, +static int get_delayless_switch_id(const t_det_routing_arch& det_routing_arch, bool load_rr_graph); /******************* Subroutine definitions *******************************/ @@ -746,7 +746,7 @@ void create_rr_graph(e_graph_type graph_type, const std::vector& block_types, const DeviceGrid& grid, const t_chan_width& nodes_per_chan, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, const std::vector& segment_inf, const t_router_opts& router_opts, const std::vector& directs, @@ -756,7 +756,7 @@ void create_rr_graph(e_graph_type graph_type, auto& mutable_device_ctx = g_vpr_ctx.mutable_device(); bool echo_enabled = getEchoEnabled() && isEchoFileEnabled(E_ECHO_RR_GRAPH_INDEXED_DATA); const char* echo_file_name = getEchoFileName(E_ECHO_RR_GRAPH_INDEXED_DATA); - bool load_rr_graph = !det_routing_arch->read_rr_graph_filename.empty(); + bool load_rr_graph = !det_routing_arch.read_rr_graph_filename.empty(); if (channel_widths_unchanged(device_ctx.chan_width, nodes_per_chan) && !device_ctx.rr_graph.empty()) { //No change in channel width, so skip re-building RR graph @@ -768,7 +768,7 @@ void create_rr_graph(e_graph_type graph_type, } } else { if (load_rr_graph) { - if (device_ctx.loaded_rr_graph_filename != det_routing_arch->read_rr_graph_filename) { + if (device_ctx.loaded_rr_graph_filename != det_routing_arch.read_rr_graph_filename) { free_rr_graph(); load_rr_file(&mutable_device_ctx.rr_graph_builder, @@ -783,9 +783,9 @@ void create_rr_graph(e_graph_type graph_type, device_ctx.arch, &mutable_device_ctx.chan_width, router_opts.base_cost_type, - &det_routing_arch->wire_to_rr_ipin_switch, - &det_routing_arch->wire_to_arch_ipin_switch_between_dice, - det_routing_arch->read_rr_graph_filename.c_str(), + &det_routing_arch.wire_to_rr_ipin_switch, + &det_routing_arch.wire_to_arch_ipin_switch_between_dice, + det_routing_arch.read_rr_graph_filename.c_str(), &mutable_device_ctx.loaded_rr_graph_filename, router_opts.read_rr_edge_metadata, router_opts.do_check_rr_graph, @@ -804,36 +804,36 @@ void create_rr_graph(e_graph_type graph_type, block_types, grid, nodes_per_chan, - det_routing_arch->switch_block_type, - det_routing_arch->Fs, - det_routing_arch->switchblocks, + det_routing_arch.switch_block_type, + det_routing_arch.Fs, + det_routing_arch.switchblocks, segment_inf, - det_routing_arch->global_route_switch, - det_routing_arch->wire_to_arch_ipin_switch, - det_routing_arch->wire_to_arch_ipin_switch_between_dice, + det_routing_arch.global_route_switch, + det_routing_arch.wire_to_arch_ipin_switch, + det_routing_arch.wire_to_arch_ipin_switch_between_dice, router_opts.custom_3d_sb_fanin_fanout, - det_routing_arch->delayless_switch, - det_routing_arch->R_minW_nmos, - det_routing_arch->R_minW_pmos, + det_routing_arch.delayless_switch, + det_routing_arch.R_minW_nmos, + det_routing_arch.R_minW_pmos, router_opts.base_cost_type, router_opts.clock_modeling, directs, - &det_routing_arch->wire_to_rr_ipin_switch, + &det_routing_arch.wire_to_rr_ipin_switch, is_flat, Warnings, router_opts.route_verbosity); } // Check if there is an edge override file to read and that it is not already loaded. - if (!det_routing_arch->read_rr_edge_override_filename.empty() - && det_routing_arch->read_rr_edge_override_filename != device_ctx.loaded_rr_edge_override_filename) { + if (!det_routing_arch.read_rr_edge_override_filename.empty() + && det_routing_arch.read_rr_edge_override_filename != device_ctx.loaded_rr_edge_override_filename) { - load_rr_edge_delay_overrides(det_routing_arch->read_rr_edge_override_filename, + load_rr_edge_delay_overrides(det_routing_arch.read_rr_edge_override_filename, mutable_device_ctx.rr_graph_builder, device_ctx.rr_graph); // Remember the loaded filename to avoid reloading it before the RR graph is cleared. - mutable_device_ctx.loaded_rr_edge_override_filename = det_routing_arch->read_rr_edge_override_filename; + mutable_device_ctx.loaded_rr_edge_override_filename = det_routing_arch.read_rr_edge_override_filename; } } @@ -845,8 +845,8 @@ void create_rr_graph(e_graph_type graph_type, block_types, device_ctx.rr_graph, delayless_switch, - det_routing_arch->R_minW_nmos, - det_routing_arch->R_minW_pmos, + det_routing_arch.R_minW_nmos, + det_routing_arch.R_minW_pmos, mutable_device_ctx.rr_graph_builder, is_flat, load_rr_graph); @@ -876,7 +876,7 @@ void create_rr_graph(e_graph_type graph_type, // When this function is called in any stage other than routing, the is_flat flag passed to this function is false, regardless of the flag passed // through command line. So, the graph corresponding to global resources will be created and written down to file if needed. During routing, if flat-routing // is enabled, intra-cluster resources will be added to the graph, but this new bigger graph will not be written down. - if (!det_routing_arch->write_rr_graph_filename.empty() && !is_flat) { + if (!det_routing_arch.write_rr_graph_filename.empty() && !is_flat) { write_rr_graph(&mutable_device_ctx.rr_graph_builder, &mutable_device_ctx.rr_graph, device_ctx.physical_tile_types, @@ -886,7 +886,7 @@ void create_rr_graph(e_graph_type graph_type, device_ctx.arch_switch_inf, device_ctx.arch, &mutable_device_ctx.chan_width, - det_routing_arch->write_rr_graph_filename.c_str(), + det_routing_arch.write_rr_graph_filename.c_str(), echo_enabled, echo_file_name, is_flat); @@ -1600,7 +1600,7 @@ static void build_intra_cluster_rr_graph(e_graph_type graph_type, is_flat); } -static int get_delayless_switch_id(t_det_routing_arch* det_routing_arch, +static int get_delayless_switch_id(const t_det_routing_arch& det_routing_arch, bool load_rr_graph) { const auto& device_ctx = g_vpr_ctx.device(); int delayless_switch = OPEN; @@ -1614,7 +1614,7 @@ static int get_delayless_switch_id(t_det_routing_arch* det_routing_arch, } } } else { - delayless_switch = static_cast(det_routing_arch->delayless_switch); + delayless_switch = static_cast(det_routing_arch.delayless_switch); } return delayless_switch; diff --git a/vpr/src/route/rr_graph.h b/vpr/src/route/rr_graph.h index 283da1a296..f0ea08e430 100644 --- a/vpr/src/route/rr_graph.h +++ b/vpr/src/route/rr_graph.h @@ -24,7 +24,7 @@ void create_rr_graph(e_graph_type graph_type, const std::vector& block_types, const DeviceGrid& grid, const t_chan_width& nodes_per_chan, - t_det_routing_arch* det_routing_arch, + t_det_routing_arch& det_routing_arch, const std::vector& segment_inf, const t_router_opts& router_opts, const std::vector& directs,