I am using an FPGA to generate a 32 bit value that is modified by counting a pulse train. The current implementation uses a 32 bit counter that counts up and down based on pulse and direction inputs. The output of the counter the value of interest.
I need to add another pulse train that I also want also modify the output value. Essentially I want to count both pulse trains and use the sum of the two as my value of interest.
This could be functionally achieved by independently counting the two pulse trains, and summing the output to a 32 bit register.
I am relatively new to FPGA's, and I'm wondering if there is any kind of dual input counter type of function block that would make this easier or more clear. If there was such a thing as a counter that will count two separate pulse trains it would simplify life.
Both pulse trains can be counting up or down, so the function block would have to allow for two pairs of step and direction signals, and the output would be the sum of the counts of the two up/down pulsetrains.
Is there any common function block to do such a thing, or is it necessary to use separate counters and sum them?