-
Notifications
You must be signed in to change notification settings - Fork 6
pzbcm_counter
Taichi Ishitani edited this page Dec 26, 2022
·
3 revisions
https://github.com/pezy-computing/pzbcm/tree/master/pzbcm_counter
This module implements a basic counter.
name | type/width | default value |
---|---|---|
WIDTH | int | 2 |
MAX_COUNT | WIDTH | all bits 1 |
MIN_COUNT | WIDTH | 0 |
INITIAL_COUNT | WIDTH | MIN_COUNT |
WRAP_AROUND | 1 | 1 |
- WIDTH
- Width of the count value.
- MAX_COUNT
- Maximum value of the count value.
- MIN_COUNT
- Minimum value of the count value.
- INITIAL_COUNT
- Initial value of the count value.
- WRAP_AROUND
- When this value is set to 1
- The count value goes to
MIN_VALUE
when the count value isMAX_VALUE
andi_up
is asserted. - The count value goes to
MAX_VALUE
when the count value isMIN_VALUE
andi_down
is asserted.
- The count value goes to
- When this value is set to 0
- The count value is not incremented more when the count value is
MAX_VALUE
. - The count value is not decremented more when the count value is
MIN_VALUE
.
- The count value is not incremented more when the count value is
- When this value is set to 1
name | direction | type/width | note |
---|---|---|---|
i_clk | input | 1 | clock |
i_rst_n | input | 1 | reset (async/active low) |
i_clear | input | 1 | the count value is reset to INITIAL_COUNT when this port is asserted |
i_set | input | 1 |
i_set_value is set to the count value when this port is asserted |
i_set_value | input | WIDTH | |
i_up | input | 1 | the count value is incremented when this port is asserted |
i_down | input | 1 | the count value is decremented when this port is asserted |
o_count | output | WIDTH | current count value |
o_count_next | output | WIDTH | count value for the next clock cycle |
o_wrap_around | output | 1 | indicate the count value changes from MAX_VALUE to MIN_VALUE or from MIN_VALUE to MAX_VALUE
|