1+
2+
3+ #include " PlacementDelayModelCreator.h"
4+
5+ #include " place_delay_model.h"
6+ #include " simple_delay_model.h"
7+ #include " delta_delay_model.h"
8+ #include " override_delay_model.h"
9+
10+ #include " vtr_time.h"
11+ #include " physical_types.h"
12+ #include " place_and_route.h"
13+
14+ static int get_longest_segment_length (std::vector<t_segment_inf>& segment_inf) {
15+ int length = 0 ;
16+
17+ for (const t_segment_inf& seg_info : segment_inf) {
18+ if (seg_info.length > length) {
19+ length = seg_info.length ;
20+ }
21+ }
22+
23+ return length;
24+ }
25+
26+ std::unique_ptr<PlaceDelayModel>
27+ PlacementDelayModelCreator::create_delay_model (const t_placer_opts& placer_opts,
28+ const t_router_opts& router_opts,
29+ const Netlist<>& net_list,
30+ t_det_routing_arch* det_routing_arch,
31+ std::vector<t_segment_inf>& segment_inf,
32+ t_chan_width_dist chan_width_dist,
33+ const std::vector<t_direct_inf>& directs,
34+ bool is_flat) {
35+ vtr::ScopedStartFinishTimer timer (" Computing placement delta delay look-up" );
36+
37+ t_chan_width chan_width = setup_chan_width (router_opts, chan_width_dist);
38+
39+ alloc_routing_structs (chan_width, router_opts, det_routing_arch, segment_inf, directs, is_flat);
40+
41+ const RouterLookahead* router_lookahead = get_cached_router_lookahead (*det_routing_arch,
42+ router_opts.lookahead_type ,
43+ router_opts.write_router_lookahead ,
44+ router_opts.read_router_lookahead ,
45+ segment_inf,
46+ is_flat);
47+
48+ RouterDelayProfiler route_profiler (net_list, router_lookahead, is_flat);
49+
50+ int longest_length = get_longest_segment_length (segment_inf);
51+
52+ // now setup and compute the actual arrays
53+ std::unique_ptr<PlaceDelayModel> place_delay_model;
54+ float min_cross_layer_delay = get_min_cross_layer_delay ();
55+
56+ if (placer_opts.delay_model_type == PlaceDelayModelType::SIMPLE) {
57+ place_delay_model = std::make_unique<SimpleDelayModel>();
58+ } else if (placer_opts.delay_model_type == PlaceDelayModelType::DELTA) {
59+ place_delay_model = std::make_unique<DeltaDelayModel>(min_cross_layer_delay, is_flat);
60+ } else if (placer_opts.delay_model_type == PlaceDelayModelType::DELTA_OVERRIDE) {
61+ place_delay_model = std::make_unique<OverrideDelayModel>(min_cross_layer_delay, is_flat);
62+ } else {
63+ VTR_ASSERT_MSG (false , " Invalid placer delay model" );
64+ }
65+
66+ if (placer_opts.read_placement_delay_lookup .empty ()) {
67+ place_delay_model->compute (route_profiler, placer_opts, router_opts, longest_length);
68+ } else {
69+ place_delay_model->read (placer_opts.read_placement_delay_lookup );
70+ }
71+
72+ if (!placer_opts.write_placement_delay_lookup .empty ()) {
73+ place_delay_model->write (placer_opts.write_placement_delay_lookup );
74+ }
75+
76+ // free all data structures that are no longer needed
77+ free_routing_structs ();
78+
79+ return place_delay_model;
80+ }
0 commit comments