Skip to content

Commit 4da4d98

Browse files
committed
Add a more accurate delay between the additions and multiplications
1 parent cf16811 commit 4da4d98

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

modules/edge-detector/include/sobel_edge_detector_at_model.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ SC_MODULE(Edge_Detector)
1111
sc_inout<sc_uint<64>> data;
1212
sc_in<sc_uint<24>> address;
1313

14+
const double delay_full_adder_1_bit = 0.361;
15+
const double delay_full_adder = delay_full_adder_1_bit * 16;
16+
17+
const double delay_multiplier = 9.82;
18+
1419
const sc_int<16> sobelGradientX[3][3] = {{-1, 0, 1},
1520
{-2, 0, 2},
1621
{-1, 0, 1}};

modules/edge-detector/src/sobel_edge_detector_at_model.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void Edge_Detector::compute_sobel_gradient_x()
9292
{
9393
wait(gotLocalWindow);
9494

95-
mult_x.notify(20, SC_NS);
95+
mult_x.notify(delay_multiplier, SC_NS);
9696
}
9797
}
9898

@@ -102,7 +102,7 @@ void Edge_Detector::compute_sobel_gradient_y()
102102
{
103103
wait(gotLocalWindow);
104104

105-
mult_y.notify(20, SC_NS);
105+
mult_y.notify(delay_multiplier, SC_NS);
106106
}
107107
}
108108

@@ -120,7 +120,7 @@ void Edge_Detector::perform_mult_gradient_x()
120120
}
121121
}
122122

123-
sum_x.notify(10, SC_NS);
123+
sum_x.notify(delay_full_adder, SC_NS);
124124
}
125125
}
126126

@@ -138,7 +138,7 @@ void Edge_Detector::perform_mult_gradient_y()
138138
}
139139
}
140140

141-
sum_y.notify(10, SC_NS);
141+
sum_y.notify(delay_full_adder, SC_NS);
142142
}
143143
}
144144

modules/edge-detector/src/tb_edge_detector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int sc_main(int, char*[])
5555

5656
// Open VCD file
5757
sc_trace_file* wf = sc_create_vcd_trace_file("edge_detector");
58-
wf->set_time_unit(1, SC_NS);
58+
wf->set_time_unit(1, SC_PS);
5959

6060
Edge_Detector edge_detector("edge_detector");
6161
#ifdef EDGE_DETECTOR_AT_EN
@@ -240,7 +240,7 @@ int sc_main(int, char*[])
240240
edge_detector.write();
241241
sc_start(10, SC_NS);
242242

243-
sc_start(80, SC_NS);
243+
sc_start(20, SC_NS);
244244

245245
address = SOBEL_OUTPUT;
246246
edge_detector.read();

0 commit comments

Comments
 (0)