Skip to content

Commit

Permalink
Fully working MP
Browse files Browse the repository at this point in the history
  • Loading branch information
bryates committed Oct 26, 2021
1 parent 441dd0c commit 2c461a1
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 234 deletions.
50 changes: 49 additions & 1 deletion TestBenches/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,55 @@ X(TP_L3L4D_, "TP_L3L4D") \
X(TP_L5L6A_, "TP_L5L6A") \
X(TP_L5L6B_, "TP_L5L6B") \
X(TP_L5L6C_, "TP_L5L6C") \
X(TP_L5L6D_, "TP_L5L6D")
X(TP_L5L6D_, "TP_L5L6D") \
X(MP_D1PHIA_, "MP_D1PHIA") \
X(MP_D1PHIB_, "MP_D1PHIB") \
X(MP_D1PHIC_, "MP_D1PHIC") \
X(MP_D1PHID_, "MP_D1PHID") \
X(MP_D2PHIA_, "MP_D2PHIA") \
X(MP_D2PHIB_, "MP_D2PHIB") \
X(MP_D2PHIC_, "MP_D2PHIC") \
X(MP_D2PHID_, "MP_D2PHID") \
X(MP_D3PHIA_, "MP_D3PHIA") \
X(MP_D3PHIB_, "MP_D3PHIB") \
X(MP_D3PHIC_, "MP_D3PHIC") \
X(MP_D3PHID_, "MP_D3PHID") \
X(MP_D4PHIA_, "MP_D4PHIA") \
X(MP_D4PHIB_, "MP_D4PHIB") \
X(MP_D4PHIC_, "MP_D4PHIC") \
X(MP_D4PHID_, "MP_D4PHID") \
X(MP_D5PHIA_, "MP_D5PHIA") \
X(MP_D5PHIB_, "MP_D5PHIB") \
X(MP_D5PHIC_, "MP_D5PHIC") \
X(MP_D5PHID_, "MP_D5PHID") \
X(MP_L1PHIA_, "MP_L1PHIA") \
X(MP_L1PHIB_, "MP_L1PHIB") \
X(MP_L1PHIC_, "MP_L1PHIC") \
X(MP_L1PHID_, "MP_L1PHID") \
X(MP_L1PHIE_, "MP_L1PHIE") \
X(MP_L1PHIF_, "MP_L1PHIF") \
X(MP_L1PHIG_, "MP_L1PHIG") \
X(MP_L1PHIH_, "MP_L1PHIH") \
X(MP_L2PHIA_, "MP_L2PHIA") \
X(MP_L2PHIB_, "MP_L2PHIB") \
X(MP_L2PHIC_, "MP_L2PHIC") \
X(MP_L2PHID_, "MP_L2PHID") \
X(MP_L3PHIA_, "MP_L3PHIA") \
X(MP_L3PHIB_, "MP_L3PHIB") \
X(MP_L3PHIC_, "MP_L3PHIC") \
X(MP_L3PHID_, "MP_L3PHID") \
X(MP_L4PHIA_, "MP_L4PHIA") \
X(MP_L4PHIB_, "MP_L4PHIB") \
X(MP_L4PHIC_, "MP_L4PHIC") \
X(MP_L4PHID_, "MP_L4PHID") \
X(MP_L5PHIA_, "MP_L5PHIA") \
X(MP_L5PHIB_, "MP_L5PHIB") \
X(MP_L5PHIC_, "MP_L5PHIC") \
X(MP_L5PHID_, "MP_L5PHID") \
X(MP_L6PHIA_, "MP_L6PHIA") \
X(MP_L6PHIB_, "MP_L6PHIB") \
X(MP_L6PHIC_, "MP_L6PHIC") \
X(MP_L6PHID_, "MP_L6PHID")

#define X(module, name) module,
enum Module : size_t
Expand Down
150 changes: 0 additions & 150 deletions TestBenches/MatchProcessorL3_test.cpp

This file was deleted.

37 changes: 18 additions & 19 deletions TestBenches/MatchProcessor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ int main()
{
// Define memory patterns
const string trackletProjectionPattern = "TrackletProjections*";
const string allProjectionPatternarray = "AllProj*";
const string allStubPatternarray = "AllStub*";
const string vmStubPatternarray = "VMStubs_VMSME*";
const string fullMatchPattern = "FullMatches*";

const auto stubMemType = (MODULE_ >= MP_L1PHIA_ && MODULE_ <= MP_L3PHID_) ? BARRELPS : (MODULE_ > MP_D5PHID_) ? BARREL2S : (MODULE_ >= MP_D3PHIA_) ? DISK2S : DISKPS;
const auto projMemType = (MODULE_ >= MP_L1PHIA_ && MODULE_ <= MP_L3PHID_) ? BARRELPS : (MODULE_ > MP_D5PHID_) ? BARREL2S : DISK;
const auto stubMemType = (MODULE_ >= MP_L1PHIA_ && MODULE_ <= MP_L3PHID_) ? BARRELPS : (MODULE_ > MP_D5PHID_) ? BARREL2S : (MODULE_ >= MP_D3PHIA_) ? DISK2S : DISKPS;
const auto tprojMemType = (MODULE_ >= MP_L1PHIA_ && MODULE_ <= MP_L3PHID_) ? BARRELPS : (MODULE_ > MP_D5PHID_) ? BARREL2S : DISK;
const auto fmProjMemType = (MODULE_ >= MP_L1PHIA_ && MODULE_) ? BARREL : DISK;
TBHelper tb(std::string("MP/") + module_name[MODULE_]);

Expand All @@ -42,11 +42,11 @@ int main()
///////////////////////////
// input memories
const auto nTrackletProjections = tb.nFiles(trackletProjectionPattern);
vector<CandidateMatchMemory> tprojarray(nTrackletProjections);
const auto nAllProjections = tb.nFiles(allProjectionPatternarray);
vector<AllProjectionMemory<projMemType>> allproj(nAllProjections);
const auto nAllStubs = tb.nFiles(allStubPatternarray);
vector<AllStubMemory<stubMemType>> allstub(nAllStubs);
vector<TrackletProjectionMemory<tprojMemType>> tprojarray(nTrackletProjections);
const auto nAllStub = tb.nFiles(allStubPatternarray);
vector<AllStubMemory<stubMemType>> allstub(nAllStub);
const auto nVMStubs = tb.nFiles(vmStubPatternarray);
VMStubMEMemoryCM<stubMemType, 3, 3, kNMatchEngines> vmstub;

// output memories
const auto nFullMatches = tb.nFiles(fullMatchPattern);
Expand All @@ -56,10 +56,10 @@ int main()
std::cout << "Loaded the input files:\n";
for (unsigned i = 0; i < nTrackletProjections; i++)
std::cout << "\t" << tb.fileNames(trackletProjectionPattern).at(i) << "\n";
for (unsigned i = 0; i < nAllProjections; i++)
std::cout << "\t" << tb.fileNames(allProjectionPatternarray).at(i) << "\n";
for (unsigned i = 0; i < nAllStubs; i++)
for (unsigned i = 0; i < nAllStub; i++)
std::cout << "\t" << tb.fileNames(allStubPatternarray).at(i) << "\n";
for (unsigned i = 0; i < nVMStubs; i++)
std::cout << "\t" << tb.fileNames(vmStubPatternarray).at(i) << "\n";
for (unsigned i = 0; i < nFullMatches; i++)
std::cout << "\t" << tb.fileNames(fullMatchPattern).at(i) << "\n";
std::cout << std::endl;
Expand All @@ -72,13 +72,12 @@ int main()
// read event and write to memories
auto &fin_TrackletProjections = tb.files(trackletProjectionPattern);
for (unsigned int i = 0; i < nTrackletProjections; i++)
writeMemFromFile<CandidateMatchMemory>(tprojarray[i], fin_TrackletProjections.at(i), ievt);
auto &fin_AllProjections = tb.files(allProjectionPatternarray);
for (unsigned int i = 0; i < nAllProjections; i++)
writeMemFromFile<AllProjectionMemory<projMemType>>(allproj[i], fin_AllProjections.at(i), ievt);
auto &fin_AllStubs = tb.files(allStubPatternarray);
for (unsigned int i = 0; i < nAllStubs; i++)
writeMemFromFile<AllStubMemory<stubMemType>>(allstub[i], fin_AllStubs.at(i), ievt);
writeMemFromFile<TrackletProjectionMemory<tprojMemType>>(tprojarray[i], fin_TrackletProjections.at(i), ievt);
auto &fin_AllStub = tb.files(allStubPatternarray);
for (unsigned int i = 0; i < nAllStub; i++)
writeMemFromFile<AllStubMemory<stubMemType>>(allstub[i], fin_AllStub.at(i), ievt);
auto &fin_VMStubs = tb.files(vmStubPatternarray);
writeMemFromFile<VMStubMEMemoryCM<stubMemType, 3, 3, kNMatchEngines>>(vmstub, fin_VMStubs.at(0), ievt);

// clear allarray, output memories before starting
for (unsigned int i = 0; i < nFullMatches; i++)
Expand All @@ -89,7 +88,7 @@ int main()
BXType bx_out;

// Unit Under Test
TOP_FUNC_(bx, tprojarray.data(), allstub.data(), allproj.data(), bx_out, fullmatcharray.data());
TOP_FUNC_(bx, tprojarray.data(), vmstub, allstub.data(), bx_out, fullmatcharray.data());

bool truncation = false;
auto &fout_fullmatch = tb.files(fullMatchPattern);
Expand Down
38 changes: 0 additions & 38 deletions TopFunctions/CombinedConfig/MatchProcessorTopL3.cc

This file was deleted.

16 changes: 0 additions & 16 deletions TopFunctions/CombinedConfig/MatchProcessorTopL3.h

This file was deleted.

8 changes: 4 additions & 4 deletions TrackletAlgorithm/MatchProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ void readTable_Cuts(ap_uint<width> table[depth]){
namespace MC {
enum imc {UNDEF_ITC, A = 0, B = 1, C = 2, D = 3, E = 4, F = 5, G = 6, H = 7, I = 8, J = 9, K = 10, L = 11, M = 12, N = 13, O = 14};
}
template<TF::layerDisk Layer, MC::imc PHI, TF::seed Seed> static constexpr bool FMMask();
template<TF::layerDisk Layer, MC::imc PHI> static constexpr uint16_t FMMask();
template<TF::layerDisk Layer, MC::imc PHI, TF::seed Seed> constexpr bool FMMask();
template<TF::layerDisk Layer, MC::imc PHI> constexpr uint32_t FMMask();
#include "MatchProcessor_parameters.h"

template<regionType ASTYPE, regionType APTYPE, regionType VMSMEType, regionType FMTYPE, int maxFullMatchCopies, TF::layerDisk LAYER=TF::L1, MC::imc PHISEC=MC::A>
Expand Down Expand Up @@ -766,10 +766,10 @@ void MatchProcessor(BXType bx,
//memory the projection points to

// number of bits used to distinguish the different modules in each layer/disk
auto nbits_all = LAYER!=0 ? nbitsallstubs[LAYER-1] : nbitsallstubs[N_LAYER + DISK-1];
auto nbits_all = LAYER!=0 ? nbitsallstubs[LAYER-1] : nbitsallstubs[trklet::N_LAYER + DISK-1];

// number of bits used to distinguish between VMs within a module
auto nbits_vmme = LAYER!=0 ? nbits_vmmeall[LAYER-1] : nbits_vmmeall[N_LAYER + DISK-1];
auto nbits_vmme = LAYER!=0 ? nbits_vmmeall[LAYER-1] : nbits_vmmeall[trklet::N_LAYER + DISK-1];

// bits used for routing
iphi = iphiproj.range(iphiproj.length()-nbits_all-1,iphiproj.length()-nbits_all-nbits_vmme);
Expand Down
Loading

0 comments on commit 2c461a1

Please sign in to comment.