Reinventing VHDL Badly

A few years ago, Philip Peter started a little pet project. He wanted to build his own processor. This really isn’t out of the ordinary – every few months you’ll find someone with a new project to build a CPU out of relays, logic chips, or bare transistors. Philip is a software developer, though, and while the techniques and theory of building hardware haven’t changed much in decades, software development has made leaps and bounds in just the past few years. He’s on a quest to build a CPU out of discrete components.

Search the Internet for some tips and tricks for schematic capture programs like KiCad and Eagle, and you’ll find some terrible design choices. If you want more than one copy of a very specific circuit on your board, you have to copy and paste. Circuit simulation is completely separate from schematic capture and PCB design, and unit testing – making sure the circuit you designed does what it’s supposed to do – is a completely foreign concept. Schematic capture and EDA suites are decades behind the curve compared to even the most minimal software IDE. That’s where Philip comes in. By his own admission, he reinvented VHDL badly, but he does have a few ideas that are worth listening to.

A circuit design split into modules (top) which is turned into a mostly complete PCB after running a script (bottom)
A circuit design split into modules (top) which is turned into a mostly complete PCB after running a script (bottom)

Philip is using Eagle to build his small processor – not that there’s anything wrong with that – but with the choice of EDA suite comes a 30-year history of updates to what is essentially a program written for DOS. That said, Eagle does have a lot of options for scripting common tasks, and combined with a few custom Python scripts to write those Eagle scripts, Phillip managed to do a lot with a little.

In designing a single module for his processor, Philip split this circuit up into even smaller modules. By defining the base units of the circuit, these modules could be tied together and automatically placed on a board. Eagle, of course, always adds unplaced components in a line going down the side. For a board with hundreds of components, merely organizing everything so a layout is possible can take up the majority of the design time. Philip scripted Eagle to do this automatically, something that should be applauded.

Taking a software development background to schematic capture and board design can go so much further than adding modules and objects to Eagle, though. Test-driven development is where it’s at, and Philip is designing his processor with the belief that eventually, he will mess something up. Software devs are humble like that.

The implementation of test-driven development is interesting, and something we haven’t seen in a hardware context before. He defines modules – an XOR, for example – as a series of tests. If input A is False, and input B is True, the output will be True. Philip is relying on SPICE, a simulator for analog hardware, to see if the circuits will pass the unit tests.

Schematic capture and board design is a very, very hard problem to solve. Eagle has been in development for almost 30 years, and it’s still not ideal. Altium has been around for even longer, and there are still problems and unintuitive ways of doing things. KiCad is still a baby at 25 years old, and the general assumption is that KiCad is getting there, but it isn’t for prime time yet.

What Philip has done is bring tools and techniques in from the software development world, producing something that is much, much better than what we have now. It’s more abstract, yes, but that’s never stopped anyone from putting enterprise Java on their resume.

21 thoughts on “Reinventing VHDL Badly

  1. This is a gap I was hoping “alternative” schematic programs, like Fritzing, would fill: being able to simulate even a simple 74x chip would definitely cut down the amount of “oh crap that net that looked totally connected on my screen but it actually isn’t” errors

    1. Eagle does have the ability to drop in other schematic files into a parent schematic and the board layout will transfer as well. It their way of organizing and reusing sub-systems. You can hold down a control key and drag a schematic file from the project browser into the current open schematic and the layouts will copy too.

  2. Altium (which I use) has impressive scripting capability and does some basic circuit analysis. I haven’t used that part myself since I do RF and not digital. You can also select groups of components on a schematic and then switch to layout and have them all plunk down together. No more searching in that long line.

  3. “KiCad is still a baby at 25 years old, and the general assumption is that KiCad is getting there, but it isn’t for prime time yet.”

    Maybe “we are forced to post ads for Eagle disregarding years of recent advancements in KiCAD” would be more honest? Eagle is not even close. For years already.

      1. You’re forgetting the fact, that “prime time” is for professionals. And nope, it’s not there yet and I used it like 5 months ago the last time.
        User interface is sloppy and unfinished, two different canvases don’t agree with each other and you have to be in right mode to do different things, library management is difficult, creating new components isn’t intuitive and is error prone… there’s no high speed design capabilities and push & shove router has features missing. There’s no rigid flex deisgn functionality…
        So yep, it’s not there yet… but let’s hope it will be. It’s much better now with Wayne in the lead of the project but it still needs organized and large scale effort to be ready for professional use. :)

        That being said… Eagle is horrible, but it’s way more consistent in it’s user interface and easier to learn, component creation is simple and project management is easy..

        But that’s all it’s good in. No push & shove, no high speed design capabilities, not proper hierarchical design capabilities yet (schematics works ok, but has some stupid design decisions in part numbering etc.), no good panelizing capabilities (where the panel is comprised of instances of your board and isn’t separate layout in itself)… etc.

        Anythign small and easy, Eagle… anything professional and large scale: Altium Designer that costs arm and a leg… but it’s worth it in saving time and getting stuff done.

        :)

        1. Interesting projects like this could serve as an argument to KiCAD developers. I have reasons to believe that [Philip] made his choice of a CAD not in the least based on purely cosmetic reasons and early impressions. And it’s a good argument that the mess that KiCAD has instead of UI is not purely a superficial problem. Here we are, an important user with an interesting project that could be done in KiCAD and result in who knows what kind of interesting developments in it, all lost to dead-end Eagle.

  4. What you’re really talking about is a software suite that integrates together schematic/netlist capture plus SPICE plus PCB layout, and there aren’t too many of those.

    The Proteus VSM suite would be one such example.

  5. Your criticisms only apply to the PCB part of EDA — which, yes, is still stuck in the Dark Ages.

    The VLSI design world (using schematics and geometric layout, not synthesized HDL) hasn’t had these problems for ages.

    No serious chip layout tool less than 30 years old has the “programs like KiCad and Eagle … if you want more than one copy of a very specific circuit on your board, you have to copy and paste” problem. Hierarchical schematics (SPICE X-element) and hierarchical layout (GDS subcells) are baked into the industry’s most bedrock data formats.

    The problem is not EDA or electronics, it’s the PCB subculture which is so broken.

    1. Yes – 100% this. VLSI regarding tooling is very advanced. Every complaint from original post is solved long time ago. However the philosophy is different – usually there is no one monolithic program but a lot of them talking to each other using some kind of data exchange format. Also there is much more use of formal/static verification compared to software word (at least that is my feeling). However all this goodies come at the cost:
      1) The single licence of one tool in the vicinity of 100k$ is nothing unheard of
      2) In medium to larger company there are engineers whose full time job is to compose and maintain design flows (making sure that all that programs talk to each other in correct way)

    1. Maybe it’s beyond your reach. Or there are too many quirks for you (and there are really many).
      But it’s fucking powerful and that power is now unleashed by Open Source tools such as GHDL (I have written extensions for this that would be out of the realm of Verilog). Even the 23 years old version of VHDL is more powerful than current Verilog.
      And yes, I unleashed a troll. I’m generous like that :-)

      1. Salut. I wouldn’t mind reading a hackaday-style brief article about the differences between VHDL and Verilog. I used to be sure that at least their synthesizable subsets are equivalent, more or less. I used both for FPGA and the differences that I encountered were mostly of syntactic nature. Care to elaborate what do you mean by “more powerful” ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s