Skip to content

Commit 544a6d5

Browse files
committed
README with instructions to run the filter module testbench
1 parent e11f6f0 commit 544a6d5

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

modules/filter/README.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,63 @@
11
# **Filter Module**
22

3-
Add compilation instructions
3+
## **Filter Algorithm: Mean Filter**
4+
The mean filter algorithm replaces each pixel value with the average of all
5+
pixel values in an N by N window (N = 3, 5, 7, etc), where the pixel to
6+
replace is the centering pixel. Assuming that the centering pixel is in (0, 0)
7+
position:
8+
9+
$
10+
img(row, col) = \sum_{i = -N/2}^{N/2} {\sum_{j = -N/2}^{-N/2} {img(row + i, col + j)}}
11+
$
12+
13+
Also, it can computed using a convolution like:
14+
15+
$
16+
img(row, col) = \begin{bmatrix}
17+
\frac{1}{N^{2}} & \dots & \frac{1}{N^{2}} \\
18+
\vdots & \ddots & \vdots \\
19+
\frac{1}{N^{2}} & \dots & \frac{1}{N^{2}}
20+
\end{bmatrix}
21+
\ast
22+
\begin{bmatrix}
23+
img(row - N/2, col - N/2) & \dots & img(row + N/2, col + N/2) \\
24+
\vdots & \ddots & \vdots \\
25+
img(row + N/2, col - N/2) & \dots & img(row + N/2, col + N/2)
26+
\end{bmatrix}
27+
$
28+
29+
30+
## **Usage**
31+
32+
A Makefile is used to compile the testbench and filter module. There are some
33+
Makefile targets to compile the different modules and tests. By default, the
34+
PV model is compiled. The available test options are:
35+
36+
* `TEST_MODE_ONE_WINDOW_NORMAL`: Runs only one window with fixed values.
37+
* `TEST_MODE_ONE_WINDOW_RANDOM`: Runs only one window with random values.
38+
39+
Some additional options can used to debug and dump the waveform:
40+
41+
* `IPS_DEBUG_EN`: Prints the kernel, each window value, and the result.
42+
* `IPS_DUMP_EN`: Creates a VCD file with each value of the window and kernel,
43+
and the result.
44+
45+
### **Compilation**
46+
Runs the `make` command with the corresponding switches to compile.
47+
48+
For instance, to run only one window in debug mode and dump the signals:
49+
50+
```shell
51+
make TEST_MODE_ONE_WINDOW_RANDOM=1 IPS_DUMP_EN=1 IPS_DEBUG_EN=1
52+
```
53+
54+
### **Run**
55+
56+
```shell
57+
make run
58+
```
59+
60+
### **Open Waveform**
61+
```shell
62+
make waveform
63+
```

0 commit comments

Comments
 (0)