FPGA Assemblers and Time Machines
Flashback to 1986. A young man has a crazy idea - he wants to make a CPU all by himself. He is reading early Xilinx manuals cover to cover as if they were novels. Yes, you are quick - this is indeed a (mostly) true story about me and my dream, suddenly made possible by this new FPGA technology.
Sadly more than 20 years went by before my first CPU ran in a Xilinx FPGA. Why did it take so long? Every few years I set up the tools and every time I walked away, scared silly. As the years progressed, FPGAs became bigger and slightly more complicated. The tools became MUCH bigger and orders of magnitude harder to use. And left me even more a-scared.
The FPGA itself was not that hard to understand. A grid of cells, IO primitives on the edges, some memory blocks, maybe multipliers. In the middle, a repeating structure of lookup tables and flip-flops. And lots, lots of wiring.
The tools, on the other hand... I was used to complexity and hard-to-use software, but what I encountered was fantastic. Even when I got things working after days of cursing and pounding the keyboard, solutions and workflows were so cumbersome that I could not imagine ever doing it again. How could anyone actually do anything productive with these tools? Who were these wizards using them?
So I would try again, and walk away in disgust, feeling stupid and inadequate. Of course, every few years the tools would become almost unrecognizable, altered by new user-interface fads. And as computers got faster, the tools seemingly became slower and more painful to use. Yes, the world has gone crazy!
Unable to take any more of my nonsense, you exclaim, "Silence, you fool. Enough complaining." You slap me across the face, for good measure, and continue, "Clearly, the technology works. We all have HDTV monitors, cameras, cars and microwave ovens that were all built by engineers using these tools."
Moving slightly out of your reach, I cautiously reply, "You are correct. But I have two problems: (1) it's just no fun. I am an old-school hacker. I like tinkering, not running timing analyses. Describing circuits in VHDL, for me, is about as much fun as filling out tax forms, and running simulations is kind of like waiting for a tax refund. By the time you get it, you forget what's on the tax form. And most importantly (2) - the tools are kind of wrong. Here, why don't I just show you!"
Without any further warning, I whip out my time machine (which looks a lot like an enormous wristwatch) and propel us backwards deep into the 1970's.
ZAP. We are hovering above and a couple of feet behind an engineer walking down a hallway, like the camera view of a 3D shooter game. A door swings open and we are in a room with an enormous light table covered with large overlapping transparent sheets filled with lines and scribbles. Wait, that's Bill Mensch laying out the 6502 by hand! No synthesis tools. No simulation tools. No timing analyses or automated test vectors. Fun and exciting? Yes.
Let's move a few years later. Ah, that's more like it. A bunch of engineers in cubicles crunching complicated numbers on big computers. They are designing a chip. Zoom in on a whiteboard... Ok, major time savings from running simulation software to catch errors and avoid millions of dollars in wasted VLSI runs. Fast forward. Meetings. Deadlines. Personnel problems. Moving to new headquarters. All right, that's enough. I am sure the shareholders are happy, but for me - no fun here.
Ok, let's move my time machine way forward. As the dust settles, we see what looks like a bedroom. A deranged-looking man, wearing only underwear, is leaning over a makeshift table with a laptop spitting out hundreds of warnings messages on the screen. Close-up of a schematic on the table: looks like he is building a simple 7-segment decoder circuit. He is holding a stopwatch - it's showing just over 1 minute since he clicked on the 'go' button, surely for the hundredth time today. He is not having fun - he seems agitated and... Wait a minute, that's me, writing my next blog entry next two weeks from now! That darned time machine!
Game, set and match. Here I am, with my $5.00 FPGA that is completely reprogrammable in well under a second. I am not setting up for a VLSI run that will cost a million dollars, not at all. If I make a mistake, I will lose a few minutes. Actually, with manual placement and preserved routing (most of my rebuilds are with very minor changes) it really shouldn't take more than a couple of seconds, right?
So you see, I want to manually layout my FPGA and have a tool that takes seconds to actually shove my design into the FPGA. Instead of simulating my design I want to burn an FPGA and STUDY it. I want to insert probes into it and really study it, live, maybe with another FPGA feeding it test data and clocking it, for another $5.00. If I am not happy with the timing, I can adjust placement and routing within a module. In seconds, folks!
I want to spend my time understanding the FPGA substrate and how my logic interacts with it, not memorizing the quirks of verilog. What I need is the equivalent of 'assembly language' for the FPGA. You can count on your assembler not moving everything around every time you run it. That is the domain of the C++ compiler, thank you.
Where is my FPGA assembler? What year is it, 2012? Google is still in business then. Google 'FPGA assembler'. Darn, no such thing. One would think that the first tool developed for a chip would be a low-level assembler-style language.
But I have tricks literally up my sleeve. I will just crank up the time machine again and see if anyone will have written it in the future. Hold on a sec. Yup, just as I thought - I will write it myself soon. Looks like it will be called 'fpgasm'. Let's take a look. Very clever! Since 'stealing' from myself is not a crime, I think I will just make a quick copy to my thumb drive. The source code too. And the manual, thank you. There. I think I'll just put it up on github and Sourceforge here in 2012 for a gag.
As soon as I figure out how to use fpgasm I will let you know. So long!
P.S. Thank you for your support. Please post fpgasm-related suggestions on Sourceforge fpgasm forum, or better yet, fork the fpgasm project at github and implement your idea. It's open source, after all!
If you think "you can already do it with existing tools" - sure you can, but it's hard, unpleasant and takes way too long.
- Write a Comment Select to add a comment
To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.
Please login (on the right) if you already have an account on this platform.
Otherwise, please use this form to register (free) an join one of the largest online community for Electrical/Embedded/DSP/FPGA/ML engineers: