TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
bus.hpp File Reference

Buses (design doc 05 §38): groups of nets that belong together (a data bus, an address bus, a parallel display interface). More...

#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "drc/length.hpp"
#include "drc/rule_engine.hpp"
#include "model/board.hpp"
#include "model/rules.hpp"

Go to the source code of this file.

Classes

struct  tmk::route::BusGroup
struct  tmk::route::BusMember
 A group as routed, measured on copper. More...
struct  tmk::route::BusStats
struct  tmk::route::ViaHeights
 The length a via adds to its net in KiCad's length calculation (KiCad 10, BOARD_STACKUP::GetLayerDistance): the stackup between the two copper layers the via joins, with the copper of an outer layer in full and of an inner layer by half. More...

Namespaces

namespace  tmk
namespace  tmk::route

Functions

bool tmk::route::natural_less (std::string_view a, std::string_view b)
 Natural order of two names: runs of digits compare as numbers, everything else byte by byte.
bool tmk::route::bus_pattern_match (const std::string &pattern, const std::string &net_name)
 Bus patterns select nets by their full name (KiCad's, with the sheet path: "/D0", "/MEM/DQ3").
BusGroup tmk::route::bus_from_option (const model::Board &b, const std::string &spec)
 "NAME=PATTERN" as given to –bus.
std::vector< BusGroup > tmk::route::detect_buses (const model::Board &b, int min_members=4)
 Automatic detection (–buses), conservative: nets whose names differ only in a trailing decimal index ("D0", "A[3]", "/MEM/DQ12"), at least min_members of them with pads on the same two components.
std::optional< Coord > tmk::route::bus_rule_skew (const drc::RuleEngine &re, const BusGroup &g)
 The skew limit the board's custom rules give a group: every member must match a rule with a skew constraint (the smallest maximum wins); rules restricted to differential pairs (within_diff_pairs) do not count.
double tmk::route::net_via_length (const model::Board &b, const ViaHeights &vh, model::NetId net, const std::vector< model::Track > &tracks, const std::vector< model::ArcTrack > &arcs, const std::vector< model::Via > &vias)
 The via length of one net on the given copper, as KiCad sums it: each via counts between the outermost layers on which a track of the net ends inside the via's pad, or a pad of the net touches the via (a surface pad's own layer, its footprint's side for a through-hole pad); a via that joins nothing on a second layer adds nothing.
BusStats tmk::route::measure_bus (const model::Board &b, const ViaHeights &vh, const std::vector< model::Track > &tracks, const std::vector< model::ArcTrack > &arcs, const std::vector< model::Via > &vias, const std::vector< std::uint8_t > &net_routed, const BusGroup &g)
 net_routed[net]: nets_joined() of the board the copper belongs to; b gives the pads, vh its via heights.
std::vector< std::uint8_t > tmk::route::nets_joined (const model::Board &b, const model::DesignRules &rules)
 Per net: 1 when all its pads are joined by copper (the router's own connectivity; nets without pads count as joined).
ViaHeights tmk::route::via_heights (const model::Board &b, const model::DesignRules &rules)

Detailed Description

Buses (design doc 05 §38): groups of nets that belong together (a data bus, an address bus, a parallel display interface).

This file holds what does not need the router: how a group is named on the command line, how groups are found in the net names, which skew limit the board's rules give a group, and the measurement of a routed group. The routing of a group lives in the router (route/router.cpp, "buses").

Definition in file bus.hpp.