Skip to content

Commit f0c0ba1

Browse files
committed
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-verilog-to-routing into subtile_pin_loc
2 parents e45b456 + f81a1bf commit f0c0ba1

File tree

17 files changed

+116
-86
lines changed

17 files changed

+116
-86
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,14 @@ Analytical Placement is generally split into three stages:
13241324

13251325
**Default:** ``auto``
13261326

1327+
.. option:: --ap_high_fanout_threshold <int>
1328+
1329+
Defines the threshold for high fanout nets within AP flow.
1330+
1331+
Ignores the nets that have higher fanouts than the threshold for the analytical solver.
1332+
1333+
**Default:** ``256``
1334+
13271335
.. option:: --ap_verbosity <int>
13281336

13291337
Controls the verbosity of the AP flow output.

doc/src/vtr/run_vtr_flow.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ Enable Synlig tool with the ``-DSYNLIG_SYSTEMVERILOG=ON`` compile flag for the P
9090
9191
Will run the VTR flow (default configuration) with Yosys frontend using Parmys plugin as partial mapper. To utilize the Parmys plugin, the ``-DYOSYS_PARMYS_PLUGIN=ON`` compile flag should be passed while building the VTR project with Yosys as a frontend.
9292

93+
.. code-block:: bash
94+
95+
# Using the Parmys (Partial Mapper for Yosys) plugin as partial mapper with include files
96+
./run_vtr_flow <path/to/Verilog/File> <path/to/arch/file> -include <path/to/include/directory>/*.v*
97+
98+
Will run the VTR flow (default configuration) with Yosys frontend using Parmys plugin as partial mapper. In addition to the main circuit passed in with the architecture, it will also pass in every HDL file with the specified file type within the include directory.
99+
93100
Detailed Command-line Options
94101
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95102

@@ -123,6 +130,15 @@ Detailed Command-line Options
123130
* ``vpr``
124131

125132
**Default:** ``vpr``
133+
134+
.. option:: -include <path_to_file(s)>/*.<file_type(s)>
135+
136+
List of include files to a benchmark circuit
137+
(pass to VTR frontends as a benchmark design set).
138+
139+
Include files can be any file supported by yosys+parmys (normally .v or .vh files).
140+
141+
The include directory should not contain the circuit passed in with the architecture.
126142

127143
.. option:: -power
128144

libs/libvtrutil/src/vtr_util.cpp

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -375,67 +375,6 @@ char* fgets(char* buf, int max_size, FILE* fp) {
375375
return nullptr;
376376
}
377377

378-
/**
379-
* @brief to get an arbitrary long input line and cut off any
380-
* comment part
381-
*
382-
* the getline function is exaly like the __get_delim function
383-
* in GNU with '\n' delimiter. As a result, to make the function
384-
* behaviour identical for Windows (\r\n) and Linux (\n) compiler
385-
* macros for checking operating systems have been used.
386-
*
387-
* @note user need to take care of the given pointer,
388-
* which will be dynamically allocated by getdelim
389-
*/
390-
char* getline(char*& _lineptr, FILE* _stream) {
391-
int i;
392-
int ch;
393-
size_t _n = 0;
394-
ssize_t nread;
395-
396-
#if defined(__unix__)
397-
nread = getdelim(&_lineptr, &_n, '\n', _stream);
398-
#elif defined(_WIN32)
399-
#define __WIN_NLTK "\r\n"
400-
nread = getdelim(&_lineptr, &_n, __WIN_NLTK, _stream);
401-
#endif
402-
403-
if (nread == -1) {
404-
int errsv = errno;
405-
std::string error_msg;
406-
407-
if (errsv == EINVAL)
408-
error_msg = string_fmt("[%s] Bad arguments (_lineptr is NULL, or _stream is not valid).", strerror(errsv));
409-
else if (errsv == ENOMEM)
410-
error_msg = string_fmt("[%s] Allocation or reallocation of the line buffer failed.", strerror(errsv));
411-
else
412-
/* end of file so it will return null */
413-
return nullptr;
414-
415-
/* getline was unsuccessful, so error */
416-
throw VtrError(string_fmt("Error -- %s\n",
417-
error_msg.c_str()),
418-
__FILE__, __LINE__);
419-
return nullptr;
420-
}
421-
422-
cont = 0; /* line continued? */
423-
file_line_number++; /* global variable */
424-
425-
for (i = 0; i < nread; i++) { /* Keep going until the line finishes */
426-
427-
ch = _lineptr[i];
428-
429-
if (ch == '#') { /* comment */
430-
_lineptr[i] = '\0';
431-
/* skip the rest of the line */
432-
break;
433-
}
434-
}
435-
436-
return (_lineptr);
437-
}
438-
439378
///@brief Returns line number of last opened and read file
440379
int get_file_line_number_of_last_opened_file() {
441380
return file_line_number;

vpr/src/analytical_place/analytical_placement_flow.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
170170
const AtomNetlist& atom_nlist = g_vpr_ctx.atom().netlist();
171171
const DeviceContext& device_ctx = g_vpr_ctx.device();
172172
const UserPlaceConstraints& constraints = g_vpr_ctx.floorplanning().constraints;
173+
const t_ap_opts& ap_opts = vpr_setup.APOpts;
173174

174175
// Run the prepacker
175176
const Prepacker prepacker(atom_nlist, device_ctx.arch->models, device_ctx.logical_block_types);
@@ -178,7 +179,8 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
178179
// prepacker.
179180
APNetlist ap_netlist = gen_ap_netlist_from_atoms(atom_nlist,
180181
prepacker,
181-
constraints);
182+
constraints,
183+
ap_opts.ap_high_fanout_threshold);
182184
print_ap_netlist_stats(ap_netlist);
183185

184186
// Pre-compute the pre-clustering timing delays. This object will be passed
@@ -208,7 +210,6 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
208210
}
209211

210212
// Run the Global Placer.
211-
const t_ap_opts& ap_opts = vpr_setup.APOpts;
212213
PartialPlacement p_placement = run_global_placer(ap_opts,
213214
atom_nlist,
214215
ap_netlist,

vpr/src/analytical_place/gen_ap_netlist_from_atoms.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
APNetlist gen_ap_netlist_from_atoms(const AtomNetlist& atom_netlist,
2626
const Prepacker& prepacker,
27-
const UserPlaceConstraints& constraints) {
27+
const UserPlaceConstraints& constraints,
28+
int high_fanout_threshold) {
2829
// Create a scoped timer for reading the atom netlist.
2930
vtr::ScopedStartFinishTimer timer("Read Atom Netlist to AP Netlist");
3031

@@ -115,6 +116,7 @@ APNetlist gen_ap_netlist_from_atoms(const AtomNetlist& atom_netlist,
115116
// - a global net
116117
// - connected to 1 or fewer unique blocks
117118
// - connected to only fixed blocks
119+
// - having fanout higher than threshold
118120
for (APNetId ap_net_id : ap_netlist.nets()) {
119121
// Is the net ignored for placement, if so mark as ignored for AP.
120122
const std::string& net_name = ap_netlist.net_name(ap_net_id);
@@ -153,6 +155,13 @@ APNetlist gen_ap_netlist_from_atoms(const AtomNetlist& atom_netlist,
153155
ap_netlist.set_net_is_ignored(ap_net_id, true);
154156
continue;
155157
}
158+
// If fanout number of the net is higher than the threshold, mark as ignored for AP.
159+
size_t num_pins = ap_netlist.net_pins(ap_net_id).size();
160+
VTR_ASSERT_DEBUG(num_pins > 1);
161+
if (num_pins - 1 > static_cast<size_t>(high_fanout_threshold)) {
162+
ap_netlist.set_net_is_ignored(ap_net_id, true);
163+
continue;
164+
}
156165
}
157166
ap_netlist.compress();
158167

vpr/src/analytical_place/gen_ap_netlist_from_atoms.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ class UserPlaceConstraints;
1616
/**
1717
* @brief Use the results from prepacking the atom netlist to generate an APNetlist.
1818
*
19-
* @param atom_netlist The atom netlist for the input design.
20-
* @param prepacker The prepacker, initialized on the provided atom netlist.
21-
* @param constraints The placement constraints on the Atom blocks, provided
22-
* by the user.
19+
* @param atom_netlist The atom netlist for the input design.
20+
* @param prepacker The prepacker, initialized on the provided atom netlist.
21+
* @param constraints The placement constraints on the Atom blocks, provided
22+
* by the user.
23+
* @param high_fanout_threshold The threshold above which nets with higher fanout will
24+
* be ignored.
2325
*
2426
* @return An APNetlist object, generated from the prepacker results.
2527
*/
2628
APNetlist gen_ap_netlist_from_atoms(const AtomNetlist& atom_netlist,
2729
const Prepacker& prepacker,
28-
const UserPlaceConstraints& constraints);
30+
const UserPlaceConstraints& constraints,
31+
int high_fanout_threshold);

vpr/src/analytical_place/global_placer.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,19 @@ SimPLGlobalPlacer::SimPLGlobalPlacer(e_ap_analytical_solver analytical_solver_ty
124124
*/
125125
static void print_placement_stats(const PartialPlacement& p_placement,
126126
const APNetlist& ap_netlist,
127-
FlatPlacementDensityManager& density_manager) {
127+
FlatPlacementDensityManager& density_manager,
128+
const PreClusterTimingManager& pre_cluster_timing_manager) {
128129
// Print the placement HPWL
129130
VTR_LOG("\tPlacement HPWL: %f\n", p_placement.get_hpwl(ap_netlist));
130131

132+
// Print the timing information.
133+
if (pre_cluster_timing_manager.is_valid()) {
134+
float cpd_ns = pre_cluster_timing_manager.get_timing_info().least_slack_critical_path().delay() * 1e9;
135+
float stns_ns = pre_cluster_timing_manager.get_timing_info().setup_total_negative_slack() * 1e9;
136+
VTR_LOG("\tPlacement estimated CPD: %f ns\n", cpd_ns);
137+
VTR_LOG("\tPlacement estimated sTNS: %f ns\n", stns_ns);
138+
}
139+
131140
// Print density information. Need to reset the density manager to ensure
132141
// the data is valid.
133142
density_manager.import_placement_into_bins(p_placement);
@@ -424,7 +433,8 @@ PartialPlacement SimPLGlobalPlacer::place() {
424433
VTR_LOG("Placement after Global Placement:\n");
425434
print_placement_stats(best_p_placement,
426435
ap_netlist_,
427-
*density_manager_);
436+
*density_manager_,
437+
pre_cluster_timing_manager_);
428438

429439
// Return the placement from the final iteration.
430440
return best_p_placement;

vpr/src/base/CheckSetup.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ void CheckSetup(const t_packer_opts& packer_opts,
8888
"ap_timing_tradeoff expects a value between 0.0 and 1.0");
8989
}
9090

91+
// Make sure that the high fanout threshold for solver is valid.
92+
if (ap_opts.ap_high_fanout_threshold <= 1) {
93+
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
94+
"ap_high_fanout_threshold should be greater than 1");
95+
}
96+
9197
// TODO: Should we enforce that the size of the device is fixed. This
9298
// goes with ensuring that some blocks are fixed.
9399
}

vpr/src/base/SetupVPR.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ void SetupAPOpts(const t_options& options,
558558
apOpts.full_legalizer_type = options.ap_full_legalizer.value();
559559
apOpts.detailed_placer_type = options.ap_detailed_placer.value();
560560
apOpts.ap_timing_tradeoff = options.ap_timing_tradeoff.value();
561+
apOpts.ap_high_fanout_threshold = options.ap_high_fanout_threshold.value();
561562
apOpts.appack_max_dist_th = options.appack_max_dist_th.value();
562563
apOpts.num_threads = options.num_workers.value();
563564
apOpts.log_verbosity = options.ap_verbosity.value();
@@ -720,6 +721,7 @@ static void SetupAnalysisOpts(const t_options& Options, t_analysis_opts& analysi
720721

721722
analysis_opts.timing_update_type = Options.timing_update_type;
722723
analysis_opts.write_timing_summary = Options.write_timing_summary;
724+
analysis_opts.skip_sync_clustering_and_routing_results = Options.skip_sync_clustering_and_routing_results;
723725
analysis_opts.generate_net_timing_report = Options.generate_net_timing_report;
724726
}
725727

vpr/src/base/ShowSetup.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ static void ShowAnalyticalPlacerOpts(const t_ap_opts& APOpts) {
656656
}
657657

658658
VTR_LOG("AnalyticalPlacerOpts.ap_timing_tradeoff: %f\n", APOpts.ap_timing_tradeoff);
659+
VTR_LOG("AnalyticalPlacerOpts.ap_high_fanout_threshold: %d\n", APOpts.ap_high_fanout_threshold);
659660
VTR_LOG("AnalyticalPlacerOpts.log_verbosity: %d\n", APOpts.log_verbosity);
660661
}
661662

0 commit comments

Comments
 (0)