Skip to content

Commit a83f376

Browse files
authored
Merge pull request #18 from ErickOF/dev
Adding quality checks
2 parents 4c6a22f + b595fa2 commit a83f376

File tree

7 files changed

+62
-79
lines changed

7 files changed

+62
-79
lines changed

.github/workflows/cpp.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: C/C++ CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
branches:
10+
- main
11+
- dev
12+
13+
jobs:
14+
build:
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: install dependencies
21+
run: sudo apt-get install -y libopencv-dev
22+
- name: compile compression
23+
working-directory: ./modules/compression
24+
run: make IPS_JPG_AT_EN=1 INCLUDE_OPENCV_PKG=1
25+
- name: compile edge detector
26+
working-directory: ./modules/edge-detector
27+
run: make EDGE_DETECTOR_AT_EN=1 INCLUDE_OPENCV_PKG=1

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ pyrightconfig.json
220220
# End of https://www.toptal.com/developers/gitignore/api/c++,python,jupyternotebooks
221221

222222
# Ignore generate images from datagen tool
223-
modules/unification/*.bitmap
224-
modules/unification/*.gif
225-
modules/unification/*.jpeg
226-
modules/unification/*.jpg
227-
modules/unification/*.png
223+
modules/*/*.bitmap
224+
modules/*/*.gif
225+
modules/*/*.jpeg
226+
modules/*/*.jpg
227+
modules/*/*.png
228228
tools/datagen/src/imgs/*_grayscale_image*
229229
tools/datagen/src/imgs/*_noisy_image*
230230
tools/datagen/src/imgs/*_sobel_*

modules/compression/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ run:
2222

2323
# Show waveform
2424
waveform:
25-
@gtkwave input_matrix.vcd
25+
@gtkwave jpeg_compressor.vcd

modules/compression/src/ips_jpg_at_testbench.cpp

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@
1515
const int n_rows = 208;
1616
const int n_cols = 288;
1717

18+
19+
namespace ips
20+
{
1821
struct Image {
19-
int matrix[n_rows][n_cols];
22+
int matrix[n_rows][n_cols] = {0};
2023
};
24+
}
2125

22-
Image dummy_img(int i_rows, int i_cols)
26+
ips::Image dummy_img(int i_rows, int i_cols)
2327
{
24-
Image dummy;
28+
ips::Image dummy = {};
2529
// Fill the image with values
2630
int filler = 10;
2731
for (int i = 0; i < i_rows; i++) {
@@ -33,32 +37,15 @@ Image dummy_img(int i_rows, int i_cols)
3337
return dummy;
3438
}
3539

36-
void print_matrix(Image image, int image_rows, int image_cols)
37-
{
38-
for (int i = 0; i < image_rows; ++i) {
39-
for (int j = 0; j < image_cols; ++j) {
40-
cout << image.matrix[i][j]<<" ";
41-
}
42-
cout << endl;
43-
}
44-
}
45-
46-
void print_array(signed char *Arr, int array_length)
47-
{
48-
for (int i = 0; i < array_length; ++i) {
49-
cout << int(Arr[i])<<" ";
50-
}
51-
cout << endl;
52-
}
53-
int sc_main (int argc, char* argv[]) {
40+
int sc_main(int, char*[]) {
5441
sc_signal<sc_int<32> > matrix_element;
5542
sc_signal<sc_int<32> > matrix_row;
5643
sc_signal<sc_int<32> > matrix_col;
5744
sc_signal<sc_int<8> > Array_element;
5845
sc_signal<sc_int<32> > array_index;
5946
sc_signal<sc_int<32> > Array_size;
6047

61-
Image input_image = dummy_img(n_rows, n_cols);
48+
ips::Image input_image = dummy_img(n_rows, n_cols);
6249
int image_rows = sizeof(input_image.matrix)/ sizeof(input_image.matrix[0]);
6350
int image_cols = sizeof(input_image.matrix[0])/ sizeof(int);
6451
//Image output_image;
@@ -128,6 +115,5 @@ int sc_main (int argc, char* argv[]) {
128115
cout << "@" << sc_time_stamp() <<" Terminating simulation\n" << endl;
129116
sc_close_vcd_trace_file(wf);
130117
return 0;// Terminate simulation
131-
132-
}
118+
}
133119
#endif // IPS_JPG_AT_EN

modules/compression/src/ips_jpg_lt_testbench.cpp

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
const int n_rows = 208;
1616
const int n_cols = 288;
1717

18+
namespace ips
19+
{
1820
struct Image {
1921
int matrix[n_rows][n_cols] = {0};
2022
};
23+
}
2124

22-
Image dummy_img(int i_rows, int i_cols)
25+
ips::Image dummy_img(int i_rows, int i_cols)
2326
{
24-
Image dummy;
27+
ips::Image dummy = {};
2528
// Fill the image with values
2629
int filler = 10;
2730
for (int i = 0; i < i_rows; i++) {
@@ -33,25 +36,8 @@ Image dummy_img(int i_rows, int i_cols)
3336
return dummy;
3437
}
3538

36-
void print_matrix(Image image, int image_rows, int image_cols)
37-
{
38-
for (int i = 0; i < image_rows; ++i) {
39-
for (int j = 0; j < image_cols; ++j) {
40-
cout << image.matrix[i][j]<<" ";
41-
}
42-
cout << endl;
43-
}
44-
}
45-
46-
void print_array(signed char *Arr, int array_length)
47-
{
48-
for (int i = 0; i < array_length; ++i) {
49-
cout << int(Arr[i])<<" ";
50-
}
51-
cout << endl;
52-
}
53-
int sc_main (int argc, char* argv[]) {
54-
Image input_image = dummy_img(n_rows, n_cols);
39+
int sc_main (int, char*[]) {
40+
ips::Image input_image = dummy_img(n_rows, n_cols);
5541
int image_rows = sizeof(input_image.matrix)/ sizeof(input_image.matrix[0]);
5642
int image_cols = sizeof(input_image.matrix[0])/ sizeof(int);
5743
//Image output_image;
@@ -104,6 +90,5 @@ int sc_main (int argc, char* argv[]) {
10490
cout << "@" << sc_time_stamp() <<" Terminating simulation\n" << endl;
10591
sc_close_vcd_trace_file(wf);
10692
return 0;// Terminate simulation
107-
108-
}
93+
}
10994
#endif // IPS_JPG_LT_EN

modules/compression/src/ips_jpg_pv_testbench.cpp

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@
1515
const int n_rows = 452;
1616
const int n_cols = 640;
1717

18+
namespace ips
19+
{
1820
struct Image {
1921
int matrix[n_rows][n_cols] = {0};
2022
};
23+
}
2124

22-
Image dummy_img(int i_rows, int i_cols)
25+
ips::Image dummy_img(int i_rows, int i_cols)
2326
{
24-
Image dummy;
27+
ips::Image dummy = {};
28+
2529
// Fill the image with values
2630
int filler = 10;
2731
for (int i = 0; i < i_rows; i++) {
@@ -33,25 +37,8 @@ Image dummy_img(int i_rows, int i_cols)
3337
return dummy;
3438
}
3539

36-
void print_matrix(Image image, int image_rows, int image_cols)
37-
{
38-
for (int i = 0; i < image_rows; ++i) {
39-
for (int j = 0; j < image_cols; ++j) {
40-
cout << image.matrix[i][j]<<" ";
41-
}
42-
cout << endl;
43-
}
44-
}
45-
46-
void print_array(signed char *Arr, int array_length)
47-
{
48-
for (int i = 0; i < array_length; ++i) {
49-
cout << int(Arr[i])<<" ";
50-
}
51-
cout << endl;
52-
}
53-
int sc_main (int argc, char* argv[]) {
54-
Image input_image = dummy_img(n_rows, n_cols);
40+
int sc_main(int, char*[]) {
41+
ips::Image input_image = dummy_img(n_rows, n_cols);
5542
int image_rows = sizeof(input_image.matrix)/ sizeof(input_image.matrix[0]);
5643
int image_cols = sizeof(input_image.matrix[0])/ sizeof(int);
5744
//Image output_image;
@@ -102,5 +89,5 @@ int sc_main (int argc, char* argv[]) {
10289
sc_close_vcd_trace_file(wf);
10390
return 0;// Terminate simulation
10491

105-
}
92+
}
10693
#endif // IPS_JPG_PV_EN

modules/unification/src/unification_tb.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@
1010
#include "include/stb_image_write.h"
1111

1212
#include <systemc.h>
13-
#include "math.h"
13+
#include <math.h>
1414

1515
#ifdef IMG_UNIFICATE_PV_EN
1616
#include "unification_pv_model.hpp"
1717
#endif
1818

19-
int sc_main (int argc, char* argv[]) {
20-
19+
int sc_main(int, char*[]) {
2120
unsigned char pixel_x, pixel_y;
2221
unsigned char pixel_magnitude;
23-
int i;
2422
int width, height, channels, pixel_count;
2523
unsigned char *img_x, *img_y, *img_unificated;
2624

0 commit comments

Comments
 (0)