Adventures in Autorouting

Why are we humans still wasting our time doing a crappy job at manually routing printed circuit board traces? If a computer can beat the best Go player on earth, surely it can route a mess of traces better than idiot me!

Topo I give up after 15 mins 2017-10-21 20_04_14-TopoR.png

Let’s try out a few of the latest and greatest auto-routing programs to see how useful they are routing my new board!

The Board

A new PCB for the Blinks gaming platform. It is basically an Arduino with RGB LEDs for blinking and IR LEDs for communicating. This new version adds a Service Port so developers can talk to their programs at 0.5Mbs while debugging (way cool, right?!).

Simple schematic:

2017-10-21 20_40_07-Schematics - [C__Users_passp_Documents_GitHub_move38-blinks_diptrace_tile_tile.d

Many (but not all) components on the board must be in fixed locations:

2017-10-21 20_43_34-PCB Layout - [C__Users_passp_Documents_GitHub_move38-blinks_diptrace_tile_tile.d.png

I’m guessing it would take me at least 10 hours to manually route this board, and I would be grumpy the whole time, and I would not be happy with the results because I demand better quality than I have the skills or time to be able to produce.

Eremex TopoR

Topographical routing with smoothly curved, minimal length traces. Sign me up!

This is what TopoR looks like while routing….

Topo R in progress animation.gif

Look at all those crazy topographically guided spiderwebs! After about an hour of my CPU blowing at full blast while I watched cat videos, TopoR suggested that it had done about all it could do. It presented a layout with every trace routed and not a single design rule violation…

2017-10-22 01_05_29-PCB Layout - [C__Users_passp_Documents_GitHub_move38-blinks_diptrace_tile_tile-f.png

Wow! I do so love the optimal directness of the traces! This is a nice route!

I am a little concerned about the way the traces sometimes connect to the corners of the LED pads. Will this make them harder to inspect after reflow? We’ll see! Maybe there is a way to turn this off, but I can’t find it.

Here are the numbers…

2017-10-22 01_15_50-PCB Layout - [C__Users_passp_Documents_GitHub_move38-blinks_diptrace_tile_tile-f.png

After seeing this output, I was ready to buy TopoR. Even if it only worked on this design, it would have already paid for itself. Unfortunately, it seems to be hard to buy. You have to register on the website to place an order, and the registration doesn’t seem to work. Grumble. I will report if/when I am finally able to buy it!

Conclusion: TopoR is very, very cool and gets so much so right. It gave me a usable (actually excellent!) design with only a couple minutes worth of work on my part. I’ll try on future designs to see if the magic lasts, and will report back here!

KONEKT ELECTRA

Shape based, optimal routing solution adapting to the natural flow of the nets while following advanced DFM and timing constraints. This is what I’m talking about!

This is ELECTRA whilst routing…

2017-10-21_20-11-34.gif

This first time I ran it, it finished in a couple of seconds with 12 unroutes. Not a good default behavior! So I bumped up all the the iterations so it would at least try.

Here is the best route it could come up with after about 15 minutes…

2017-10-21 22_30_10-PCB Layout - [C__Users_passp_Documents_GitHub_move38-blinks_diptrace_tile_tile.d.png

Not bad looking from afar, but there are still 4 unroutes! Looking closer, one of them is a silly no brainer. Really computer, you couldn’t figure this one out on your own?…

2017-10-21 22_31_37-PCB Layout - [C__Users_passp_Documents_GitHub_move38-blinks_diptrace_tile_tile.d.png

The others, not so easy. Everything is totally walled into a corner, with no obvious way out. It would have taken hours and hours of doing large parts of the route over to get everything connected.

Conclusion: Give me reasonable defaults – or at least ask me what I want. Don’t give me an almost finished route where you do all the easy parts, leaving me to try and clean up your seemingly unroutable mess. No value, at least for this board.

Diptrace Autorouter

As far as Windows EDA goes, I am a Diptrace fan. While Diptrace is far from perfect, at least it doesn’t continually punch me in the face like EagleCAD does.

Diptrace has an autorouter baked in, and it is only one click away. I picked “shape-based”.  It looks like this while routing…

2017-10-21_22-47-28.gif

After about 10 minutes of taping and ripping, it passed back this route…

2017-10-21 23_01_35-PCB Layout - [C__Users_passp_Documents_GitHub_move38-blinks_diptrace_tile_tile.d.png

There are two unroutes… but they are far from deal breakers. There were visually obvious paths for each of them, even to a stupid human like me. Why would it leave these easy ones for me? Just to make me feel invested in the process?

It only took about 5 minutes to manually complete the board and I had a working layout with no design rule violations.

I think took another 45 minutes or so to do some optional clean up, like pulling in the corners of wide turns to shorten the traces, and straightening the kinks out of twisted segments around the angled LEDs. The computer should have done all this for me in an automatic last pass that might have taken a couple milliseconds.

Here are the final the numbers…

2017-10-22 00_13_11-PCB Layout - [C__Users_passp_Documents_GitHub_move38-blinks_diptrace_tile_tile-f.png

Not bad, and if I had not already seen the TopoR results I would have been very happy with this route and the amount of time it took to get there.

Conclusion: Considering it is free (either with Diptrace you buy or the free version) and so fast and easy, there is value here. While it took a little time to get a usable design and even more time to get a decent design, either way saved me many hours compared to manual routing and probably I ended up with a better result.

FreeRouting

The real FreeRouting mysteriously disappeared from the web many years ago, but has recently resurfaced in many places and many forms. I tested this version that seems to have been well cared for recently.

The real promise of FreeRouting is that it is open source, so if you don’t like something about it, you can fix it. Let’s see if it offers a good starting base for that!

It looks like this while routing…

2017-10-22_01-35-52.gif

After letting it do it thing all night, we ended up with this hot mess…

2017-10-22 11_01_19-PCB Layout - [C__Users_passp_Documents_GitHub_move38-blinks_diptrace_tile_tile-t.png

Hundreds of rule violations and lots of unrouted nets. Hmmm. This is not promising.

Conclusion: Unless I picked a really wrong fork, or I am doing something else something terribly wrong then this autorouter is not useful.

What I Really Really Want

While TopoR and (to a lesser extent) DipTrace are useful and time saving tools, what I really want is an autorouter that always does a better job than the best human router and takes no human time to do it.

We need to give the router more freedom.

Freedom of location. In this design, I only care where the LEDs and button are placed.  All the other parts could be moved to pretty much anywhere they will fit. There is currently no way to tell this to the autorouter.

Freedom of rotation. The RGB LEDs could be rotated to any angle as long as the centroid stays in the same place. Imagine how much better the router could do if it was not locked in to these arbitrary fixed angles!

Freedom of connection. In this example, each LED pin could have been connected to almost any GPIO pin on the chip. Big EDA systems like Altium have limited pin swapping abilities, but I want more. I should be able to state my connection constraints like this…

IR3-1.endPoint={U1-[1...23],U1-26,U1-29}
IR3-2.endPoint={U1-[1...23],U1-26,U1-29}

Which means “You can connect either pin of IR3 to any of the following  pins on U1: 1-23, 26, or 29”.

Now I’d also add…

IR3-1.endPoint != IR3-2.endPoint

Which means “…but the two pins of IR3 must be connected to different pins on U1.”

 

Now designing a circuit board becomes more like writing a program, and the autorouter is more like a compiler/constraint solver than an interactive CAD tool. Besides spitting out the board design files, it would also give me header files to include in my firmware so it would know which pins ended up connected to what.

Next I’d want the autorouter to be able to run headless from a command line so I could launch hundreds of parallel instances on a cloud computing platform like AWS or AppEngine. I’d enter my circuit constraints, hit “compile” and then watch as all the instances spun up and started delivering better and better routes until one met all my constraints.

How would this crazy complicated, highly dimensional topological multi-constraint solver actually work?

I have no fricken idea. I’m not smart enough to write it. Maybe no one is. But that’s ok.

Computers have recently gotten very good at teaching themselves how to find solution paths though astronomically huge search spaces defined by geometry and arbitrary rule sets. Amazingly good at it.

We can let our autorouter teach itself how to do autorouting and it will likely come up with strategies we could could have never imagined (and we might not even understand when we see them).

With all this freedom and smarts, we should see much much better boards than possible now. Imagine today’s standard 4 layer boards routinely being fit into 2 layers without any human effort. Think how much time and money that will save!

How to make $100,000,000

  1. Write the kernel of the above self-learning, constraint solving autorouter.
  2. Train it long enough that it is an order of magnitude better than any human.
  3. Use your new autorouter to re-process a few famous open-source boards. Publish (and even start selling) a single sided Arduino and 4-layer Raspberry Pi.  People will notice. Bask in the Hack-a-day & Slashdot glory.
  4. Start offering a cloud-based service were anyone can upload their Electra DSN files. Let them optionally click on some parts to indicate they can be moved or rotated if they want an even better result. Then do a smash-up job autorouting the board and tell the person about the results… but don’t give them the actual output files until they pay up. “Congratulations! We were able to reroute your board from 12 layers down to 8! Click here to pay $25,000 and download your SES file!”.
  5. Sleep well at night knowing that you never ever let your magic IP free in the wild. People only download their output files, your software and weights never leave the safety of your cozy servers.
  6. Wait for the phone to ring. It is Autodesk/Google/Apple/Amazon. They want to buy you for $100,000,000.
  7. Agree, sign the paper work, fly to NYC (private) and buy me a cup of coffee.

FAQ

Q: So what’s this article about?

People say autorouters will never be better than humans, and only wimps use autorouters and they get crappy layouts. Those people are wrong. Using TopoR, I got a much better layout than I could have done by hand and saved probably a dozen hours of work. Soon, autorouters will always do a better than humans on all routes – and I have some ideas on how to make that happen better.

Q: What versions of software did you use?

  • TopoR 8 Layer 6.3.17786 (x64)
  • DipTrace 3.1 (May 29, 2017)
  • Electra Demo Version 6.30
  • miho/freerouting release 1.3.0

Q: Do you work for Emerex or something?

No, and they won’t even seem to let me register for an account on their website so I can buy the damn program. I never even heard of TopoR up until recently – I found it by lucky google search. But I have been looking for (waiting for?) it for a long time. I am going to buy it as soon as I figure out how.

Q: I am trying to follow your instructions to make $100,000,000, but I can not afford the compute time on AWS to do the enforcement phase training since I am only 12 years old and am living in eastern Europe. 

Just do the same thing you did last time.

Q: My mother said I am not allowed to write GPU cycle stealing worms anymore. She also made me give the Corvette to my uncle. :(

If you can really convince me that you are on the right track to training up a neural network to do first class autorouting, get in touch and I will make sure you have access to whatever resources you need to take the next steps. Note that this means that you will only make $75,000,000 because I will take 25% of the company, so try really hard to do it yourself first.

Q: Why didn’t you try [tool x]? 

Either because (1) [tool x] is Eagle and I hate getting punched in the face, (2) [tool x] costs more than a car and doesn’t have a trial version, so I don’t have it, or (3) I don’t know about [tool x].

If you have access to [tool x], please run the DSN file for this board here and send me the SES file so I can report back on how awesome/awful [tool x] is!

Q: You set all the settings wrong when testing [tool x], no wonder it sucked for you. 

See above question. Please rerun the file with your favorite settings and LMK how it does!

Q: I could have done such a better manual route than your stupid program. 

I don’t think you can, but even if you can- why would you?

Q: I’ll only ever buy “Designed By Humans” products, and you should too or they’ll come for your job next!

You will need to get used to buying inferior and more expensive stuff soon, and eventually you will only be able to be crappy old stuff on ebay.

And they will definitely come for your job first.

Q: If you let a computer layout your circuits, then anyone can copy your boards and you can’t stop them. 

This is actually a real and absolutely fascinating issue that I never even thought about before I met Ari.

UPDATE 11/1/2017

I got back the first batch of the TopoR routed boards… and they work perfectly!

2017-11-02 01.53.52.jpg

I may have manually routed my last board ever, folks – and I have no nostalgia for all those countless hours I’ve wasted in the past!

8 comments

  1. Douglas

    There was a product called NeuroCAD. It was bought in the mid-late 90s by ??? http://semiengineering.com/kc/entity.php?eid=22284
    They claimed it used a neural net to do the routing. They killed it. It was awesome. At the time we were working on round boards for explosion proof instruments. The enclosure is round, so the explosion won’t blow it out. It would follow a round outline. Every other product at the time squared the circle. Arrrrggg.

  2. Tomek

    You may want to revisit freerouting…It actually works quite well (for me). My guess is the rules aren’t setup correctly (not necessarily your fault, could be a .ses issue.) I use KiCad and go direct to freerouting without needing to change my design rules, but you can double check what the design rules are seen as in freerouting to confirm they’re setup correctly for your board.

      • Julian Loiacono

        FreeRouting at 0deg is abysmal. 45deg is quick and effective.

        I was able to acquire the following in mere minutes of FreeRouting:

        Via costs: 50
        Start pass: 1
        Ripup start cost: 100
        In/against preferred, both layers: 1
        Routing 45deg, no restriction on pin exit
        No violations
        4 incomplete

        Curiously, the 4 incompletes are all LED+ pins. This is consistent between successive runs of the autorouter. Perhaps some condition of these nets is confusing the router?

        • bigjosh2

          Thanks!

          That is certainly much better than I made out with FreeRouting… but not particularly good. I can’t think of anything special about the IR LED anode nets – they are the same class as all the other non-power nets. Hmmm…

          • bigjosh2

            I think I prefer the original TopoR route to this new one because there are less traces squeezed around the edges. But both meet design rules and look nice!

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