Altera_Forum
Honored Contributor
11 years agoShift delay block (data valid) in simple PI controller using ALTERA FP libraries
Hello all,
I have a FPGA system running with 150MHz with some ADCs and doing some PWM. The system until now is handling 16bit signed integers. I want to develop a simple floating point PI controller that runs at a sample rate of 100kHz, the simple block diagram of which is illustrated below: https://www.alteraforum.com/forum/attachment.php?attachmentid=8708 Due to the fact that the floating point blocks (conversion, add, multiply, subtract blocks) introduce some calculation delay (150MHz clock cycles) in the system the whole process needs to be synchronized using a data valid 1-bit signal that gets propagated with the data through the calculation to denote the flow of the data as shown in the implementation below: https://www.alteraforum.com/forum/attachment.php?attachmentid=8709 The same data valid signal is also used to trigger the control loop as this data valid signal is a 100kHz pulse with the width of a 150MHz clock of the FPGA. This valid data signal is also fed to a multiplexer block of the integrator loop so that only once per triggering cycle the output of the integrator is added as loopback and all the other FPGA 150MHz clock cycles a zero is fed (so that the integrator works only once inside the trigger cycle as it should do). my question:
How do I introduce a "shift delay" to the data and valid signal so that I synchronize the system? The easy way is to add registers in series but sounds kind of dumm in case of 30 cycles delay for example. Also: Is there any theory or books behind synchronizing this kind of calculation operations? Any answer to the aforementioned questions is welcome as I think that lots and lots of people will find this information useful! Thanks in advance!