FPGA ideas

From circuitbending to homebrew stompboxes & synths, keep the DIY spirit alive!

Moderators: lisa, luketeaford, Kent, Joe.

Post Reply
fuzzylogic
Learning to Wiggle
Posts: 8
Joined: Sun Dec 30, 2018 5:19 pm

FPGA ideas

Post by fuzzylogic » Wed Jan 22, 2020 3:52 pm

Hi all! I've been looking at learning some FPGA programming this year and thought building a module with them would be a good introduction. I'm still researching and I'm trying to figure out what kind of processes FPGAs would be useful for? I don't want to do something with them that could be done just as easily on an MCU, but at the same time it feels like there's not many synthesis processes that can't be done on an MCU. So I guess I'm asking: Any thoughts? What would you use an FPGA for?

Arneb
Veteran Wiggler
Posts: 585
Joined: Thu Jul 04, 2019 4:50 pm

Re: FPGA ideas

Post by Arneb » Wed Jan 22, 2020 4:08 pm

- Convolution reverb
- Additive VCO, think XAOC Odessa (which is FPGA-based IIRC)
- Digital filter ideas - formant filter, phaser, comb filter based stuff,...

User avatar
ablearcher
Veteran Wiggler
Posts: 612
Joined: Thu Dec 26, 2013 8:00 pm
Location: Portland
Contact:

Re: FPGA ideas

Post by ablearcher » Wed Jan 22, 2020 4:46 pm

Ive been down this path for 6 months or so.

You probably wont want to do anything requiring memory for a first project, reverb or delay involves interfacing with ram which can be tricky.

An oscillator, vca, envelope etc are all very doable. But will involve implenenging i2s to talk to an adc or dac. Depending on your current skill level with dsp you may want to try something that sounds trivial before trying to implement a filter.

Voltage controlled audio rate multiplier or divider is another good starter.

I do recommend the open source yosys/nextpnr toolchain with a lattice ice40, maybe icebreaker dev board.

tele_player
Common Wiggler
Posts: 196
Joined: Fri Feb 15, 2019 10:50 am
Location: Sacramento

Re: FPGA ideas

Post by tele_player » Wed Jan 22, 2020 4:59 pm

FPGA's are fascinating, and learning how to use them is worthy, in its own right. But aside from the fascinating new technical learning challenge, the choice to actually use FGPA's should come from the other direction.
Rather than "fpga is so cool, I wonder what I can do with it?", think "I have this great idea , and general purpose CPUs aren't fast enough, and dedicated DSP chips aren't fast enough, so I'll need to try an FPGA".

In other words, an FPGA is the last resort when cheaper technology can't do the job.

(I worked for years on software for FPGA-based network equipment. If anything else was fast enough for what we were doing, we would have used it.)

fuzzylogic
Learning to Wiggle
Posts: 8
Joined: Sun Dec 30, 2018 5:19 pm

Re: FPGA ideas

Post by fuzzylogic » Wed Jan 22, 2020 5:31 pm

Thanks everyone! These are great suggestions and in regards to @tele_player's comments, maybe I should rephrase the question. Aside from the example of additive synthesis like the Odessa (which I didn't know about - thanks @arneb!) and perhaps convolution (also a great example), are there any other uses for FPGAs are there that aren't better/more appropriately implemented on an MCU?

Thanks for the recommendations @ablearcher - will check them out!

User avatar
revtor
Dialing it in..
Posts: 1666
Joined: Sat Nov 29, 2008 10:31 am
Location: North Jerz

Re: FPGA ideas

Post by revtor » Wed Jan 22, 2020 7:59 pm

Fpga May be good for trying to recreate older devices that used lots and lots of logic IC’s. ?
Fellow North Jersey Synthaholic

Arneb
Veteran Wiggler
Posts: 585
Joined: Thu Jul 04, 2019 4:50 pm

Re: FPGA ideas

Post by Arneb » Thu Jan 23, 2020 2:03 am

tele_player wrote:
Wed Jan 22, 2020 4:59 pm
FPGA's are fascinating, and learning how to use them is worthy, in its own right. But aside from the fascinating new technical learning challenge, the choice to actually use FGPA's should come from the other direction.
Rather than "fpga is so cool, I wonder what I can do with it?", think "I have this great idea , and general purpose CPUs aren't fast enough, and dedicated DSP chips aren't fast enough, so I'll need to try an FPGA".

In other words, an FPGA is the last resort when cheaper technology can't do the job.

(I worked for years on software for FPGA-based network equipment. If anything else was fast enough for what we were doing, we would have used it.)
Great post :tu:

The situation in my own line of work (scientific HPC) is slightly different. Here, FPGAs are mostly thought of as an energy saving measure. Unlike in network equipment, space isn't a constraint for us - we're in the middle of the woods, we can always build a bigger server room. What's keeping us from just throwing more CPUs at our problems is power intake and cooling.
(Well, that and what we call "non-ideal strong scaling behavior" but really it's just the law of diminishing returns :mrgreen: )

The digital module use case probably falls somewhere in the middle. On the one hand, space is a constraint, people aren't going to ram a Xeon Phi into an Euro module anymore than they're going to ram one into a network switch. On the other hand, the average Euro system doesn't use industrial-grade power supplies and not taxing your rack's power supply too much is also a worthwhile design goal.

fuzzylogic
Learning to Wiggle
Posts: 8
Joined: Sun Dec 30, 2018 5:19 pm

Re: FPGA ideas

Post by fuzzylogic » Thu Jan 23, 2020 3:40 am

Thanks @Arneb! The power saving was something I hadn't considered properly but does seem like a really good argument for using FPGAs for more intense processes. Forgive the basic question, but is there a good way to calculate expected power consumption in something like this?

fuzzylogic
Learning to Wiggle
Posts: 8
Joined: Sun Dec 30, 2018 5:19 pm

Re: FPGA ideas

Post by fuzzylogic » Thu Jan 23, 2020 3:46 am

@ablearcher I just looked at the links in your signature and realized I was listening to your interview on Art + Music + Technology the other day! Really enjoyed listening to that conversation and the stuff you're doing is super interesting :tu:

Arneb
Veteran Wiggler
Posts: 585
Joined: Thu Jul 04, 2019 4:50 pm

Re: FPGA ideas

Post by Arneb » Thu Jan 23, 2020 6:38 am

fuzzylogic wrote:
Thu Jan 23, 2020 3:40 am
Thanks @Arneb! The power saving was something I hadn't considered properly but does seem like a really good argument for using FPGAs for more intense processes. Forgive the basic question, but is there a good way to calculate expected power consumption in something like this?
It's all a bit hard to say, because on FPGA power intake depends on the application.

The FPGA folks I work with expressed it as follows: On CPU you compute in time, on FPGA you compute in space. That is, on CPU a computationally hard task takes longer than a computationally easy one, but uses the same amount of resources, while on FPGA a computationally hard task takes the same time as a computationally easy one, but uses more of the FPGA's resources. Obviously, that's a major reason why FPGA is popular for DSP jobs specifically: Those jobs are supposed to be real-time. Now what this means for power is that, while on both CPU and FPGA a computationally hard task results in a higher power bill [Wh] than a computationally easy one, on CPU power intake [W] isn't really higher for the hard task than the easy one, while on FPGA it very much is.

Annoyingly you can't even ask the manufacturers' press releases, because those focus on their flagship products. Looking at Xilinx' catalogue they'll sell you everything from 10$ chips for your home's WLAN router to 50,000$ chips for F35 jets and satellites. For an Euro module DIY job, it's clearly the former category you care about.

Anyways, here's Xilinx' power estimator spreadsheets. Haven't been able to look at it yet because it's MS Excel only. For hobbyist purposes it's the Spartans and the cheaper parts of the 7 Series you care about.

User avatar
guest
Super Deluxe Wiggler
Posts: 4225
Joined: Mon Aug 19, 2013 11:49 am

Re: FPGA ideas

Post by guest » Thu Jan 23, 2020 7:05 am

thanks for the reccomendation, i just listened to the podcast as well, and it was very informative. ive been looking at FPGAs recently for the same reason ablearcher mentioned in the podcast: really high frequency digital synthesis. ideallly i would like to be doing processing in the 200ksps - 500ksps range. my first idea for this was based on sigmadelta modulator a long time ago. that is a single bit stream running in the 1MHz to 10MHz range. multiplies are as simple as an XOR gate, although a true addition is a bit harder, which is where i thought the FPGA might help (otherwise its a few XORs, ANDs, and a D F/F). the other cool thing about these single bit datastreams, is that they can be converted to analog with a lowpass filter, and analog can go to digital with an opamp, D F/F, and a comparator.

so i started looking into it, and ended up at the ICE40 series as well, as they are the lowest cost option (1.20$@100). but, i can get a cortex M0+ for 0.50$@100. and, this M0+ has a 350ksps ADC and DAC onboard! so my current thinking is to use a few M0+ micros, each running a subsection of the code to get the throughput i want. 250ksps gives 192 clock cycles at 48MHz, which is a lot of multiplies and adds, all at 32b. the cheapest ICE40 only has 384 logic blocks inside, so if you want to build a few multibit multipliers youll find that your going to have to either slow down and do the multiply in shifts over time, or use up a lot of those blocks. imagine a standard 4 pole filter with feedback, thats 5 multiplies right there, which could use up all the blocks depending upon bit depth.
openmusiclabs.com

User avatar
Just me
Has enough VCA's
Posts: 4502
Joined: Sat Apr 10, 2010 11:45 am
Location: Downtown

Re: FPGA ideas

Post by Just me » Thu Jan 23, 2020 7:28 am

My only experience with FPGA's is in the controller cards for high voltage, high current DC to 3θ AC inverter/converters. (825VDC to 208VAC 3 phase) and VFD inverters in high horsepower traction propulsion. They are black magic to me. They do allow the equipment to boot from cold nearly instantly
If I have water in my ear, is it safe for me to listen to electronic music?

User avatar
ablearcher
Veteran Wiggler
Posts: 612
Joined: Thu Dec 26, 2013 8:00 pm
Location: Portland
Contact:

Re: FPGA ideas

Post by ablearcher » Thu Jan 23, 2020 9:16 am

That's awesome so many people listened to the podcast!

I've been using the ice40 up5k part from Lattice (the same one on the icebreaker). It is about $6 in low quantities, has 8 built in multipliers, and 5k LUTs. It's a really low power part, I'm seeing something like 20mA on the 3.3V rail running it at 25MHz with most resources used.
It's not really big enough to implement a soft core so everything has to be written in verilog which is fairly exhausting (for me).

For a lot of things the simple fact that most microcontrollers have ADCs and DACs built in will make them much more appropriate for Eurorack applications. Not to mention simple libraries for i2c etc.

The FPGA starts to shine when you utilize both the space and time resources, for example, if you take those 8 multipliers, even if you are only running at 25MHz (you could realistically push the UP5K up to 75 or 100MHz using the internal PLL depending on how you write your firmware), if you implement a filter, or oscillator running at a sample rate of 192KHz then you can time slice those multipliers and implement 50 or 100 or them. This is assuming your oscillator is just an accumulator and you don't have a lot of calls to memory. So it is very suitable for additive oscillators and multiband filtering.

You really want to pick FPGA's with hardware multiplier built in and use those efficently, otherwise those eat up your LUTs very quickly.

I did start down the the delta sigma modulator single bit datastreams that guest is talking about. Implementing a first order delta sigma modulator DAC in the fabric is fairly trivial, but to get it up to 16 bits you have to run it pretty fast (100MHz-ish territory). By increasing the order of noise shaping you can increase the effective bit depth but that is a lot more complicated than it sounds and I ended up using a standard i2s DAC.
If we can get more people on the open source toolchain maybe someone with serious math/DSP chops will implement some of these things like a higher order delta sigma modulator DAC that we can all use :)

The open source toolchain (Yosys, Nextpnr) now supports the Lattice ice40 and ECP5 series chips and is just starting to support the Xilinx 7 series. In previous attempts to dive into FPGAs I have used the vendor tools (Quartus for Altera, Vivado for Xilinx) and found them miserable. However the FPGA open source community is still small so using it means you forego vendor IP and have to implement a lot of things that a microcontroller would provide in a library yourself.

this post is already too long but I do want to point out that fpgas are also really good for video processing.

jorg
Veteran Wiggler
Posts: 700
Joined: Fri Apr 03, 2015 9:38 am
Location: East Coast USA

Re: FPGA ideas

Post by jorg » Thu Jan 23, 2020 11:32 am

revtor wrote:
Wed Jan 22, 2020 7:59 pm
Fpga May be good for trying to recreate older devices that used lots and lots of logic IC’s. ?
Totally. Compared to a CPU/DSP, it's pretty easy to run an FPGA at variable clock rates, or have many independent circuits running at different clock rates.

They might be good for PLL-based clock multipliers/dividers (at audio rate or control rates).

User avatar
Graham Hinton
Super Deluxe Wiggler
Posts: 3249
Joined: Fri Jul 02, 2010 6:28 pm
Location: England
Contact:

Re: FPGA ideas

Post by Graham Hinton » Sat Jan 25, 2020 4:27 pm

fuzzylogic wrote:
Wed Jan 22, 2020 3:52 pm
I don't want to do something with them that could be done just as easily on an MCU, but at the same time it feels like there's not many synthesis processes that can't be done on an MCU. So I guess I'm asking: Any thoughts? What would you use an FPGA for?
There are different types of FPGAs, but it isn't a choice between an MCU or not unless the device is dense and powerful enough to implement a SOC (System on a Chip)--you can get IP cores for several microprocessors. An MCU performs sequential logic, sometimes fast enough to create the illusion of being real logic. FPGAs are real logic, limited mainly by the propagation delays and pins available and partly by the internal architecture.

One of the downsides of FPGAs is that the development systems suck. Big time SUCK. When FPGAs first came out one of the vendors, Actel, were running an advert that said something like "Think of it in the shower, develop it after breakfast, have it in production by lunchtime". (Anyone remember that?) As if. When I contacted them I found that I had to buy about £15k of software to get started. So I did a deal with them and they agreed to lend me a PC with all their software and a programmer on free for a month and I would pay for it monthly after that. The software was atrocious, but despite that I got three designs done in two weeks and then told them to take their system away. They thought I couldn't use it, but when they found out that I had three working designs their sales manager admitted that no-one had ever completed one in less than a month before and they thought they would get six months hire out of me! So much for their advert. The software was such a disgusting anti-productivity tool that I developed my own as a DesignWorks library on the Mac and exported a netlist to use with their Designer software on a Windows emulator which created the files to send off for programming. I still keep an OS9 Mac with that software on, it's all orphaned by OSX, but I try to avoid FPGAs now.

There are other types that have a shadow RAM which is loaded at power up so you don't need a programmer, but you do need a means of loading it. All the different types have different internal structures which dictate the type of logic that suits them. It is not easy to migrate a design from one to another.

I have developed several FPGAs used in my products, the Actel anti-fuse ones were very good for building large mutiplexers for MIDI and digital audio routing. I also made SMPTE timecode decoders, keyboard scanners and several microprocessor peripherals. Components.

Some of the other downsides: the price did not come down with time, they just kept making denser parts in denser packages that were difficult to prototype. Development software became bloated, every iteration required a computer and OS upgrade. They require dedicated expensive device programmers. All this conspired to never deliver the initial promise and so they never really took off in the way they expected. Vendors tried to claw back their development costs from early adopters instead of making it free and getting more users. Big companies with big budgets use them, but they don't suit low budget development.

To be good at FPGA design you have to be good at digital logic design to start with and that is a rare breed of engineer. You need to know how you will debug it before you design it, not afterwards. Don't trust the libraries that claim to have TTL equivalents, you can't simply take an existing logic design without reworking it.

Having said that Actel were taken over by Microsemi which are now taken over by Microchip and there is a free prototype service on their website.

The Cylonix Cyclebox is an example of a module done with an FPGA implementing a digital oscillator.

Post Reply

Return to “Music Tech DIY”