Skip to content

Commit 783fa6b

Browse files
committed
Merge branch 'librrgraph_vpr' of github.com:oscarcheng105/vtr-verilog-to-routing into librrgraph_vpr
2 parents 4a4eb96 + 2aa7ce6 commit 783fa6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3107
-366
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ jobs:
331331
fail-fast: false
332332
matrix:
333333
include:
334-
- { name: 'GCC 7 (Ubuntu Bionic - 18.04)', eval: 'CC=gcc-7 && CXX=g++-7', build: '' }
335-
- { name: 'GCC 8 (Debian Buster)', eval: 'CC=gcc-8 && CXX=g++-8', build: '' }
336-
- { name: 'GCC 9 (Ubuntu Focal - 20.04)', eval: 'CC=gcc-9 && CXX=g++-9', build: '' }
337-
- { name: 'GCC 10 (Ubuntu Hirsute - 21.04)', eval: 'CC=gcc-10 && CXX=g++-10', build: '' }
338-
- { name: 'GCC 11 (Latest)', eval: 'CC=gcc-11 && CXX=g++-11', build: '' }
339-
- { name: 'Clang 6 (Ubuntu Bionic - 18.04)', eval: 'CC=clang-6.0 && CXX=clang++-6.0', build: '' }
340-
- { name: 'Clang 7 (Debian Buster)', eval: 'CC=clang-7 && CXX=clang++-7', build: '' }
341-
- { name: 'Clang 10 (Ubuntu Focal - 20.04)', eval: 'CC=clang-10 && CXX=clang++-10', build: '' }
334+
- { name: 'GCC 7 (Ubuntu Bionic - 18.04)', eval: 'CC=gcc-7 && CXX=g++-7', }
335+
- { name: 'GCC 8 (Debian Buster)', eval: 'CC=gcc-8 && CXX=g++-8', }
336+
- { name: 'GCC 9 (Ubuntu Focal - 20.04)', eval: 'CC=gcc-9 && CXX=g++-9', }
337+
- { name: 'GCC 10 (Ubuntu Hirsute - 21.04)', eval: 'CC=gcc-10 && CXX=g++-10', }
338+
- { name: 'GCC 11 (Latest)', eval: 'CC=gcc-11 && CXX=g++-11', }
339+
- { name: 'Clang 6 (Ubuntu Bionic - 18.04)', eval: 'CC=clang-6.0 && CXX=clang++-6.0', }
340+
- { name: 'Clang 7 (Debian Buster)', eval: 'CC=clang-7 && CXX=clang++-7', }
341+
- { name: 'Clang 10 (Ubuntu Focal - 20.04)', eval: 'CC=clang-10 && CXX=clang++-10', }
342342
name: 'B: ${{ matrix.name }}'
343343
steps:
344344

@@ -354,7 +354,7 @@ jobs:
354354
env:
355355
CMAKE_PARAMS: "-DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on"
356356
MATRIX_EVAL: ${{ matrix.eval }}
357-
BUILD_TYPE: ${{ matrix.build }}
357+
BUILD_TYPE: release
358358
run: |
359359
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
360360
./.github/scripts/build.sh

ODIN_II/main.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "odin_types.h"
33
#include "vtr_time.h"
44
#include "vtr_version.h"
5+
#include <sys/resource.h>
56

67
int main(int argc, char** argv) {
78
vtr::ScopedFinishTimer t("Odin II");
@@ -27,6 +28,19 @@ int main(int argc, char** argv) {
2728
"\n",
2829
vtr::VERSION, vtr::VCS_REVISION, vtr::BUILD_TIMESTAMP, vtr::COMPILER, vtr::BUILD_INFO);
2930

31+
/**
32+
* set stack size to >= 128 MB in linux operating systems to avoid
33+
* stack overflow in recursive routine calls for big benchmarks
34+
*/
35+
#ifdef __linux__
36+
struct rlimit rl;
37+
const rlim_t new_stack_size = 128L * 1024L * 1024L;
38+
if (getrlimit(RLIMIT_STACK, &rl) == 0 && rl.rlim_cur < new_stack_size) {
39+
rl.rlim_cur = new_stack_size;
40+
setrlimit(RLIMIT_STACK, &rl);
41+
}
42+
#endif
43+
3044
netlist_t* odin_netlist = start_odin_ii(argc, argv);
3145
terminate_odin_ii(odin_netlist);
3246
return 0;

libs/libarchfpga/src/arch_util.cpp

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static void free_all_pb_graph_nodes(std::vector<t_logical_block_type>& type_desc
298298
if (type.pb_type) {
299299
if (type.pb_graph_head) {
300300
free_pb_graph(type.pb_graph_head);
301-
vtr::free(type.pb_graph_head);
301+
delete type.pb_graph_head;
302302
}
303303
}
304304
}
@@ -316,78 +316,46 @@ static void free_pb_graph(t_pb_graph_node* pb_graph_node) {
316316
/* Free ports for pb graph node */
317317
for (i = 0; i < pb_graph_node->num_input_ports; i++) {
318318
for (j = 0; j < pb_graph_node->num_input_pins[i]; j++) {
319-
if (pb_graph_node->input_pins[i][j].pin_timing)
320-
vtr::free(pb_graph_node->input_pins[i][j].pin_timing);
321-
if (pb_graph_node->input_pins[i][j].pin_timing_del_max)
322-
vtr::free(pb_graph_node->input_pins[i][j].pin_timing_del_max);
323-
if (pb_graph_node->input_pins[i][j].pin_timing_del_min)
324-
vtr::free(pb_graph_node->input_pins[i][j].pin_timing_del_min);
325-
if (pb_graph_node->input_pins[i][j].input_edges)
326-
vtr::free(pb_graph_node->input_pins[i][j].input_edges);
327-
if (pb_graph_node->input_pins[i][j].output_edges)
328-
vtr::free(pb_graph_node->input_pins[i][j].output_edges);
329319
if (pb_graph_node->input_pins[i][j].parent_pin_class)
330-
vtr::free(pb_graph_node->input_pins[i][j].parent_pin_class);
320+
delete[] pb_graph_node->input_pins[i][j].parent_pin_class;
331321
}
332322
delete[] pb_graph_node->input_pins[i];
333323
}
334324
for (i = 0; i < pb_graph_node->num_output_ports; i++) {
335325
for (j = 0; j < pb_graph_node->num_output_pins[i]; j++) {
336-
if (pb_graph_node->output_pins[i][j].pin_timing)
337-
vtr::free(pb_graph_node->output_pins[i][j].pin_timing);
338-
if (pb_graph_node->output_pins[i][j].pin_timing_del_max)
339-
vtr::free(pb_graph_node->output_pins[i][j].pin_timing_del_max);
340-
if (pb_graph_node->output_pins[i][j].pin_timing_del_min)
341-
vtr::free(pb_graph_node->output_pins[i][j].pin_timing_del_min);
342-
if (pb_graph_node->output_pins[i][j].input_edges)
343-
vtr::free(pb_graph_node->output_pins[i][j].input_edges);
344-
if (pb_graph_node->output_pins[i][j].output_edges)
345-
vtr::free(pb_graph_node->output_pins[i][j].output_edges);
346326
if (pb_graph_node->output_pins[i][j].parent_pin_class)
347-
vtr::free(pb_graph_node->output_pins[i][j].parent_pin_class);
327+
delete[] pb_graph_node->output_pins[i][j].parent_pin_class;
348328

349329
if (pb_graph_node->output_pins[i][j].list_of_connectable_input_pin_ptrs) {
350330
for (k = 0; k < pb_graph_node->pb_type->depth; k++) {
351-
if (pb_graph_node->output_pins[i][j].list_of_connectable_input_pin_ptrs[k]) {
352-
vtr::free(pb_graph_node->output_pins[i][j].list_of_connectable_input_pin_ptrs[k]);
353-
}
331+
delete[] pb_graph_node->output_pins[i][j].list_of_connectable_input_pin_ptrs[k];
354332
}
355-
vtr::free(pb_graph_node->output_pins[i][j].list_of_connectable_input_pin_ptrs);
333+
delete[] pb_graph_node->output_pins[i][j].list_of_connectable_input_pin_ptrs;
356334
}
357335

358336
if (pb_graph_node->output_pins[i][j].num_connectable_primitive_input_pins)
359-
vtr::free(pb_graph_node->output_pins[i][j].num_connectable_primitive_input_pins);
337+
delete[] pb_graph_node->output_pins[i][j].num_connectable_primitive_input_pins;
360338
}
361339
delete[] pb_graph_node->output_pins[i];
362340
}
363341
for (i = 0; i < pb_graph_node->num_clock_ports; i++) {
364342
for (j = 0; j < pb_graph_node->num_clock_pins[i]; j++) {
365-
if (pb_graph_node->clock_pins[i][j].pin_timing)
366-
vtr::free(pb_graph_node->clock_pins[i][j].pin_timing);
367-
if (pb_graph_node->clock_pins[i][j].pin_timing_del_max)
368-
vtr::free(pb_graph_node->clock_pins[i][j].pin_timing_del_max);
369-
if (pb_graph_node->clock_pins[i][j].pin_timing_del_min)
370-
vtr::free(pb_graph_node->clock_pins[i][j].pin_timing_del_min);
371-
if (pb_graph_node->clock_pins[i][j].input_edges)
372-
vtr::free(pb_graph_node->clock_pins[i][j].input_edges);
373-
if (pb_graph_node->clock_pins[i][j].output_edges)
374-
vtr::free(pb_graph_node->clock_pins[i][j].output_edges);
375343
if (pb_graph_node->clock_pins[i][j].parent_pin_class)
376-
vtr::free(pb_graph_node->clock_pins[i][j].parent_pin_class);
344+
delete[] pb_graph_node->clock_pins[i][j].parent_pin_class;
377345
}
378346
delete[] pb_graph_node->clock_pins[i];
379347
}
380348

381-
vtr::free(pb_graph_node->input_pins);
382-
vtr::free(pb_graph_node->output_pins);
383-
vtr::free(pb_graph_node->clock_pins);
349+
delete[] pb_graph_node->input_pins;
350+
delete[] pb_graph_node->output_pins;
351+
delete[] pb_graph_node->clock_pins;
384352

385-
vtr::free(pb_graph_node->num_input_pins);
386-
vtr::free(pb_graph_node->num_output_pins);
387-
vtr::free(pb_graph_node->num_clock_pins);
353+
delete[] pb_graph_node->num_input_pins;
354+
delete[] pb_graph_node->num_output_pins;
355+
delete[] pb_graph_node->num_clock_pins;
388356

389-
vtr::free(pb_graph_node->input_pin_class_size);
390-
vtr::free(pb_graph_node->output_pin_class_size);
357+
delete[] pb_graph_node->input_pin_class_size;
358+
delete[] pb_graph_node->output_pin_class_size;
391359

392360
if (pb_graph_node->interconnect_pins) {
393361
for (i = 0; i < pb_graph_node->pb_type->num_modes; i++) {
@@ -403,19 +371,19 @@ static void free_pb_graph(t_pb_graph_node* pb_graph_node) {
403371

404372
t_interconnect_power* interconn_power = interconn->interconnect_power;
405373
for (int iport = 0; iport < interconn_power->num_input_ports; ++iport) {
406-
vtr::free(pb_graph_node->interconnect_pins[i][j].input_pins[iport]);
374+
delete[] pb_graph_node->interconnect_pins[i][j].input_pins[iport];
407375
}
408376
for (int iport = 0; iport < interconn_power->num_output_ports; ++iport) {
409-
vtr::free(pb_graph_node->interconnect_pins[i][j].output_pins[iport]);
377+
delete[] pb_graph_node->interconnect_pins[i][j].output_pins[iport];
410378
}
411-
vtr::free(pb_graph_node->interconnect_pins[i][j].input_pins);
412-
vtr::free(pb_graph_node->interconnect_pins[i][j].output_pins);
379+
delete[] pb_graph_node->interconnect_pins[i][j].input_pins;
380+
delete[] pb_graph_node->interconnect_pins[i][j].output_pins;
413381
}
414-
vtr::free(pb_graph_node->interconnect_pins[i]);
382+
delete[] pb_graph_node->interconnect_pins[i];
415383
}
416384
}
417-
vtr::free(pb_graph_node->interconnect_pins);
418-
vtr::free(pb_graph_node->pb_node_power);
385+
delete[] pb_graph_node->interconnect_pins;
386+
delete pb_graph_node->pb_node_power;
419387

420388
for (i = 0; i < pb_type->num_modes; i++) {
421389
for (j = 0; j < pb_type->modes[i].num_pb_type_children; j++) {

libs/libarchfpga/src/physical_types.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,9 +1235,9 @@ class t_pb_graph_pin {
12351235
public:
12361236
t_port* port = nullptr;
12371237
int pin_number = 0;
1238-
t_pb_graph_edge** input_edges = nullptr; /* [0..num_input_edges] */
1238+
std::vector<t_pb_graph_edge*> input_edges; /* [0..num_input_edges] */
12391239
int num_input_edges = 0;
1240-
t_pb_graph_edge** output_edges = nullptr; /* [0..num_output_edges] */
1240+
std::vector<t_pb_graph_edge*> output_edges; /* [0..num_output_edges] */
12411241
int num_output_edges = 0;
12421242

12431243
t_pb_graph_node* parent_node = nullptr;
@@ -1256,9 +1256,9 @@ class t_pb_graph_pin {
12561256

12571257
/* combinational timing information */
12581258
int num_pin_timing = 0; /* Number of ipin to opin timing edges*/
1259-
t_pb_graph_pin** pin_timing = nullptr; /* timing edge sink pins [0..num_pin_timing-1]*/
1260-
float* pin_timing_del_max = nullptr; /* primitive ipin to opin max-delay [0..num_pin_timing-1]*/
1261-
float* pin_timing_del_min = nullptr; /* primitive ipin to opin min-delay [0..num_pin_timing-1]*/
1259+
std::vector<t_pb_graph_pin*> pin_timing; /* timing edge sink pins [0..num_pin_timing-1]*/
1260+
std::vector<float> pin_timing_del_max; /* primitive ipin to opin max-delay [0..num_pin_timing-1]*/
1261+
std::vector<float> pin_timing_del_min; /* primitive ipin to opin min-delay [0..num_pin_timing-1]*/
12621262
int num_pin_timing_del_max_annotated = 0; //The list of valid pin_timing_del_max entries runs from [0..num_pin_timing_del_max_annotated-1]
12631263
int num_pin_timing_del_min_annotated = 0; //The list of valid pin_timing_del_max entries runs from [0..num_pin_timing_del_min_annotated-1]
12641264

@@ -1333,7 +1333,7 @@ class t_pb_graph_edge {
13331333

13341334
/* pack pattern info */
13351335
int num_pack_patterns;
1336-
const char** pack_pattern_names;
1336+
std::vector<const char*> pack_pattern_names;
13371337
int* pack_pattern_indices;
13381338
bool infer_pattern;
13391339

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4672,7 +4672,7 @@ static void processTopology(pugi::xml_node topology_tag, const pugiutil::loc_dat
46724672
/**
46734673
* Stores router information that includes the number of connections a router has within a given topology and also the number of times a router was declared in the arch file using the <router> tag.
46744674
* In the datastructure below, the router id is the key and the stored data is a pair, where the first element describes the number of router declarations and the second element describes the number of router connections.
4675-
* This is used only for erro checking.
4675+
* This is used only for error checking.
46764676
*/
46774677
std::map<int, std::pair<int, int>> routers_in_arch_info;
46784678

libs/libvtrutil/src/vtr_memory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "vtr_memory.h"
77
#include "vtr_error.h"
88
#include "vtr_util.h"
9+
#include "vtr_log.h"
910

1011
#ifndef __GLIBC__
1112
# include <stdlib.h>

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ static void SetupPowerOpts(const t_options& Options, t_power_opts* power_opts, t
665665
static void SetupNocOpts(const t_options& Options, t_noc_opts* NocOpts) {
666666
// assign the noc specific options from the command line
667667
NocOpts->noc = Options.noc;
668+
NocOpts->noc_flows_file = Options.noc_flows_file;
668669

669670
return;
670671
}

vpr/src/base/ShowSetup.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ static void ShowPlacerOpts(const t_placer_opts& PlacerOpts,
2020
const t_annealing_sched& AnnealSched);
2121
static void ShowRouterOpts(const t_router_opts& RouterOpts);
2222
static void ShowAnalysisOpts(const t_analysis_opts& AnalysisOpts);
23+
static void ShowNocOpts(const t_noc_opts& NocOpts);
2324

2425
static void ShowAnnealSched(const t_annealing_sched& AnnealSched);
2526

@@ -61,6 +62,9 @@ void ShowSetup(const t_vpr_setup& vpr_setup) {
6162
if (vpr_setup.AnalysisOpts.doAnalysis) {
6263
ShowAnalysisOpts(vpr_setup.AnalysisOpts);
6364
}
65+
if (vpr_setup.NocOpts.noc) {
66+
ShowNocOpts(vpr_setup.NocOpts);
67+
}
6468
}
6569

6670
void ClusteredNetlistStats::writeHuman(std::ostream& output) const {
@@ -764,3 +768,10 @@ static void ShowPackerOpts(const t_packer_opts& PackerOpts) {
764768
VTR_LOG("\n");
765769
VTR_LOG("\n");
766770
}
771+
772+
static void ShowNocOpts(const t_noc_opts& NocOpts) {
773+
VTR_LOG("NocOpts.noc_flows_file: %s\n", NocOpts.noc_flows_file.c_str());
774+
VTR_LOG("\n");
775+
776+
// add future options here (routing algorithm etc...)
777+
}

vpr/src/base/clustered_netlist.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,17 @@ bool ClusteredNetlist::validate_net_sizes_impl(size_t num_nets) const {
306306
}
307307
return true;
308308
}
309+
310+
ClusterBlockId ClusteredNetlist::find_block_by_name_fragment(const std::string& name_pattern, const std::vector<ClusterBlockId>& cluster_block_candidates) const {
311+
ClusterBlockId blk_id = ClusterBlockId::INVALID();
312+
std::regex name_to_match(name_pattern);
313+
314+
for (auto compatible_block_id = cluster_block_candidates.begin(); compatible_block_id != cluster_block_candidates.end(); compatible_block_id++) {
315+
if (std::regex_match(Netlist::block_name(*compatible_block_id), name_to_match)) {
316+
blk_id = *compatible_block_id;
317+
break;
318+
}
319+
}
320+
321+
return blk_id;
322+
}

vpr/src/base/clustered_netlist.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,77 @@ class ClusteredNetlist : public Netlist<ClusterBlockId, ClusterPortId, ClusterPi
228228
///@brief Sets the flag in net_is_global_ = state
229229
void set_net_is_global(ClusterNetId net_id, bool state);
230230

231+
/**
232+
* @brief Given a name of a block and vector of possible cluster blocks
233+
* that are candidates to match the block name, go through
234+
* the vector of cluster blocks and return the id of the block
235+
* where the block name matches the provided name.
236+
*
237+
* Given a string pattern representing a block name and a vector of
238+
* poissble cluster blocks that are candidates to match to the block
239+
* name pattern, go through the vector of cluster blocks and return
240+
* the id of the block where the block name matches to the provided
241+
* input pattern.
242+
*
243+
*/
244+
245+
/**
246+
* @brief The intented use is to find the block id of a
247+
* hard block without knowing its name in the netlist. Instead
248+
* a pattern can be created that we know the block's name will
249+
* match to. Generally, we expect the pattern to be constructed
250+
* using the block's module name in the HDL design, since we can
251+
* expect the netlist name of the block to include the module
252+
* name within it.
253+
*
254+
* For example, suppose a RAM block was named in the netlist as
255+
* "top|alu|test_ram|out". The user instantiated the ram module
256+
* in the HDL design as "test_ram". So instead of going through
257+
* the netlist and finding the ram block's full name, this
258+
* function can be used by just providing the string pattern as
259+
* ".*test_ram.*". We know that the module name should be somewhere
260+
* within the string, so the pattern we provide says that the netlist
261+
* name of the block contains arbritary characters then the module
262+
* name and then some other arbritary characters after.
263+
* This pattern will then be used to match to the block in the
264+
* netlist. The matched cluster block id is returned, and if no
265+
* block matched to the input string then an invalid block id
266+
* is returned.
267+
*
268+
* The function
269+
* here additionally requires a vector of possible cluster blocks
270+
* that can match to the input pattern. This vector can be the
271+
* entire netlist or a subset. For example, if the intended use
272+
* is to find hard blocks, it is quite inefficient
273+
* to go through all the blocks to find a matching one. Instead, a
274+
* a filtered vector can be passed that is a subset of the entire
275+
* netlist and can only contain blocks of a certain logical block
276+
* type (blocks that can be placed on a specific hard block).
277+
* The idea here is that the filtered vector should be
278+
* considereably smaller that a vector of every block in the netlist
279+
* and this should help improve run time.
280+
*
281+
* This function runs in linear time (O(N)) as it goes over the
282+
* vector of 'cluster_block_candidates'. 'cluster_block_candidates'
283+
* could be the whole netlist or a subset as explained above.
284+
* Additionally, if there are multiple
285+
* blocks that match to the provided input pattern, then the
286+
* first block found is returned.
287+
*
288+
*
289+
* @param name_pattern A regex string pattern that can be used to match to
290+
* a clustered block name within the netlist.
291+
* @param cluster_block_candidates A vector of clustered block ids that
292+
* represent a subset of the clustered
293+
* netlist. The blocks in this vector
294+
* will be used to compare and match
295+
* to the input string pattern.
296+
* @return A cluster block id representing a unique cluster block that
297+
* matched to the input string pattern.
298+
*
299+
*/
300+
ClusterBlockId find_block_by_name_fragment(const std::string& name_pattern, const std::vector<ClusterBlockId>& cluster_block_candidates) const;
301+
231302
private: //Private Members
232303
/*
233304
* Netlist compression/optimization

vpr/src/base/echo_files.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ void alloc_and_load_echo_file_info() {
132132

133133
//NoC
134134
setEchoFileName(E_ECHO_NOC_MODEL, "noc_model.echo");
135+
setEchoFileName(E_ECHO_NOC_TRAFFIC_FLOWS, "noc_traffic_flows.echo");
135136
}
136137

137138
void free_echo_file_info() {

vpr/src/base/echo_files.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ enum e_echo_files {
6565

6666
//NoC
6767
E_ECHO_NOC_MODEL,
68+
E_ECHO_NOC_TRAFFIC_FLOWS,
6869

6970
E_ECHO_END_TOKEN
7071
};

0 commit comments

Comments
 (0)