GithubHelp home page GithubHelp logo

nfwq666ya / freerouting Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freerouting/freerouting

0.0 0.0 0.0 13.41 MB

Advanced PCB auto-router

Home Page: https://www.freerouting.app

License: GNU General Public License v3.0

Java 95.53% Haskell 0.05% HTML 3.55% Lex 0.57% Batchfile 0.16% Shell 0.15%

freerouting's Introduction

Freerouting

Freerouting

Freerouting is an advanced autorouter for all PCB programs that support the standard Specctra or Electra DSN interface.

Release version License

👉 This project needs JAVA and UI/UX volunteers! Contact @andrasfuchs for details! 👈



Installers for Windows, macOS and Linux can be downloaded here.

Introduction

This software can be used together with all host PCB design software systems containing a standard Specctra or Electra DSN interface. It imports .DSN files generated by the Specctra interface of the host system and exports .SES Specctra session files.

There are three modes for routing traces: 90 degree, 45 degree and free angle. The interactive router is production stable and unsurpassed in its free angle capabilities. An autorouter is currently under development and already stable in the conventional 45 degree mode.

After launching the router a window appears with buttons to display some router demonstrations, to open a sample design, or to open a design of your own.

After opening a design you can start the autorouter with the button in the toolbar on top of the board window.

The board editor has three different interactive states. You can switch between this states with the buttons Select, Route and Drag on the left of the toolbar.

In the beginning the board editor is in the select state. In this state you can select single board items by picking them with the left mouse button or select items in a rectangle by dragging the left mouse button. Only item types switched on in the select parameter sheet will be selected. After selecting some items the toolbar displays options for showing and manipulating these items. If you push the info button for example a window with text information about the selected items is displayed. After clicking a blue word in this text a new window with further information pops up. To return to the select state push the cancel button or click somewhere in the empty space of the board window.

By pushing the Route button you get into the state for interactive routing. In this state you can start a new trace by picking an item belonging to a net, for example a pin. Then you can follow the displayed airline with the mouse until you have reached the target item at the other end of the airline. The trace will be connected automatically to the target, if it is on the same layer. If you want to change to a different layer during interactive routing, select "change layer" and then the name of the new layer in the popup menu under the right mouse button. Then a via will be inserted, if that is possible, and a new trace starts on the new layer. You can also change the layer by pressing a number key.

After pushing the Drag button you get into the state for changing the location of vias, components or traces. In this state you can select vias or components and drag them with the left mouse button to a different location. The connected route is updated automatically. You can also move traces by pushing them from behind out of the empty space with the left mouse button pressed. That works on the current layer, which can be changed in the select parameter sheet. In this way you can make space for example to insert a new component.

For more information please use the online help in the board editor. From here you can download also a printable version of the online help.

Additional steps for users of CadSoft-Eagle

  1. Download the latest Eagle2freerouter ulp file

  2. Start Eagle and open in the control panel of Eagle for example the design my_design.brd.

  3. Choose in the Files pulldown-menu of Eagle the item "execute ULP" and select the Eagle2freerouter ulp file. A file with name my_design.dsn is generated.

  4. Start the router, push the "Open Your Own Design" button and select my_design.dsn in the file chooser.

  5. After making some changes to the design with the router select "export Eagle session script" in the Files pulldown-menu. A file with name my_design.scr is generated.

  6. Choose in the Files pulldown-menu of Eagle the item "execute Script" and select my_design.scr.

Additional steps for users of KiCad

  1. Download the latest freerouting-1.4.5.jar file from the Releases

  2. Start KiCad and open your project in Pcbnew.

  3. Export the PCB into Specctra DSN (File / Export... / Specctra DSN).

  4. Start the router by running the freerouting-executable.jar file, push the "Open Your Own Design" button and select the exported .dsn file in the file chooser.

  5. Do the routing.

  6. When you're finished, export the results into a Specctra session file (File / Export Specctra Session File). The router will generate a .ses file for you.

  7. Go back to KiCad's Pcbnew and import the results (File / Import Specctra Session...).

Using the command line arguments

Freerouter was designed as a GUI program, but it also can function as a command line tool. Typically you would have an input file (e.g. Specctra DSN) that you exported from you EDA (e.g. KiCad). If this file has unconnected routes, you would want to wire those with autorouter, and save the result in a format that you can then import back into your EDA.

The following command line arguments are supported by freerouter:

  • -de [design input file]: loads up a Specctra .dsn file at startup
  • -di [design input directory]: if the GUI is used, this sets the default folder for the open design dialogs
  • -dr [design rules file]: reads the rules from a previously saved .rules file
  • -do [design output file]: saves a Specctra board (.dsn), a Specctra session file (.ses) or Eagle session script file (.scr) when the routing is finished
  • -mp [number of passes]: sets the upper limit of the number of auto-router passes that will be performed
  • -l [language]: "de" for German, "zh" for Simplified Chinese, otherwise it's English
  • -mt [number of threads]: sets thread pool size for route optimization. The default is one less than the number of logical processors in the system.
  • -us [greedy | global | hybrid]: sets board updating strategy for route optimization: greedy, global optimal or hybrid. The default is greedy. When hybrid is selected, another option "hr" specifies hybrid ratio.
  • -hr [m:n]: sets hybrid ratio in the format of #_global_optiomal_passes:#_prioritized_passes. The default is 1:1. It's only effective when hybrid strategy is selected.
  • -is [sequential | random | prioritized]: sets item selection strategy for route optimization: sequential, random, prioritized. The default is prioritized. Prioritied stragegy selects items based on scores calculated in previous round.
  • -h: shows help

A complete command line looks something like this if your are using PowerShell on Windows:

& "java.exe" -jar freerouting-1.4.5.jar -de MyBoard.dsn -do MyBoard.ses -mp 100 -dr MyBoard.rules

This would read the MyBoard.dsn file, do the auto-routing with the parameters defined in MyBoard.rules for the maximum of 100 passes, and then save the result into the MyBoard.ses file.

Multi-threaded Implementation of Routing Optimization

After Freerouting completes auto-routing it switches to the next phase, called routing optimization to improve the board even further. When board complexity reached certain level, route optimization in previous version (<= 1.4.4) was slow to the the extent that was almost un-usable. This issues was addressed with multi-threading and various updating strategies.

Here is an example that shows the amount of speedup achieved by the initial author of this routing optimization on a board of high complexity. On a machine with 8 cores, the following options are used: java -Xmx16g -mt 16 -us greedy -is prioritized. After about 75 passes, the phase of routing optimation was finished after about 30 hours. # of vias was reduced from 566 to 418, and route length was reduced from 12.94 million to 12.07 million. The average CPU usage is around 1,500%, so comparing to previous single thread route optimization, the CPU load was roughly increased to 15 times. If previous version was used, this 30-hour (1 1/4 day) task might take about 20 days to finish.

Here is an example with a PCB board of median complexity. The smoothieboard in tests directory was modified from open source Smoothieboard V1.1 via the following actions: deleting all traces and vias, setting one inner layer to ground plane, routing all incompleted connections in Freerouting v1.4.4 and saving the board in bin format. It turned out that strictly speaking, performance of optimization phase of Freerouting v1.4.4 could not be compared to that of the initial version of the multi-threaded implementation because they did not reach the same result. On the same machine described above, with -Xmx24g option, it took Freerouting v1.4.4 about 229 minutes to reach its final optimization result: # of via was reduced from 173 to 144, and trace length was reduced from 7,169,298 to 6,977,539. It took Freerouting v1.4.4 109 minutes to finish the pass with via count reduced to 144. BTW, there seems to be a bug in Freerouting v1.4.4 as it did not stop after reaching the same # of vias and trace length for 7 times. With options: -Xmx24g -mt 16 -us greedy -is prioritized, the multi-threaded optimization took about 6 minutes 28 seconds to reduce # of via to 144 with different trace length. By comparing the time to reach the minimal via count obtainable with Freerouting v1.4.4 for the first time, we can get an estimation of speedup. For this particular board, the speedup of the combination of multi-threading and various strategy optimization is approximately 16.8 (i.e., 109 / 6.467) times, which crossed the ceiling of 16 times, the limit if only changing from single threading to multi-threading on the 8-core machine. Comparing total runtime is not meaningful as the optimized version reached far better optimization result in terms of # of reduced vias. After reducing # of vias from initial 173 to 144, the optimized version was able to continue to optimize the board. The optimized version further reduced # of vias to 129 and trace length to 6,933,191. Thus the optimized version reduced slightly more than 1.5 times of the amount of vias which were reduced by Freerouting v1.4.4.

A note about power supply to laptops: it was a surprise to see the laptop battery kept loosing charge when a power supply was connected. With the multi-threaded optimization, the computer will be pushed to its limit, so use an official power supply that comes with the laptop, or use a more powerful power supply. Also be aware of room temperature as the computer will become hotter and might be overheated, especially when the computer is moved to another room because you cannot withstand its unusual fan noise.

One critical task in multi-threaded optimation is to clone objects. In the initial multi-threaded implementation, a quick way to clone objects was used: clone via serialization. When someone gets time, take a look of implementing cloning in offical way.

Besides multi-threading, multiple optimzation strategies were also implemented. Global optimal strategy selects the global optimal update after processing all items in an optimation pass, while greedy strategy adopts an update as soon as it is found to be better than current one, so there will be multiple updates in a greedy optimization pass. Hybrid strategy mixes the above two, and there is an option to select the mixing ratio.

Sequential, random and prioritized item selection strategies are implemented to determine which item to process next during an optimization pass. Each item is ranked during the optimization pass so that it's possible to prioritize items with better scores when selecting items to process in next optimization pass.

Hopefully this multi-threaded routing optimization will change this router from almost impossible to practical to optimize boards of high complexity.

Running Freerouting on 32-bit systems

Unfortunately the modern Java distributions have often limited support for 32-bit executable generation, so it's not trivial at all to have x32 installers that run on 32-bit systems. Fortunatelly though the platform independent .JAR files can be run, if the matching Java runtime is installed on the 32-bit system you are planning to use.

You will need the following steps to make it work:

  1. Get the current JAR release from our Releases page

  2. Download and install the 32-bit version of the Adoptium Temurin 11 (LTS)

    • For Windows, select the "x86" architecture from the dropdown
    • For ARM Linux, select the "arm32" architecture from the dropdown
  3. Run the downloaded JAR file using the installed java.exe

    java.exe -jar freerouting-1.4.5.jar

How to build it from source

Requirements

IDE

Open the freerouting Gradle project in your favourite IDE (NB, IntelliJ, Eclipse etc. with Gradle Plugin) and build it by calling the assemble task.

Command Line

Navigate to the Gradle project (e.g., path/to/freerouting) and enter the following command

Bash (Linux/OS X/Cygwin/other Unix-like shell)

bash gradlew assemble

Windows (CMD)

gradlew assemble

image

Generated Executables

All four .jar files will be generated in the build\libs subfolder. You would typically run the freerouting-executable.jar file.

Contributing

We ❤️ all our contributors; this project wouldn’t be what it is without you!

If you want to help out, please consider replying to issues, creating new ones, or even send your fixes and improvements as pull requests.

freerouting's People

Contributors

andrasfuchs avatar miho avatar rusefillc avatar dependabot[bot] avatar abelom avatar sliedes avatar snack-x avatar vicsanrope avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.