Jump to content

Generate data using fpga


Valentin

Recommended Posts

@Valentin,

Gosh, that is such an open ended question and there are so many digital waveforms that can be created using FPGA's ... it's hard to know what you are looking for or where to begin.  Further, given that every I/O that comes out of an FPGA (with few exceptions) is a "digital waveform" ... I'm struggling to know what you are trying to create.

So, at the risk of answering the wrong question, let me point you to two examples of FPGA cores that can be used to produce waveforms from logic.

  1. The first example produces a PWM waveform, although in a non-traditional way.  The basic PWM modulation scheme uses a counter, a limit, and a threshold.  When the counter reaches the limit, it starts over from zero.  Then, at every time instant, the counter is compared to the threshold.  Whenever the counter is below the threshold, a 1 is output.  Whenever it is above the threshold, a 0 is output.  If the result of this circuit is then filtered to reduce the high frequency noise (think long-term averaged), it can be used to produce something resembling an analog voltage.  I have chosen to take a twist to this example by setting the limit of the counter to be its normal roll-over--eliminating the need for checking whether or not the counter exceeds the limit, and  reversing the bits in the counter before the comparison.  This tends to further send the high frequency components of the resulting signal to even higher frequencies, (hopefully) reducing their ultimate distortion.  (If someone wants to measure how well this approach works for me, it'd be fun to hear the results of the comparison.)  You can find the code for this example here.  The example requires wishbone bus control, but it is simple enough that you should be able to adjust it for your purpose.
  2. The second example is that of what I call an FM transmitter hack.  This hack uses the logic output pins of an FPGA as a commercial FM transmit antenna, and broadcasts a digital waveform out of those output pins.  By taking the high order bit from a counter that is stepped at a programmable rate, a wideband FM waveform is created.  Sure, it's subsampled: I ran it off of an 80MHz FPGA clock and transmitted on a 91MHz frequency, and did it without the SERDES controller.  Still, at a range of a couple of inches, I was able to overpower the local radio station and play my own music.  (I can assure you, the local Christian station was not playing Queen's "We will rock you." ...)  As with the PWM code, this hack is also controlled over a wishbone bus.  Also, as with the PWM code, the source code for this example is fairly simple and fairly well documented.

Let me know if either of these examples is the sort of thing you are looking for,

Dan

Link to comment
Share on other sites

@Valentin,

Even that's too broad of a question to answer.

Try googling "VHDL tutorial" and do some reading.  I think you'll find the very first project within any such tutorial will guide you through making a waveform, similar to what you've described above.  I'd offer my favorite tutorial ... 1) I'm not much of a VHDL type, and 2) that wasn't how I learned.  :( (Sorry)

Perhaps someone else on the forum has a better reference than I do.

Dan

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...