UPDuino: a $9.99 FPGA
tinyletter.com
tinyletter.com
In other words, they aren't making six figures and yet still sharing a 2 bedroom apartment with 6 other developers.
It was inspired when me and my dirty, sweaty, budget beer-drinking buddies were hanging out at a 7/11 with a foreign engineer we had just met. He said he wanted to go to the club, we were like "dude cover is pretty expensive, let's just drink our 50 cent beers." He did a quick count of us, then said "ok, I'll pay for everyone's cover."
Rent was 250USD a month, 100mbps internet 20 USD... this on top of the fact that you're getting nearly equal healthcare because all the doctors are US school trained anyway, way better public transit (trains are automated! and CLEAN!!). I mean, it's the dream.
Just kidding haha. I mean their main language is Mandarin, so that can be a challenge, even though tons of people speak English.
If you want to work in a Taiwanese company, you may have to deal with a really shitty arbitrary work culture. Sitting on your phone till 8pm cause it looks good, such bullshit.
It can get absurdly hot in the summer, 40c levels, with high humidity, and usually you gotta get your own AC installed unless you're in a super new building (few places have central AC). Also taifun (how do you spell that in English...) can be really intense. Also the mosquitoes are a fucking nightmare.
If you're a vegetarian, forget about it lol. Nobody there understands or really cares. You'll only ever be able to eat at foreign restaurants which pretty much restricts you to Taipei or maybe kenting.
Hmm other than that it is literally paradise to me. Whatever you want is an hour train ride (for one USD) away. Surfing, hiking, bicycling through mountains, rock climbing, art meetup things, entrepreneurship stuff, hackerspaces, hackers... It's such an amazing country.
Oh you do have the constant fear that north Korea or China will nuke you.
> If you're a vegetarian, forget about it lol. Nobody there understands or really cares. You'll only ever be able to eat at foreign restaurants which pretty much restricts you to Taipei or maybe kenting.
This is NOT the case. Compared to mainland China (where it's like you say), Taiwan didn't have a cultural revolution and therefore more of the local Buddhist culture where veganism is strong. At most places when I say I am vegetarian or vegan they will ask me if I eat onion and garlic (since local Buddhist vegans will often not eat those either). Of course you'll find nothing vegan in a beef-noodle restaurant. It's not like in the west where all restaurants have at least one lacto-ovo-vegetarian option on the menu, but there are still plenty of options.
There are cheap local vegan restaurants littered across the city. Just look for the 素 sign.
I would also add pollution to the downsides, if you're near or in a big city. Nowhere NEAR as bad as cities in the mainland, but on the bad days you can definitely feel it.
Taipei is going to be SUCH a nicer place once most scooters are replaced with electric ones.
Taiwan is essentially a first world country at a discount. Their populace is largely well educated (last I checked at 99% literate) and there are tons of engineers and entrepreneurs for me to engage with.
It really is just a different class of country.
i have a side hobby of machining. i will only buy taiwan or german equipment.
You can get buy with just English but you'd be doing yourself a disservice if you didn't spend your time picking up Mandarin. There's often free classes, plus everyone is friendly.
Here, I found some of my old blog posts. The articles are relatively short and go over some of the details:
http://taipeitips.blogspot.com
http://ablate.blogspot.com/2014/05/what-does-it-cost-to-live...?
Regardless, I was based in Taipei for about 1.5 years and if you just adapt your lifestyle it's still definitely doable to even save a significant portion of a $2k salary. Rough calculations below assuming a single person on a conscious but not frugal lifestyle:
* Rent: ~10000 NTD per month if you're not sharing (you can still find decent places for cheaper). This will put you central enough to have easy access to everywhere but not smack in Da'an.
* Food: ~8000 NTD per month
* Transportation: ~4000 NTD per month
* Other: ~20000 NTD per month
That leaves > 30% of your salary left over. If you regularly splurge on coffee shops and western-style bars and restaurants (all of which are relatively ridiculously pricey) you will have less of course.
I am guessing that in 2 months you might still have had a more of a "tourist life-style" (eating out at expensive places, paying much more for accommodation than if you have a proper contract or own your place, going to work at Starbucks, etc).
It's kind of ridiculous just how much of a luxury coffee shops really are. One coffee at hipster cafe will be more than twice of a good meal at the delicious vegan buffet next door.
Median salary in Taipei is somewhere around 2k USD IIRC.
I love Taiwan and only reason I left was relocating for building a team in Europe.
Just going to put this here for people who are interested: https://www.numbeo.com/cost-of-living/in/Taipei
In short, my expenses were under 1,000usd monthly.
Like the other person that replied, I did that by not really eating out often, not going to foreign restaurants, and choosing cheap activities, which Taipei has plenty of. Rock climbing was 30c at the gym, hiking was free, a day trip to fulong for bicycling was like five bucks total. Etc.
So yea, putting 50% of income away to savings isn't exactly ideal I guess (we're supposed to do 70% right?) Hence my plans to move back as an engineer.
Edit: in hindsight, I don't know how the fuck I was spending 200$ on groceries lol. That's how much I spend here. I could definitely optimize that budget. Probably wasn't leveraging the morning markets enough and buying too much Nutella or something.
Have you presented your developers the opportunity to move to higher cost of living area for in increased salary (or vice versa, supposing you pay some developers much higher wages and you deem this a good deal)? Just because discriminating on geographical location is widely accept practice we should not pretend it is OK or worse, feel good about it.
https://elsajohansson.wordpress.com/2017/09/13/what-does-a-w...
In other words, salaries are set by supply and demand in that market, not by the arbitrary value that one might assign to a specific job.
So I should feel bad for paying employees above market rate in their area and giving them a better life than they could ever get by getting a local job? Sorry, not going to happen (me feeling bad about it, that is).
Do you think everyone should pay San Francisco salaries to developers no matter where in the world they live? Seems absurd.
How one should feel about discriminating people slightly less than socially accepted is indeed complex and somewhat up to taste, I can give you that.
On the flip side, I've also had more very bad experiences with outsourcing overseas and communication barriers. Cultural differences are often underestimated, and without dedicated oversight/management things can go off the rails pretty badly. It really depends on a lot of variables.
I have mixed feelings about globalization myself, living in a higher paying country for the work I do. But I don't fault anyone for offering or taking a good wage for one's circumstances. I just wish it worked a bit better for the consumer in some protective markets (medications mostly, but others too).
How do you know they were underpaid?
It's cheaper for me to have boards made in Colorado than in Santa Clara, and I'm certain the Colorado workers are paid less (the parts come from Digit-Key either way). Would you consider your statement true in that case too?
They amount paid (whatever it was) might have been enough for a nice lifestyle in Sri Lanka -- perhaps more so than the Colorado case.
[1] - https://twitter.com/oe1cxw/status/950083493073178625?lang=en
(Or... perhaps they weren't refurbished/reused, and we just discovered one manufacturer's test image?!)
My understanding is that microprocessors excel at executing logic using an onboard general-purpose ALU sequentially and quickly.
On the other hand, an FPGA excels at doing a specified task as the hardware (gates) are programmed/hooked up in a certain way to execute that one task.
ASIC's are processors that are designed from the factory to execute a specific task (kind of like pre-programmed, non-reprogrammable FPGA's).
Can someone please fill in the gaps please? I have a general idea, but I'm not sure I understand all the differences correctly.
An FPGA is really good at doing a single task a ton of times. A microprocessor is good at doing a lot of tasks a ton of times. And an ASIC is just a more permanent and more efficient FPGA.
So when would I use an FPGA? Let me describe an example: Stream processing.
Let's say I have a stream of data. Like a camera producing a video feed. As each frame of data comes in, we want to compare it to the previous frame and take the average of the two values to create a blurring effect.
On a microprocessor we process each frame. We iterate over groups of pixels one at a time, compare it to the value at the pixel in the previous frame and divide by two. Our processing time is a function of the number of pixels we want to look at. If we're lucky we have multiple cores so we can do work in parallel. Maybe even do 32 groups of pixels in parallel on a ryzen or something. But if we have a 1 megapixel image, we're going to still have to visit ~30k pixels sequentially on each core and perform some math. We're probably adding at least a few ms of lag on the feed. And if we're trying to do any multitasking on this cpu, then we may not have very predictable performance.
On an FPGA we approach the problem very differently. Instead of having sequential logic for visiting each pixel, we have combinatorial logic. Supposed each pixel came through on a different wire. That wire goes into a component that holds the previous value for the pixel and outputs the average of the current and previous value. We then take that output and rebuild the video feed with it. On a 1 megapixel image, our unit of work is a single pixel and we have concurrency of 1 million units. We add a cycle or two of lag, which is negligible. Additionally, we have very predictable performance because our computation executes in lock step with the system clock.
FPGA's are expensive (per unit cost) and aren't always the most efficient. An ASIC will drop per unit cost and power requirements significantly but has a large up front capital investment.
Wouldn't that need at least 24M flip-flops in the FPGA (assuming 8 bits per channel color)? I don't think anybody makes one that big.
>On a 1 megapixel image, our unit of work is a single pixel and we have concurrency of 1 million units.
Wouldn't that require 1 million input wires into the FPGA? Otherwise, you could use fewer input wires, but the input signals would need to be multiplexed to allow multiple bit streams to transit a single wire - significantly reducing your concurrency.
The kind of small FPGA as is mentioned in the OT is typically used for "glue logic", that is performing relatively simple logic on multiple pins, often to adapt one hardware protocol (say mipi bus from a camera module) to another (say spi Bus understood by a cheap micro controller).
Most FPGAs are essentially grids of little devices which are programmed to map a certain input pattern to a certain output pattern. Like, 0000 -> 0101, 0101 -> 1111. They emulate logic gates. When you program an FPGA, you are both programming these maps, and setting the connections between them.
(Note: efficient means processing power / electrical power)
ASICs, on the other hand, are custom-built ICs which are designed to very efficiently perform one task, like performing SHA hashes or h.264 decoding.
FPGAs can be more efficient than full-fledged processors because they can make use of custom combinational (combinations of gates) logic along with sequential (clocked) logic. ASICs can be more efficient than FPGAs.
Essentially, there's a tradeoff between development cost, unit cost, efficiency, and flexibility.
flexibility development cost unit cost efficiency
processor ++ ++ - -
FPGA + + -- +
ASIC -- -- ++ ++ASICs aren't necessarily task specific, you can do whatever you want in an ASIC.
Your unit cost analysis isn't quite right either, because what really matters is scale. The primary cost tradeoff between an FPGA and an ASIC is strongly dependent on manufacturing scale. ASICs have high design and tooling costs, but low unit cost after that. FPGAs on the other hand have much lower initial cost, but higher unit cost. Whether or not it makes sense to use an ASIC depends largely on whether or not you're going to ship enough units to amortize the setup costs, hence why a lot of manufacturers often design a single ASIC to be used across multiple products.
I mean, it's stands for "application specific" so it's really just a matter of semantics.
> Your unit cost analysis isn't quite right either
Yeah I realize now my unit cost analysis is confusing. `++` means "best unit cost" aka "least expensive". I forgot to go into the scale issue more, which is where FPGAs can really come into the equation as a good middle ground between unit cost at scale and development cost.
(As an aside, I broke my $400 'scope about a month after purchasing it. One of the rotary encoders just stopped turning and is now jammed and it would be quite the undertaking to repair it. I learned my lesson.)
I disagree. Processors can be programmed in many sophisticated languages and have many built-in features that either don't come in similarly priced FPGA, or you'd have to program into the FPGA itself.
> processor should be more efficient than FPGA
It depends on the workload. Some things, processors might be more efficient at. But FPGAs have the upper hand at many things because they can use combinational logic.
Multiple reasons:
- because writing RTL is fun, while writing C code is boring. :-)
- because it's probably not possible to outputs VGA with your standard microprocessor. You can create a dinky 3-bit VGA output with very little hardware.
- because I may want to DMA data from an external sensor and feed it straight into a DSP for processing, and only use the CPU to deal with the post-processed result. Think multi-channel audio etc.
- because anything that requires fast real-time is probably not possible with the standard microprocessor.
But mostly because writing RTL is fun.
Very nice project!
FPGAs can have deep pipelines, so instead of taking data from the memory, working on it, storing it back and moving to the next, you can take serial data, process it in multiple stages and only writing to memory at the end.
FPGAs can have deterministic timing (with a clock). So you can synchronize stuff in parallel, you can have it respond in nanoseconds, you can follow a signal without losing any sample.
FPGAs can have complex pipelines, so you can take an earlier response from the system, but continue processing your data for a more elaborated response later, without performance loss.
It is very difficult to have a precise timing with a microcontroller unless you have a good one with timers. It becomes impossible to do when you need to toggle several pins at the same time quickly (like a pci bus). You overcome the problem by adding a fpga to your microcontroller board, which will handle the bit flipping and communicate to the micro with a standard bus like spi or i2c.
ASICs are basically FPGA designs etched onto permanent silicon.
ASIC VS FPGA
A Field Programmable Gate Array can be seen as the prototyping stage of Application Specific Integrated Circuits: ASICs are very expensive to manufacture, and once it's made there is no going back (as the most expensive fixed cost is the masks [sort of manufacturing "stencil"] and their development). FPGAs are reprogrammable many times, however because of the fact that a generic array of gates is connected to accomplish your goal, it is not optimised like ASICs. Also, FPGAs are natively dynamic devices in that if you power it off, you loose not only the current state but also your configuration. Boards now exist though that add a FLASH chip and/or a microcontroller to load the configuration at startup so this tends to be a less important argument. Both ASICs and FPGAs can be configured with Hardware Description Languages, and sometimes FPGAs are used for the end product. But generally ASICs kick in when the design is fixed.
FPGA VS microcontroller
As for the difference between a microcontroller and a FPGA, you can consider a microcontroller to be an ASIC which basically processes code in FLASH/ROM sequentially. You can make microcontrollers with FPGAs even if it's not optimised, but not the opposite. FPGAs are wired just like electronic circuits so you can have truly parallel circuits, not like in a microcontroller where the processor jumps from a piece of code to another to simulate good-enough parallelism. However because FPGAs have been designed for parallel tasks, it's not as easy to write sequential code as in a microcontroller.
For example, typically if you write in pseudocode "let C be A XOR B", on a FPGA that will be translated into "build a XOR gate with the lego bricks contained (lookup tables and latches), and connect A/B as inputs and C as output" which will be updated every clock cycle regardless of whether C is used or not. Whereas on a microcontroller that will be translated into "read instruction - it's a XOR of variables at address A and address B of RAM, result to store at address C. Load arithmetic logic units registers, then ask the ALU to do a XOR, then copy the output register at address C of RAM". On the user side though, both instructions were 1 line of code. If we were to do this, THEN something else, in HDL we would have to define what is called a Process to artificially do sequences - separate from the parallel code. Whereas in a microcontroller there is nothing to do. On the other hand, to get "parallelism" (tuning in and out really) out of a microcontroller, you would need to juggle with threads which is not trivial. Different ways of working, different purposes.
https://electronics.stackexchange.com/questions/150058/what-...
Side note, this might seem like stupid question, but can anyone explain what APIO[1] is (which TinyFPGA uses)? I'm kind of confused what it's used for.
apio is a command line tool that automates installing the toolchain for your FPGA and running it. It just simplifies things, you don't have to use it if you'd rather call the individual tools for synthesis, P&R, simulation etc. It'd be reasonable to think of it as akin to a very smart Makefile combined with an automatic package manager, specialized to FPGAs (it's based on PlatformIO). It's nice when you're still kind of getting oriented, because you don't need to know how to set up and invoke the different tools... just call `apio build` or `apio simulate`.
Thank you for the explanation for APIO! Do you use it often? Or are there alternatives that people use when they get to a certain level (Like Atom/VScode --> vim)?
The best place to start is to just grab a book and an FPGA kit and go. You'll probably have to try a bunch of tutorials until you find one that clicks for you and after that it gets easier. For iCE40 you can also check out IceStudio, which is a graphical block based IDE that can be helpful for getting your feet wet. Get some hardware to give you feedback and play with, e.g. a 7-segment display and implement a driver yourself. Watch YouTube videos to get an idea of the general flow of things and eventually it'll make sense. IMO it helps a lot if you have a background in electronics, if not you're gonna be in pretty deep.
I use apio because it's convenient. Hardcore FPGA devs are going to use the manufacturer's IDE. The official Lattice tools for the iCE40 are unbelievably awful and there's not much to gain from using their iCECube2 IDE versus open source ones, but in most cases you don't have any choice in the matter and have to use the manufacturers tools. This isn't so bad though, I've had some exposure to Xilinx's ISE and Vivado and they are pretty decent, plus Xilinx gives you access to a ton of free IP cores that you can drop into your design.
It feels to me like there is an enormous gap between the level of complexity in implementing a simple CPU like I did to something that would actually be useful to anyone, even something relatively small and basic. Things like integrating with other components or building up more complex designs feel outside my reach.
The resources I find are generally targeted either towards a very basic level of how electronics work or a very specific level of a particular task with a device. This seems like a really interesting area, but difficult to get comfortable with.
Maybe even turning a brushless motor with an encoder into a servo motor.
My main idea for using FPGAs would be talking to a couple of i2c/spi sensors and reducing the data rates. Some sensors only have one or two possible i2c addresses, some require multiple requests to get a limited amount of data, reducing the polling frequency.
They are also used on the motor control side, though these days a motor control mcu may be more practical in most cases today.
[0]: http://gnarlygrey.atspace.cc/development-platform.html#updui...
It would be very nice to bring the cost of experimentation in CPU cores down to something easily accessible to even students. In the same way that RPI brought computing and hardware interfacing down to basically anyone who can afford a cup of coffee.
https://www.cnx-software.com/2018/09/04/licheetang-anlogic-e...
With earlier FPGA Learning boards, the designers tried to cram a ton of stuff into them, usually a gazillion pins, leds, input devices and connectors. You can't easily put that on a Raspberry Pi or Arduino.
Finally, the UP5K is actually fairly slow (when it comes to routing timing) compared to the iCE40 HX/LP, and especially compared to other, more modern FPGAs. The iCE40 routing in general also tends to be underwhelming at high density designs.
Are there any go-to IDEs that everyone uses? Resources/tutorials towards a `blinkenlights 101` project that are especially useful?
Edit: thank you all for the very excellent answers! I'm going to lose so much productivity over this!
- synthesis -- this converts the text description from HDL into gates (fun fact you can write valid HDL which cannot be synthesized into hardware)
- place & route -- this takes what is essentially a schematic from the first step and assigns it to resources within the FPGA. This is also where you specify which pins on the FPGA you want to be connected to the schematic outputs.
- timing closure and simulation -- This is the process where the FPGA place and route core is trying to either make your design fit in as few gates as possible or run as fast as possible (these choices often conflict so you have to prioritize one over the other)
- bitstream generation -- This is where an often encrypted stream of bits are generated such that if they are fed into the FPGA they will set all the internal switches etc to realize the design you've put together.
- programming/flashing -- most systems use JTAG to do this.
When I started doing FPGA designs the hardest part for me was to break the notion of "software" when I was writing VHDL. You have to keep your head in the 'one clock' every variable gets to change exactly once in this block.
Netlist is better, but to someone outside of digital design but with software background, I think I would call it a textual listing of the gates of the design and their interconnection. A graph.
One of the ways I've helped SW types understand FPGAs was to describe the basic CLB as a subroutine that you program by setting very specific parameters and it has an input of some number of bits and a "clock" bit, and outputs the same number of bits. And the "program" is similar to the calling sequence of all these subroutines tied together.
Then I start rattling off VHDL books to read :-)
Although now that I said that, I guess with fpgas that is sort of always true. Programming fpgas is the equivalent of sending a file via FTP. Nowadays at least.
However to verify the behavior on the FPGA and actually program it into the device you'll usually need some vendor specific tools, for Xilinx (what I'm familiar with) you'll need a software package called Vivado. It provides information on whether or not the timing you've requested is possible, whether any part of the chip will get too hot, whether the design actually fits in the limited resources of the FPGA, as well as implementing, optimizing and outputting the design to the FPGA.
Lattice has an open source toolchain available at least for some of their devices, for Xilinx there are efforts to produce a reverse engineered toolchain but I don't know how functional they are, there are free (but not libre) versions of Vivado as well but you'll need to fill out US export paperwork and it doesn't support all Xilinx FPGAs unless you pay. I don't know what the story is with Altera.
There isn't really a go-to IDE that everyone uses. Each vendor have a proprietary IDE and they're all very bad. Lattice FPGAs have an open-source toolchain, but it's all command-line tools so you're left to build your own workflow of choice.
If you have an issue the solution shouldn't be to throw it away and buy a new one, that's incredibly wasteful and it encourages bad behavior by the manufacturer.
Ive never did FPGA design. what's good resources to start reading to get caught up with the basics? Figure I should ask those more in the know.. :)
(or just buy them, there's at least one on crowd supply, another was on kickstarter in the last couple years, etc)
You could probably skip right to Verilog/VHDL, but I really suggest having a background in digital logic.
FWIW, I'm just an embedded software guy. I came from an EE background but it's been a long time since I've played with programmable logic.
Can anyone else recommend any other cheap entry level boards?
https://www.digikey.com/product-detail/en/lattice-semiconduc...
You'll need a USB blaster to program them, which adds another $10 or so.
They are small, but they are still large enough to add a little CPU with a little RAM, plenty of hardware multipliers etc.
I know this makes a few assumptions on what you mean by "Cheap", but I find sub $200 for FPGA boards to be pretty affordable when compared to the gamut.