TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
critical.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3// Critical nets, from what the board's parts are (issue #24, docs/05-routing.md §44, D117).
4//
5// JLCPCB's first rule of routing is to route the critical signals first. Which signals are critical is not in the netlist, but the component rules
6// (doc 15) know the roles the nets play: the data lines of a USB port, the pairs of an Ethernet PHY, a crystal's two pins, the clock of a memory
7// interface. This turns the roles into tiers: 1 clocks, crystals and RF lines (the signals that radiate and that nothing may disturb), 2 high-speed
8// differential links, 3 memory and other fast parallel buses. A tier is the order of routing; the user's own list (`--critical-nets`) is tier 1.
9#include <string>
10#include <utility>
11#include <vector>
12
13#include "crules/catalogue.hpp"
14#include "crules/detect.hpp"
15#include "model/board.hpp"
16
17namespace tmk::crules {
18
21 int tier = 0; // 1 = most critical
22 std::string why; // "USB 2.0 data (usb2 dp)", "differential pair"
23};
24
25// The nets playing a critical role in a detected category instance, and `diff_pairs` (named pairs, tier 2) that no role claimed. A net found
26// twice keeps the lower tier. Deterministic: tier, then net id.
27std::vector<CriticalNet> critical_nets(const model::Board& b, const Catalogue& cat, const Detection& det,
28 const std::vector<std::pair<model::NetId, model::NetId>>& diff_pairs);
29
30// The table itself, for the docs and the tests: (category id, role, tier).
32 const char* category;
33 const char* role;
34 int tier;
35};
36const std::vector<CriticalRole>& critical_roles();
37
38} // namespace tmk::crules
The board model (design doc 02 §3): every object TraceMaker reads from a .kicad_pcb,...
Component-rule catalogue (design doc 15 §6.1): categories of components with their detectors,...
Category detection and role binding (design doc 15 §3): each footprint is scored against every catego...
std::vector< CriticalNet > critical_nets(const model::Board &b, const Catalogue &cat, const Detection &det, const std::vector< std::pair< model::NetId, model::NetId > > &diff_pairs)
The nets playing a critical role in a detected category instance, and diff_pairs (named pairs,...
const std::vector< CriticalRole > & critical_roles()
std::int32_t NetId
0 = no net
Definition board.hpp:21
std::string why
"USB 2.0 data (usb2 dp)", "differential pair"
Definition critical.hpp:22
int tier
1 = most critical
Definition critical.hpp:21
The table itself, for the docs and the tests: (category id, role, tier).
Definition critical.hpp:31