Skip to the content
6 layersN25, the printed circuit board in 3D

RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

Copper layers
6
Thickness
1.6 mm
Parts
209
Nets
137
Pads
610
Tracks, vias
2,242, 2,475
Pours
82
Routed
Yes
KiCad
KiCad 5 (file 20171130)
Created
12 May 2025
Updated
1 Sep 2025

Overview

N25 is an open-source printed circuit board by Pyrojewel-zard, from the Pyrojewel-zard/RL_PCB repository on GitHub, published under the MIT licence. It is a 6-layer board with 209 parts on 137 nets, routed with 2,242 tracks and 2,475 vias.

Its parts include 36 capacitors, 8 connectors, 2 switches, 1 IC and 1 inductor.

README

README.md

[toc]

Project Description

RL_PCB is an end-to-end Reinforcement Learning PCB placement methodology. The solution is inspired from cellular automata. The state of the circuit placement problem is distributed across all the components on the layout region. Every component can update it's positioning independently based on local and global information. The question of how to update the state, factoring in experience (i.e. past knowledge) is a particularly difficult one. We use reinforcement learning to learn ways of updating the state. We do so in a way that localised updates are not destructive to the global solution. Consequently the solution naturally comes out as an emergent property of the system.

You can learn more about this work by reading our DATE 24 paper. My Master thesis investigated "A graph placement methodology for fast chip design" proposed by Mirhoseini et al., and based on it's shortcomings proposed this solution.

If you find this work useful please cite us!

bibtex
@inproceedings{Vassallo2024,
  author={Vassallo, Luke and Bajada, Josef},
  booktitle={2024 Design, Automation & Test in Europe Conference & Exhibition (DATE)}, 
  title={Learning Circuit Placement Techniques Through Reinforcement Learning with Adaptive Rewards}, 
  year={2024},
  volume={},
  number={},
  pages={1-6},
}

RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB). Reinforcement learning is used to learn general policies for iteratively improving a circuit placement, leading to intuitive layouts while outperforming stochastic methods in terms of post-routing wirelength.

Key Results

The main contribution of this work is:

  1. The policies learn the fundamental rules of the task and demonstrate an understanding of the problem dynamics. The agent is observed taking actions that in the long term minimise overlap-free wirelength. At the same time, the components naturally fall in place, resulting in a coherent layout.
  2. Since the agent represents a component, emergent behaviours are observed as a result of each component interacting with its neighbours. When we emphasise Half-Perimeter Wirelength (HPWL) in the reward function, we observe collaboration (e.g. Figure 1c, 1d); on the other hand, when we emphasise Euclidean Wirelength (EW), we observe competition (e.g. Figure 1b).
  3. The learned behaviour is robust because training data is diverse and consistent with the evaluative feedback assigned. Consistency is achieved by extensive normalisation and eliminating all potential sources introducing bias. Similarly goes for the reward. Diversity is obtained by allowing every agent to contribute to training samples with different perspectives which is further compounded by using multiple unique circuits for training - a relatively small training dataset of 6 circuits.
055_15.gif
(a) (EW=0, HPWL=5, Overlap=5)
055_15.gif
(b) (EW=8, HPWL=0, Overlap=2)
055_15.gif
(c) (EW=0, HPWL=8, Overlap=2)
policy.gif
(d) (EW=0, HPWL=8, Overlap=2)
policy_802_td3.gif
(e) (EW=8, HPWL=0, Overlap=2)
policy_802_sac.gif
(f) (EW=8, HPWL=0, Overlap=2)
policy_802_sac_b.gif
(g) (EW=8, HPWL=0, Overlap=2)
policy_sac_226.gif
(h) (EW=2, HPWL=2, Overlap=6)
policy_td3_226.gif
(i) (EW=2, HPWL=2, Overlap=6)

Figure 1: Succesful policies optimising circuits not seen during training.

Installation Guide

It is very important that the installation procedure is carried out while being in the root of the repository (i.e. the same location as the script install_tools_and_virtual_environment.sh)

Install Pre-requisites

The following packages must be installed on the system to compile libraries for parsing KiCAD PCB files (.kicad_pcb) and place-and-route tools.

text
sudo apt install python3-virtualenv build-essential libboost-dev libboost-filesystem-dev

To ensure consistency, Python code requires the use of version 3.8. Moreover, virtual environments for Python are necessary to install dependencies within a limited scope, preventing any modifications to the system's configuration. If Python3.8 is not available by default through the package manager of your system, you can use the following code to add an apt repository that maintains previous versions and source the required version accordingly.

text
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install python3.8 python3.8-venv

Run automated installation script

The automated installation procedure makes the following changes to the local repository:

  • Create a directory bin and installs the KiCad parsing utility, and place and route tools
  • Creates an environment using python3.8, installs pytorch 1.13 with CUDA 11.7 and all necessary python packages
  • Installs the wheel libraries in the lib folder
text
./install_tools_and_virtual_environment.sh --env_only

If you do not have CUDA 11.7 installed, you can install the CPU only. Tests an experiments will run significantly slower but works out of the box.

text
./install_tools_and_virtual_environment.sh --env_only --cpu_only

If you require a different version of CUDA, please make the following changes and run install_tools_and_virtual_environment.sh without any options:

  • To setup.sh script, change the CUDA path to point to your installation of CUDA.
  • To install_tools_and_virtual_environment.sh script, change the PyTorch libraries to use your CUDA version.

Using a CPU device or alternative CUDA version will yield different results than the accompanying pdf reports for tests and experiments.

Run tests and experiments

Always source the environment setup script before running any tests or experiments. The script should be run from the root of the repository

text
cd <path-to-rl_pcb>
source setup.sh 

Run an experiment

text
cd experiments/00_parameter_exeperiments
./run.sh    

Run a test - tests are used to validate the correct operation of the source code. They are periodically run in a Continuous Integration (CI) environment.

text
cd tests/01_training_td3_cpu
./run.sh

The script run.sh will perform the following:

  1. Carry out the training run(s) by following the instructions in run_config.txt that is located within the same directory
  2. Generates an experiment report that processes the experimental data and presents the results in tables and figures. All experiment metadata is also reported, and customisation is possible through report_config.py, located within the same directory.
  3. Evaluate all policies alongside simulated annealing baseline. All optimised placements are subsequently routed using an A* based algorithm.
  4. Generate a report that processes all evaluation data and tabulates HPWL and routed wirelength metrics. All experiment metadata is also reported.

The generated files can be cleaned by running the following:

text
./clean.sh

Every test and experiment contains a directory called expected results that contains pre-generated reports. Should you run the experiments as provided, identical results are to be expected.

GPU Setup (Optional)

This section provides an optional setup procedure to remove the Nvidia GPU driver and all dependent libraries and perform a fresh install. The commands in this section make big changes to your system. Please read carefully before running commands Some command changes will be required.

  1. Remove CUDA if installed sudo apt-get --purge remove cuda* *cublas* *cufft* *curand* *cusolver* *cusparse* *npp* *nvjpeg* *nsight*
  2. Check if the driver is installed, and if it is, remove it with sudo apt-get --purge remove *nvidia*
  3. Remove cuddnn sudo apt remove libcudnn* libcudnn*-dev

Install Nvidia GPU Driver

To install the driver, you can start by issuing the command ubuntu-drivers devices and identifying the latest third-party non-free version. Once you have identified the appropriate version, use apt to install the driver. After installing the driver, reboot your system and issue the command nvidia-smi to identify the full driver version. In the upcoming section, you will need this information to determine which CUDA version is supported.

Download and install CUDA toolkit

To ensure that your device driver is compatible with CUDA, you'll need to check the compatibility using the following link: https://docs.nvidia.com/deploy/cuda-compatibility/. Once you've confirmed the compatibility, you can proceed to the CUDA Toolkit Archive at https://developer.nvidia.com/cuda-toolkit-archive. From there, select version 11.7 and choose the appropriate platform parameters from the "Select Target Platform" section. Next, download the runfile (local) and proceed with the installation process. Finally, follow the installation instructions carefully and avoid installing the driver when prompted.

text
wget https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda_11.7.1_515.65.01_linux.run
sudo sh cuda_11.7.1_515.65.01_linux.run

Update the setup.sh script as necessary. The default contents for PATH and LD_LIBRARY_PATH are:

text
export PATH="/usr/local/cuda-11.7/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-11.7/lib64:$LD_LIBRARY_PATH"

This project is licensed under the terms of the MIT license

MIT License

Copyright (c) 2023 Luke Vassallo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.```

Parts

209
QtyValueFootprintReferences
22, , , , , , , , , , , , , , , +6
4CAP_NP_CAP0402-HT0_7_10UFCAP0402-HT0_7_1C600, C601, C602, C603
4CAP_NP_CAP0603-HT1_00_22UFCAP0603-HT1_00_1C607, C608, C609, C610
4T_POINT_S_PAD0_375NSNG_TP0.3_NSPAD0_375NSNG_1TP600, TP601, TP602, TP603
3CAP_NP_CAP01005_HT0_22_S0_38_15CAP01005_HT0_22_S0_38_5EM603, EM609, EM613
2CAP_NP_CAP01005_HT0_22_S0_38_15CAP01005_HT0_22_S0_38_6EM608, EM612
2CAP_NP_CAP01005_HT0_22_S0_38_15CAP01005_HT0_22_S0_38_7EM400, EM611
2CAP_NP_CAP01005_HT0_22_S0_38_15CAP01005_HT0_22_S0_38_8EM605, EM610
2CAP_NP_CAP0201-HT0_35_1UFCAP0201-HT0_35_2A126, C502
2CAP_NP_CAP0201-HT0_35_1UFCAP0201-HT0_35_7C617, C622
2CAP_NP_CAP0201-HT0_35_1UFCAP0201-HT0_35_5C615, C621
2CAP_NP_CAP0603-HT1_00_10UFCAP0603-HT1_00_2C605, C606
2KEY_2P_ANT_1_0X1_7_P2_HT1_45_HDANT_1_0X1_7_P2_HT1_45_HD_2J200, J201
2NUT_PAD-RING-TYPE-C_N2_PAD-RINGPAD-RING-TYPE-C_N2_1K101, K102
140-CON_6GND_CON40P_2_2X9_55PS0_CON40P_2_2X9_55PS0_35_DS_HD_1J601
160PIN-6GND_CON60P_2_2X13_05PS0_CON60P_2_2X13_05PS0_35_DS_HD_1J401
1ANT_PIN_ANT_HG_F1_XM-217-XC-186ANT_HG_F1_1J112
1BEAD_BEAD1_0X0_5P0_25-HT0_5_120BEAD1_0X0_5P0_25-HT0_5_1EM601
1BEAD_BEAD1_0X0_5P0_25-HT0_5_120BEAD1_0X0_5P0_25-HT0_5_2EM600
1BMP580_HLGASQ2_0_PS0_5-HT0_8_P1HLGASQ2_0_PS0_5-HT0_8_P10_HD_1U300
1CAF99-06033-1010_SIM_7_8X13_75_SIM_7_8X13_75_P12-HT2_65_HD_1J502
1CAF99-06264-100001_SIM_12_93X15SIM_12_93X15_85-P18_HT2_38_H51J501
1CAP_NM_CAP01005_HT0_22_NM_NMCAP01005_HT0_22_NM_2EM104
1CAP_NM_CAP01005_HT0_22_NM_NMCAP01005_HT0_22_NM_3EM105
1CAP_NM_CAP01005_HT0_22_NM_NMCAP01005_HT0_22_NM_1EM103
1CAP_NM_CAP0201-HT0_33_NM_NMCAP0201-HT0_33_NM_3A138
1CAP_NM_CAP0201-HT0_33_NM_NMCAP0201-HT0_33_NM_4A137
1CAP_NM_CAP0201-HT0_33_NM_NMCAP0201-HT0_33_NM_2A135
1CAP_NM_CAP0201-HT0_33_NM_NMCAP0201-HT0_33_NM_1A134
1CAP_NM_CAP0402-HT0_5_NM_NMCAP0402-HT0_5_NM_1A127
1CAP_NP_CAP01005_HT0_22_S0_38_0.CAP01005_HT0_22_S0_38_2C202
1CAP_NP_CAP01005_HT0_22_S0_38_0.CAP01005_HT0_22_S0_38_1C206
1CAP_NP_CAP01005_HT0_22_S0_38_0.CAP01005_HT0_22_S0_38_4C301
1CAP_NP_CAP01005_HT0_22_S0_38_0.CAP01005_HT0_22_S0_38_3C300
1CAP_NP_CAP01005_HT0_22_S0_38_15CAP01005_HT0_22_S0_38_10EM606
1CAP_NP_CAP01005_HT0_22_S0_38_15CAP01005_HT0_22_S0_38_11EM604
1CAP_NP_CAP01005_HT0_22_S0_38_33CAP01005_HT0_22_S0_38_9EM401
1CAP_NP_CAP0201-HT0_33_0.47UFCAP0201-HT0_33_22C620
1CAP_NP_CAP0201-HT0_33_0.4PFCAP0201-HT0_33_1A130
1CAP_NP_CAP0201-HT0_33_1.2PFCAP0201-HT0_33_18CR101_NM
1CAP_NP_CAP0201-HT0_33_1.6PFCAP0201-HT0_33_24A108
1CAP_NP_CAP0201-HT0_33_1.8PFCAP0201-HT0_33_2A129
1CAP_NP_CAP0201-HT0_33_100NFCAP0201-HT0_33_25A150
1CAP_NP_CAP0201-HT0_33_100NFCAP0201-HT0_33_16C505
1CAP_NP_CAP0201-HT0_33_100NFCAP0201-HT0_33_12C506
1CAP_NP_CAP0201-HT0_33_100PFCAP0201-HT0_33_8EM200
1CAP_NP_CAP0201-HT0_33_100PFCAP0201-HT0_33_7EM201
1CAP_NP_CAP0201-HT0_33_100PFCAP0201-HT0_33_5EM203
1CAP_NP_CAP0201-HT0_33_100PFCAP0201-HT0_33_6EM202
1CAP_NP_CAP0201-HT0_33_100PFCAP0201-HT0_33_3EM102
1CAP_NP_CAP0201-HT0_33_10PFCAP0201-HT0_33_21C612
1CAP_NP_CAP0201-HT0_33_150PFCAP0201-HT0_33_20EM602
1CAP_NP_CAP0201-HT0_33_150PFCAP0201-HT0_33_27EM607
1CAP_NP_CAP0201-HT0_33_2.7PFCAP0201-HT0_33_26A109
1CAP_NP_CAP0201-HT0_33_33PFCAP0201-HT0_33_23A111
1CAP_NP_CAP0201-HT0_33_33PFCAP0201-HT0_33_9C204
1CAP_NP_CAP0201-HT0_33_33PFCAP0201-HT0_33_11A113
1CAP_NP_CAP0201-HT0_33_33PFCAP0201-HT0_33_19A100
1CAP_NP_CAP0201-HT0_33_33PFCAP0201-HT0_33_4C205
1CAP_NP_CAP0201-HT0_33_33PFCAP0201-HT0_33_13C501
1CAP_NP_CAP0201-HT0_33_33PFCAP0201-HT0_33_15C503
1CAP_NP_CAP0201-HT0_33_56PFCAP0201-HT0_33_17A202
1CAP_NP_CAP0201-HT0_33_56PFCAP0201-HT0_33_14A105
1CAP_NP_CAP0201-HT0_33_5PFCAP0201-HT0_33_10A152
1CAP_NP_CAP0201-HT0_35_1UFCAP0201-HT0_35_1C500
1CAP_NP_CAP0201-HT0_35_1UFCAP0201-HT0_35_4C618
1CAP_NP_CAP0201-HT0_35_1UFCAP0201-HT0_35_3C504
1CAP_NP_CAP0201-HT0_35_1UFCAP0201-HT0_35_6C616
1CAP_NP_CAP0201-HT0_39_1UFCAP0201-HT0_39_1C619
1CAP_NP_CAP0402-HT0_7_10UFCAP0402-HT0_7_4C623
1CAP_NP_CAP0402-HT0_7_10UFCAP0402-HT0_7_3C611
1CAP_NP_CAP0402-HT0_7_10UFCAP0402-HT0_7_2C604
1CAP_NP_CAP0402-HT0_7_10UFCAP0402-HT0_7_5C613
1CAP_NP_CAP0402-HT0_7_22UFCAP0402-HT0_7_6C614
1CON_24P_6G_CON24P_2_2X6_75PS0_3CON24P_2_2X6_75PS0_35_DS_HD_1J400
1ESD_ESD0_6X0_3_PS0_425HT0_32_HDESD0_6X0_3_PS0_425HT0_32_HD_1CR100
1INDUCTOR_IND0201-HT0_35_100NHIND0201-HT0_35_6A101
1INDUCTOR_IND0201-HT0_35_11NHIND0201-HT0_35_2A118
1INDUCTOR_IND0201-HT0_35_15NHIND0201-HT0_35_7A110
1INDUCTOR_IND0201-HT0_35_180NHIND0201-HT0_35_4L200

The 121 most common of 209 parts.

More from Pyrojewel-zard/RL_PCB

11
  • 2 layers152.4 × 101.6 mmXunlian, the printed circuit board in 3D

    Xunlian

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    51 parts1MIT
  • 2 layersOutput.160-175, the printed circuit board in 3D

    Output.160-175

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    29 parts1MIT
  • 2 layersOutput123-136, the printed circuit board in 3D

    Output123-136

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    24 parts1MIT
  • 2 layers7 × 15.5 mmN2 PCB KICAD5, the printed circuit board in 3D

    N2 PCB KICAD5

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    22 parts1MIT
  • 2 layers9 × 7 mmN25 2, the printed circuit board in 3D

    N25 2

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    22 parts1MIT
  • 2 layers38.8 × 41.7 mmBase raw, the printed circuit board in 3D

    Base raw

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    20 parts1MIT
  • 2 layersBase raw, the printed circuit board in 3D

    Base raw

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    17 parts1MIT
  • 2 layers8.5 × 5 mmN2 PCB KICAD5, the printed circuit board in 3D

    N2 PCB KICAD5

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    16 parts1MIT
  • 2 layersOutput 144 1525, the printed circuit board in 3D

    Output 144 1525

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    16 parts1MIT
  • 2 layers8 × 8 mmN2 PCB KICAD5, the printed circuit board in 3D

    N2 PCB KICAD5

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    12 parts1MIT
  • 2 layersOutput127-147.5, the printed circuit board in 3D

    Output127-147.5

    Pyrojewel-zard/RL_PCB

    RL_PCB is a novel learning-based method for optimising the placement of circuit components on a Printed Circuit Board (PCB).

    2 parts1MIT

Similar boards

  • 6 layers27 × 54.5 mmBujiCore, the printed circuit board in 3D

    BujiCore

    McflyWZX/BujiUAV2

    基于全志H5的M.2接口核心板,搭载4*DDR3、eMMC。

    209 parts3GPL-3.0
  • 6 layers57.4 × 96 mmDFTBoard, the printed circuit board in 3D

    DFTBoard

    SunnyYoshimitsu/CelestiCall

    An attempt at making a somewhat modern smartphone with many functions.

    209 parts1
  • 6 layers160 × 100 mmDIG Card, the printed circuit board in 3D

    DIG Card

    scular-HCC/DualLaserPDHDriver

    Dual laster Pound-Dreaver-Hall driver setup. 1550 nm DFBs. Q=10^-5. Less than 20 GHz difference

    208 parts
  • 6 layers91.6 × 50.6 mmSmokebreak, the printed circuit board in 3D

    Smokebreak

    offgridevices/offgrid-hardware

    Open hardware from OffGrid Devices. One folder per board. CERN-OHL-S.

    208 partsCERN-OHL-S-2.0
  • 6 layers304.8 × 243.8 mmHydra-16, the printed circuit board in 3D

    Hydra-16

    danstruthers/hydra-16

    6502-based multi-tasking hardware and software project

    210 parts1
  • 6 layers200 × 134 mmEther, the printed circuit board in 3D

    Ether

    korken89/ether

    210 parts
  • 6 layers60.4 × 98.3 mmDronePCB, the printed circuit board in 3D

    DronePCB

    WiktorKociuba/drone

    207 parts
  • 6 layers140 × 56 mmTrenz mounted, the printed circuit board in 3D

    Trenz mounted

    naturalhazardscience/groundlark

    Open source hardware for community-powered citizen science

    207 partsMIT

Questions

What parts does the N25 use?

209 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the N25 KiCad files?

From the Pyrojewel-zard/RL_PCB repository on GitHub, at the commit this page was made from: the board is dataset/base_raw/N25.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the N25 design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).