16 const std::vector<std::vector<TTStubRef>>& stubsDTC)
18 enableTruncation_(iConfig.getParameter<
bool>(
"EnableTruncation")),
19 region_(dtcId /
setup.numDTCsPerRegion()),
20 board_(dtcId %
setup.numDTCsPerRegion()),
21 modules_(
setup.dtcModules(dtcId)),
22 input_(
setup.dtcNumRoutingBlocks(),
Stubss(
setup.dtcNumModulesPerRoutingBlock())),
23 lost_(
setup.numOverlappingRegions()) {
25 auto acc = [](
int& sum,
const vector<TTStubRef>& stubsModule) {
return sum += stubsModule.size(); };
26 const int nStubs = accumulate(stubsDTC.begin(), stubsDTC.end(), 0, acc);
29 for (
int modId = 0; modId <
setup.numModulesPerDTC(); modId++) {
30 const vector<TTStubRef>& ttStubRefs = stubsDTC[modId];
31 if (ttStubRefs.empty())
36 const int blockId = modId /
setup.dtcNumModulesPerRoutingBlock();
38 const int channelId = modId %
setup.dtcNumModulesPerRoutingBlock();
41 for (
const TTStubRef& ttStubRef : ttStubRefs) {
42 stubs_.emplace_back(iConfig,
setup, module, ttStubRef);
46 stubs.push_back(&stub);
49 sort(stubs.begin(), stubs.end(), [](
Stub* lhs,
Stub* rhs) {
return abs(lhs->
bend()) <
abs(rhs->bend()); });
60 stubs.erase(
limit, stubs.end());
70 merge(
input_[routingBlock], blockStubs[routingBlock], lost);
74 copy_if(lost.begin(), lost.end(), back_inserter(
lost_[
region]), inRegion);
78 split(blockStubs, regionStubs);
80 produce(regionStubs, productAccepted);
89 while (!all_of(
inputs.begin(),
inputs.end(), [](
const Stubs& channel) {
return channel.empty(); })
or
90 !all_of(stacks.begin(), stacks.end(), [](
const Stubs& channel) {
return channel.empty(); })) {
92 for (
int iInput = 0; iInput < (
int)
inputs.size(); iInput++) {
102 stack.push_back(stub);
106 bool nothingToRoute(
true);
107 for (
int iInput =
inputs.size() - 1; iInput >= 0; iInput--) {
111 nothingToRoute =
false;
118 output.push_back(
nullptr);
123 copy_if(
limit,
output.end(), back_inserter(lost), [](
Stub* stub) {
return stub; });
134 auto regionMask = [&
region](
Stub* stub) {
return stub && stub->inRegion(
region) ? stub :
nullptr; };
152 auto toFrame = [&channel](
Stub* stub) {
153 return stub ? make_pair(stub->ttStubRef(), stub->frame(channel)) :
TTDTC::Frame();
155 for (
const Stubs& stubs : stubss) {
157 stream.reserve(stubs.size());
165 Stub* stub = deque.front();