Skip to content

Commit b05a0da

Browse files
committed
Resolving merge conflicts
2 parents 0476117 + 549ef96 commit b05a0da

File tree

132 files changed

+7821
-6596
lines changed

Some content is hidden

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

132 files changed

+7821
-6596
lines changed

README.developers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ To submit a build to coverity do the following:
115115

116116
1. [Download](https://scan.coverity.com/download) the coverity build tool
117117

118-
2. Configure VTR to perform a *debug* build. This ensures that all assertions are enabled, without assertions coverity may report bugs that are gaurded against by assertions.
118+
2. Configure VTR to perform a *debug* build. This ensures that all assertions are enabled, without assertions coverity may report bugs that are gaurded against by assertions. We also set VTR asserts to the highest level.
119119

120120
```shell
121121
#From the VTR root
122122
mkdir -p build
123123
cd build
124-
CC=gcc CXX=g++ cmake -DCMAKE_BUILD_TYPE=debug ..
124+
CC=gcc CXX=g++ cmake -DCMAKE_BUILD_TYPE=debug -DVTR_ASSERT_LEVEL=3 ..
125125
```
126126

127127
Note that we explicitly asked for gcc and g++, the coverity build tool defaults to these compilers, and may not like the default 'cc' or 'c++' (even if they are linked to gcc/g++).
@@ -136,7 +136,7 @@ Note that we explicitly asked for gcc and g++, the coverity build tool defaults
136136
4. Archive the output directory
137137

138138
```shell
139-
tar -czvf cov-int vtr_coverity.tar.gz
139+
tar -czvf vtr_coverity.tar.gz cov-int
140140
```
141141

142142
5. Submit the archive through the coverity web interface

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@ Professors: Kenneth Kent, Vaughn Betz, Jonathan Rose, Jason Anderson, Peter Jami
9393

9494
Graduate Students: Kevin Murray, Jason Luu, Oleg Petelin, Jeffrey Goeders, Chi Wai Yu, Andrew Somerville, Ian Kuon, Alexander Marquardt, Andy Ye, Wei Mark Fang, Tim Liu, Charles Chiasson, Panagiotis (Panos) Patros
9595

96-
Summer Students: Opal Densmore, Ted Campbell, Cong Wang, Peter Milankov, Scott Whitty, Michael Wainberg, Suya Liu, Miad Nasr, Nooruddin Ahmed, Thien Yu, Long Yu Wang, Matthew J.P. Walker, Amer Hesson, Sheng Zhong, Hanqing Zeng, Vidya Sankaranarayanan, Eugene Sha
96+
Summer Students: Opal Densmore, Ted Campbell, Cong Wang, Peter Milankov, Scott Whitty, Michael Wainberg, Suya Liu, Miad Nasr, Nooruddin Ahmed, Thien Yu, Long Yu Wang, Matthew J.P. Walker, Amer Hesson, Sheng Zhong, Hanqing Zeng, Vidya Sankaranarayanan, Jia Min Wang, Eugene Sha
9797

9898
Companies: Altera Corporation, Texas Instruments

libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#include "vtr_assert.h"
5050
#include "vtr_log.h"
5151
#include "vtr_util.h"
52-
#include "vtr_matrix.h"
52+
#include "vtr_memory.h"
5353
#include "vtr_digest.h"
5454

5555
#include "arch_types.h"

libvtrutil/src/vtr_matrix.cpp

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "vtr_matrix.h"
55
#include "vtr_util.h"
66
#include "vtr_error.h"
7+
#include "vtr_memory.h"
78

89
namespace vtr {
910

@@ -17,70 +18,10 @@ void free_ivec_vector(t_ivec *ivec_vector, int nrmin, int nrmax) {
1718
if (ivec_vector[i].nelem != 0)
1819
free(ivec_vector[i].list);
1920

20-
//coverity[offset_free]
21+
// coverity[offset_free]
2122
free(ivec_vector + nrmin);
2223
}
2324

24-
void free_ivec_matrix(t_ivec **ivec_matrix, int nrmin, int nrmax,
25-
int ncmin, int ncmax) {
26-
27-
/* Frees a 2D matrix of integer vectors (ivecs). */
28-
29-
int i, j;
30-
31-
for (i = nrmin; i <= nrmax; i++) {
32-
for (j = ncmin; j <= ncmax; j++) {
33-
if (ivec_matrix[i][j].nelem != 0) {
34-
free(ivec_matrix[i][j].list);
35-
}
36-
}
37-
}
38-
39-
vtr::free_matrix(ivec_matrix, nrmin, nrmax, ncmin);
40-
}
41-
42-
void free_ivec_matrix3(t_ivec ***ivec_matrix3, int nrmin, int nrmax,
43-
int ncmin, int ncmax, int ndmin, int ndmax) {
44-
45-
/* Frees a 3D matrix of integer vectors (ivecs). */
46-
47-
int i, j, k;
48-
49-
for (i = nrmin; i <= nrmax; i++) {
50-
for (j = ncmin; j <= ncmax; j++) {
51-
for (k = ndmin; k <= ndmax; k++) {
52-
if (ivec_matrix3[i][j][k].nelem != 0) {
53-
free(ivec_matrix3[i][j][k].list);
54-
}
55-
}
56-
}
57-
}
58-
59-
vtr::free_matrix3(ivec_matrix3, nrmin, nrmax, ncmin, ncmax, ndmin);
60-
}
61-
62-
void print_int_matrix3(int ***vptr, int nrmin, int nrmax, int ncmin, int ncmax,
63-
int ndmin, int ndmax, char *file) {
64-
FILE *outfile;
65-
int i, j, k;
66-
67-
outfile = vtr::fopen(file, "w");
68-
69-
for (k = nrmin; k <= nrmax; ++k) {
70-
fprintf(outfile, "Plane %d\n", k);
71-
for (j = ncmin; j <= ncmax; ++j) {
72-
for (i = ndmin; i <= ndmax; ++i) {
73-
fprintf(outfile, "%d ", vptr[k][j][i]);
74-
}
75-
fprintf(outfile, "\n");
76-
}
77-
fprintf(outfile, "\n");
78-
}
79-
80-
vtr::fclose(outfile);
81-
}
82-
83-
8425
void alloc_ivector_and_copy_int_list(t_linked_int ** list_head_ptr,
8526
int num_items, t_ivec *ivec, t_linked_int ** free_list_head_ptr) {
8627

libvtrutil/src/vtr_matrix.h

Lines changed: 1 addition & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -4,142 +4,13 @@
44
#include <cstdlib>
55

66
#include "vtr_list.h"
7-
#include "vtr_memory.h"
8-
#include "vtr_assert.h"
97

108
namespace vtr {
119

12-
template<typename T>
13-
T** alloc_matrix(int nrmin, int nrmax, int ncmin, int ncmax) {
14-
/* allocates an generic matrix with nrmax-nrmin + 1 rows and ncmax - *
15-
* ncmin + 1 columns, with each element of size elsize. i.e. *
16-
* returns a pointer to a storage block [nrmin..nrmax][ncmin..ncmax].*/
17-
18-
int i;
19-
T** ptr;
20-
21-
int nrows = nrmax - nrmin + 1;
22-
int ncols = ncmax - ncmin + 1;
23-
24-
VTR_ASSERT_MSG(nrows >= 0, "Allocated matrix must have zero-or-more rows");
25-
VTR_ASSERT_MSG(ncols >= 0, "Allocated matrix must have zero-or-more columns");
26-
27-
ptr = (T**) vtr::malloc(nrows * sizeof(T*));
28-
ptr -= nrmin;
29-
for (i = nrmin; i <= nrmax; i++) {
30-
ptr[i] = (T *) vtr::malloc(ncols * sizeof(T));
31-
ptr[i] -= ncmin;
32-
}
33-
return ptr;
34-
}
35-
36-
template<typename T>
37-
T*** alloc_matrix3(int nrmin, int nrmax, int ncmin, int ncmax, int ndmin, int ndmax) {
38-
/* allocates a 3D generic matrix with nrmax-nrmin + 1 rows, ncmax - *
39-
* ncmin + 1 columns, and a depth of ndmax-ndmin + 1, with each *
40-
* element of size elsize. i.e. returns a pointer to a storage block *
41-
* [nrmin..nrmax][ncmin..ncmax][ndmin..ndmax]. */
42-
43-
int i;
44-
T*** ptr;
45-
46-
int nrows = nrmax - nrmin + 1;
47-
VTR_ASSERT_MSG(nrows >= 0, "Allocated matrix must have zero-or-more rows");
48-
49-
ptr = (T***) vtr::malloc(nrows * sizeof(T**));
50-
ptr -= nrmin;
51-
for (i = nrmin; i <= nrmax; i++) {
52-
ptr[i] = alloc_matrix<T>(ncmin, ncmax, ndmin, ndmax);
53-
}
54-
return ptr;
55-
}
56-
57-
template<typename T>
58-
T**** alloc_matrix4(int nrmin, int nrmax, int ncmin, int ncmax, int ndmin, int ndmax,
59-
int nemin, int nemax) {
60-
61-
/* allocates a 4D generic matrix. Returns a pointer to a storage block *
62-
* [nrmin..nrmax][ncmin..ncmax][ndmin..ndmax][nemin..nemax]. */
63-
int i;
64-
T ****ptr;
65-
66-
int nrows = nrmax - nrmin + 1;
67-
VTR_ASSERT_MSG(nrows >= 0, "Allocated matrix must have zero-or-more rows");
68-
69-
ptr = (T ****) vtr::malloc(nrows * sizeof(T ***));
70-
ptr -= nrmin;
71-
for (i = nrmin; i <= nrmax; i++) {
72-
ptr[i] = alloc_matrix3<T>(ncmin, ncmax, ndmin, ndmax, nemin, nemax);
73-
}
74-
return ptr;
75-
}
76-
77-
template<typename T>
78-
T***** alloc_matrix5(int nrmin, int nrmax, int ncmin, int ncmax, int ndmin, int ndmax,
79-
int nemin, int nemax, int nfmin, int nfmax) {
80-
81-
/* allocates a 5D generic matrix. Returns a pointer to a storage block *
82-
* [nrmin..nrmax][ncmin..ncmax][ndmin..ndmax][nemin..nemax][nfmin..nfmax] */
83-
int i;
84-
T *****ptr;
85-
86-
int nrows = nrmax - nrmin + 1;
87-
VTR_ASSERT_MSG(nrows >= 0, "Allocated matrix must have zero-or-more rows");
88-
89-
ptr = (T *****) vtr::malloc(nrows * sizeof(T ****));
90-
ptr -= nrmin;
91-
for (i = nrmin; i <= nrmax; i++) {
92-
ptr[i] = alloc_matrix4<T>(ncmin, ncmax, ndmin, ndmax, nemin, nemax, nfmin, nfmax);
93-
}
94-
return ptr;
95-
}
96-
97-
template<typename T>
98-
void free_matrix(T* ptr, int nrmin, int nrmax, int ncmin) {
99-
int i;
100-
for (i = nrmin; i <= nrmax; i++) {
101-
//coverity[offset_free]
102-
std::free(ptr[i] + ncmin);
103-
}
104-
//coverity[offset_free]
105-
std::free(ptr + nrmin);
106-
}
107-
108-
template<typename T>
109-
void free_matrix3(T** ptr, int nrmin, int nrmax, int ncmin, int ncmax, int ndmin) {
110-
int i;
111-
for (i = nrmin; i <= nrmax; i++) {
112-
free_matrix(ptr[i], ncmin, ncmax, ndmin);
113-
}
114-
//coverity[offset_free]
115-
std::free(ptr + nrmin);
116-
}
117-
118-
template<typename T>
119-
void free_matrix4(T**** ptr, int nrmin, int nrmax, int ncmin, int ncmax, int ndmin, int ndmax,
120-
int nemin) {
121-
int i;
122-
for (i = nrmin; i <= nrmax; i++) {
123-
free_matrix3(ptr[i], ncmin, ncmax, ndmin, ndmax, nemin);
124-
}
125-
//coverity[offset_free]
126-
std::free(ptr + nrmin);
127-
}
128-
129-
template<typename T>
130-
void free_matrix5(T***** ptr, int nrmin, int nrmax, int ncmin, int ncmax, int ndmin, int ndmax,
131-
int nemin, int nemax, int nfmin) {
132-
int i;
133-
for (i = nrmin; i <= nrmax; i++) {
134-
free_matrix4(ptr[i], ncmin, ncmax, ndmin, ndmax, nemin, nemax, nfmin);
135-
}
136-
//coverity[offset_free]
137-
std::free(ptr + nrmin);
138-
}
139-
14010
/* Integer vector. nelem stores length, list[0..nelem-1] stores list of *
14111
* integers. */
14212

13+
//TODO: Convert all uses of this data structure to std::vector and elete
14314
typedef struct s_ivec {
14415
int nelem;
14516
int *list;
@@ -148,14 +19,6 @@ namespace vtr {
14819
void alloc_ivector_and_copy_int_list(t_linked_int ** list_head_ptr,
14920
int num_items, t_ivec *ivec, t_linked_int ** free_list_head_ptr);
15021
void free_ivec_vector(t_ivec *ivec_vector, int nrmin, int nrmax);
151-
void free_ivec_matrix(t_ivec **ivec_matrix, int nrmin, int nrmax,
152-
int ncmin, int ncmax);
153-
void free_ivec_matrix3(t_ivec ***ivec_matrix3, int nrmin,
154-
int nrmax, int ncmin, int ncmax, int ndmin, int ndmax);
155-
156-
void print_int_matrix3(int ***vptr, int nrmin, int nrmax, int ncmin,
157-
int ncmax, int ndmin, int ndmax, char *file);
158-
15922

16023
} //namespace
16124

0 commit comments

Comments
 (0)