Threshold
Modified by 2015.05.15
Design
Threshold
Version
1.0
Modified
2015-05-15
Source
IP-GUI

Function
Convert gray-scales image to binary images.Give the first output after 1 cycles while the input enable.
Files
| Name | Function |
|---|---|
| Threshold.v | Main module |
| Threshold_TB.sv | Test bench |
Parameters
| Name | Type | Range | Default | Description |
|---|---|---|---|---|
| work_mode | unsigned | 0 for Pipeline, 1 for Req-ack | 0 | This module's working mode. |
| color_width | unsigned | 1 - 12 | 8 | Color's bit width. |
Ports
| Name | Port | Type | Range | Default | Description |
|---|---|---|---|---|---|
| clk | input | unsigned | None | None | Clock. |
| rst_n | input | unsigned | None | None | Reset, active low. |
| th_mode | input | unsigned | 0 for Base, 1 for Contour | None | The method for processing. |
| th1 | input | unsigned | color_width - 1 : 0 | None | First thorshold, used for all methods. |
| th2 | input | unsigned | color_width - 1 : 0 | None | Second thorshold, only used for "Contour" method. |
| in_enable | input | unsigned | None | None | Input data enable, in pipeline mode, it works as another rst_n, in req-ack mode, only it is high will in_data can be changes. |
| in_data | input | unsigned | color_width - 1 : 0 | None | Input data, it must be synchronous with in_enable. |
| out_ready | output | unsigned | None | None | Output data ready, in both two mode, it will be high while the out_data can be read. |
| out_data | output | unsigned | None | None | Output data, it will be synchronous with out_ready. |
Simulations
Simulations for this module just support Gray-scale images !
Waves
Pipeline mode

ReqAck mode

Original

Results

HDL functional simulation for pipeline mode is on the left, for req-ack mode is on the middle, and which on the right is the soft simulation
PSNR
| 1-Base-128-0 | 1-Contour-50-200 | 2-Base-128-0 | 2-Contour-50-200 | Total |
|---|---|---|---|---|
| 1000000.00 | 1000000.00 | 1000000.00 | 1000000.00 | 1000000.00 |
Utilization
| Slice LUTs* | Slice Registers |
|---|---|
| 11 | 2 |
Timing
The max Data Path Delay is 2.671ns, so:
FMax = 374.39MHz
Thanks
The sources of images for simulations:
H2SO4-蝶
パセリ-Favour