For example, you may reset the counter on any change of the reset value.
So long as the adjustment does not lose the current count, for example, i use this to make my UART's last stop bit, 2 clocks shorter, this gives me 1 tick in the idle state, then one more tick to react to the next data word to be sent. Keeping the end of the stop bit and beginning of the start bit in perfect timing while managing the ce_25mhz timing.
The best alternative I thought of was to implement a running counter, and track the start time for calculating the new reset_value input, but this tripled my registers
After that I wrote the ALU_PIPELINE module, it works fast, +250mhz, but requires converting the reset value into a ..... complacated format ... before it can be used
With the pjpelined counter, if the counter_ff arrives at the reset_value, with the carry chain $countones() != 0, then the strobe would be skipped. The solution is to pre calculating what the counter_ff and its carry chain would be, then use that as a comparison. Way to complicated just to strobe a light.
So I left it and moved onto the next module.
Also, just try registering the 'reset value' into a local register. That will improve the timing of large magnitude compares since
Correct, but that eats more regusters, and using the MCP gives my signal over 40ns to lounge in the breakroom, before it has to show up and work.
Thanks for the tips, it is very much appreciated.
In your 'if', just use the latched version
The synthesis report says zero latches. But it also gives the fmax that i wish I had.
From the reading i have done, latches can only be infered from an combinational blocks and not sequential blocks.
And the design viewer usually will show a LUT into a DFF, or a DFFE with ether a register or LUT feeding the CE. If using a vector with an inital value, a combination of DFFSE and DFFRE are usually inferred.
By defining a value in every case, the implementation does not use any CE pins and builds a mux to feed the d port of the primitives. Even for a 1 bit register. When I obmit changing the value, unless I need to, then a DFFRE primitive is build, with strobe_ff(.D(1'bq) .CE(cws_counter_ff >= reset_value) .RESET(Q || rst)) The results are less resources because (>=) is shared between, counter_ff RESET port and strobe_ff CE port, instead of a WIDTH length 3x mux(reset value, increments value, comparison value) feeding onto counter_ff.D, only the increment value feeds it, without a mux
primitive guide can be viewed here