Value counter using Gray Encoding


WIDTH u32 Counter width
MAX_COUNT bit Max value of counter (in binary)
MIN_COUNT bit Min value of counter (in binary)
INITIAL_COUNT bit Initial value of counter (in binary)
WRAP_AROUND bit Whether counter is wrap around


i_clk input logic Clock
i_rst input logic Reset
i_clear input logic Clear counter
i_set input logic Set counter to a value
i_set_value input COUNT Value used by i_set
i_up input logic Count up
i_down input logic Count down
o_count output COUNT Count value
o_count_next output COUNT Count value for the next clock cycle
o_wrap_around output logic Indicator for wrap around