0
\$\begingroup\$

I understand that with synchronous FPGA, the whole execution is done in cycles. What happens when my circuit has two parts which give outputs in different cycles (one has greater depth than the other) and I need the outputs in a different part of the circuits in a single cycle? Is there any better way than just adding logic gates which do nothing in order to get delay of the required number of clock cycles?

I know that I usually don't have to care about this when programming FPGA's, but I would like to understand it.

\$\endgroup\$
  • \$\begingroup\$ Looks like XY-problem. Why do you need them "in the same time"? What is the "same time"? There is no such a thing, there will always be a difference. \$\endgroup\$ – Eugene Sh. Jun 1 '18 at 18:14
  • \$\begingroup\$ Don't really understand this: "(one has greater depth than the other) and I need the outputs in a different part of the circuits at the same time". you need "real" delay (within a clock cycle), or functional delay (clock cycle resolution... 1 or more)? \$\endgroup\$ – CapnJJ Jun 1 '18 at 18:16
  • 1
    \$\begingroup\$ I have edited the question according to the comments. I hope it is clear now. Not an XY-problem -- this is confusing me and I would like to understand it. \$\endgroup\$ – user2316602 Jun 1 '18 at 18:20
  • 1
    \$\begingroup\$ If you need to delay few cycles, you usually add few registers on the path to be delayed. \$\endgroup\$ – Eugene Sh. Jun 1 '18 at 18:22
  • \$\begingroup\$ Either delay the output that is leading (easiest), or reduce latency in the lagging output (might not be able to do this easily). bottom line, like @EugeneSh. said, "add/remove registers to affect clock delays" \$\endgroup\$ – CapnJJ Jun 1 '18 at 18:26
1
\$\begingroup\$

You would use either pipeline registers or FIFOs to take up the delay. Pipeline registers are good for short delays, and you essentially get one cycle of delay per stage. At their simplest, they act like shift registers, but it is also possible to have handshaking between stages. FIFOs are good for longer delays. A FIFO will store the data in an internal RAM for the duration of the delay. Another advantage of a FIFO is that it can cross clock domains.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Please not a FIFO has a dynamic delay between a min and max value. The delay can be adjusted with flow control. A fixed delay can be achieved with a shift register. \$\endgroup\$ – Paebbels Jun 3 '18 at 12:23
0
\$\begingroup\$

I’m assuming your FPGA runs on the same clock, so you do not have CDC issues. In that case, have your separate sections output the data in separate buffers.

A processing section can then wait for both buffers to have data available in them. When the data is available you can pop both buffers and do the required processing in the processing section.

This setup also has the advantage that you avoid blocking by the processing section due to the buffering.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

If you want to delay results by a certain number of clock cycles, latches/flip flops are a better choice than gates. You can pipe the faster data through the number of stages the slower data needs to catch up. It's essentially a shift register for each bit of the result that needs to be delayed.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

If you need to delay a lot of data lines for a lot of clock cycles a delay implementation using RAM blocks might be less resource intensive than just using flipflops. enter image description here The only things you need here are basically two counters and a dual ported ram and instead of using buswidth * delay-cycles flipflops you are using buswidth * delay-cycles RAM bits plus the overhead of the counters.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ It's worth noting that most FPGA development tools have predefined IP blocks for a RAM-based FIFO, which is basically what you're describing there. \$\endgroup\$ – Jules Jun 1 '18 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.