Before you start reading, please note that this post is for software developers and software developers only. In particular, it is for those who want to start programming their logic on FPGAs.
The reason behind this post is simple. I have been asked a few times about what is the best way to become a digital logic designer (or FPGA programmer, though technically an FPGA programmer is a combination of hardware and software that is used to physically burn the logic into FPGA chip, but anyway).
What people usually do.
The classic way of getting a needed skill set is to go to a college, study an electrical engineering, get a job in a relevant field and go from there. This pretty much applies for every field be that a computer science, medicine, truck driving — you name it.
How software developers do it?
However, things can be a lot different for those who are professional developers already. There are many reasons for that. Below are a few scenarios of how it usually happens that a software developer wants (or needs) to become a hardware logic designer.
How people end up in this situation?
Why? Reusing existing resources.
It starts with a popular belief that programmers are all around computer professionals that, given a handful of sand, can build a computer from scratch. Well, maybe that’s a bold statement but the point is that pretty much every programmer got a call from a friend or a relative asking for help because something in some program didn’t work or they didn’t know how to do something. It is usually pretty hard to explain that you have no idea what they are talking about just because you are a computer guy, thus, supposed to know everything. The situation is improving over time but is far from going away. Anyhow, the point is that this is a common belief and this belief is wrong. Programmers are like writers in some ways — a writer does not necessarily know about all types of paper our there or in depth details of paper making process. Yet they know how to use it. Some writers, though, may have written a book or a manual on paper making process or are way too curious and they actually know it. So you cannot just get a writer and ask him to run a paper making business. Nevertheless, the belief is right there in people minds and it is not uncommon for a company that develops its own software and decides to go into hardware design to try and use existing inside resources. This is especially true when talking about programmable logic technologies like FPGAs — the line between software programming and logic design in Verilog seems too thin for those not familiar with this matter. And so there we have a software developer trying to become a digital logic designer.
Curiosity and going down the abstraction levels.
Another common thing that happens is when developers decide to do low level stuff such as designing their own hardware. It may start from a nature of the work that is being done by a software developer. For example, curious embedded programmers writing drivers for some hardware may try to go and figure out how exactly that hardware is made, and try to create their own, similar hardware. It also may start from a nice hobby like building toys based on Arduino platform and getting deeper in details with time. In my case, it was curiosity combined with an attempt to achieve the lowest possible latency for the high-frequency trading applications.
What comes to mind next?
There could be endless number of reasons to want to get into this field. If you have recognized yourself in one of the above examples or if you are just interested in starting FPGA development, please continue reading. What usually happens next is very interesting.
If a baker wants to become a doctor, he or she would probably start by going to a medical college and study for that. The similar thing would probably happen to a pilot who wants to become a bodyguard — he or she would probably attempt to get some military background, take necessary courses etc. However, this is not the case for software guys. Since all of the software engineering has evolved from a hardware engineering in a first place, programmers tend to think that it is like switching from programming in PHP to programming in C — one does not need to go to a college and start from scratch in that case, right? So why do that to start programming for FPGAs? It seems like there is no need to do that — it is easier to just go down a few levels of abstractions, learn whatever you didn’t know before and that’s it. After all, this happens a lot with software developers when switching from one programming language to another, or porting code from one operating system to another, or converting between processor architectures. The bitter truth is that it does not work like that with FPGAs at all. This path is very thorny and oftentimes software engineering skills and an approach from developer’s perspective make it only harder.
A piece of advice.
So you are a software developer. You want to become a digital logic designer. You don’t have a spare 5 years to go to a college and learn electronic engineering just to employ FPGAs in your work. Where do you begin? It is indeed a very good question.
Digital design does not have a lot in common with software development. Maybe except that Verilog syntax looks a bit like C language but it just looks. All in all, it is very hard to answer this type of question adequately in a first place. But as a guy who walked down the path from software development to hardware design I am giving it a shot. Bear in mind that this is just an advice based on a (successful) personal experience. Looking back at myself, here is how I would have advised myself back then if I knew what I know right now.
Start from scratch.
Forget everything about software development. Especially programming languages. Those principles do not apply in digital design. It probably would be easy for a guy who designed a CPU to program it in assembler or even C, but an assembler programmer won’t be able to design a CPU.
On your learning path do not tend to solve what seem to be an easy problem with your existing knowledge from software. One of the classic examples is a “for loop”. Even though you can write a “for loop” in, say, Verilog — it serves a very different purpose. It is mainly used for code generation. It may also be a “for loop” as software developers see it but it won’t be good for anything but simulation (i.e. you won’t be able to program FPGA like that).
So for every task you want to tackle, don’t think you know how to do it, do a research instead — check books, examples, ask more experienced people etc.
Learn hardware. Learn HDL language.
The most popular HDL languages are Verilog and VHDL. There are also vendor-specific ones like AHDL (Altera HDL). Since those languages are used to describe hardware components, they are all pretty much used to express the same thing in a similar fashion but with a different syntax.
Some people recommend learning Verilog because it looks like C. Yes, its syntax is a mix of C and Ada but it doesn’t make it easy for a software developer to lean. In fact, I think it may even make it worse because there will be a temptation to write C in Verilog. That’s a good recipe for having a very bad time.
Having that in mind, I’d recommend staring from the VHDL. Though Verilog is also OK as long as the above is taken into account.
Another important thing to keep in mind is that you must understand what you are expressing with that language. What kind of hardware is being “described”, how it actually works?
For that reason, I’d recommend you get yourself some book on electronics in general and a good book like this one — HDL Chip Design (aka as a blue book).
Get a simulator.
Before you start doing anything in hardware and use any Vendor-specific features etc., get yourself a simulator. I was starting with a Verilog, and used Icarus Verilog along with GTK Wave. Those are free open-source projects. Run examples you see in books, practice by designing your own circuits to get some taste of it.
Get a development board.
When you feel like going forward, get a development board. If you know that your employer wants to go with Lattice, then get Lattice board.
The programming methods are very similar, but there are details that are different. There are different tools, options and/or interfaces. Usually, if you have experience with one vendor, it is not hard to switch. But you probably want to avoid this extra learning curve at the beginning, if possible.
I’d also make sure that the board comes with components that you are planning to use or is extendable. For example, if you want to do design a network device like a router, make sure the board has Ethernet PHY or it can be extended through, say, HSMC connector, etc.
Boards usually come with a good reference, user guide and design examples. Study them.
You will need to read books. In my case, I had no friends who knew digital design, and this site wasn’t very helpful either because of one simple thing — I didn’t even know how to phrase my question. All I could come up with was like — “Uhm, guys, there is a thing dcfifo and I heard something about clock domain crossing challenges, what is it and why my design doesn’t work”?
I personally started with these:
- Advanced Digital Design with the Verilog HDL.
- 100 Power Tips for FPGA Developers
- Advanced FPGA Design - Architecture, Implementation and Optimization.
- FPGA vendors have a lot of cookbooks with best practices. Study them along with reference designs. Here is one from Altera, for example.
Ask specific questions.
While you go through your books, simulate a design, blink some LEDs on your development board, you would, most likely, have a lot of questions. Make sure you don’t see an answer to those on the next page of the book or online (i.e. in the Lattice-specific forum) before asking them. Once you feel like you cannot find an answer yourself, try asking it in one of the user forums or Q/A web sites like Electrical Engineering Stack Exchange.
Hope it helps. Good Luck!