-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MP X-Macros #213
Merged
MP X-Macros #213
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ccff4b0
Updating MP
bryates 7ac1a2c
Changes for TBHelper
bryates 3ee10b8
Load all MP instances
bryates 76cae4e
Fully working MP
bryates 9baf91e
Small fixes to match MC
bryates 5c41e42
Fixed issue with L3PHIB
bryates ca17b59
Fixed MP script for TopFunctions
bryates bf49a21
Added generate_MP.py
bryates 8d3e1f2
MP top cpp -> cc
bryates 787cadd
Run generate_MP.py in download.sh
bryates 334a3fd
MP top in CombinedConfig
bryates 78740e2
Fixed gcc paths
bryates ece2562
Added MP to Constants.h
bryates 6c2bac1
Improved L1 (tested PHIB and PHIC)
bryates c74ebb7
Uncommented tables
bryates bba2722
Fixed synthesis issues
bryates 1bd5260
Changes to work with future SW emulation (#217)
carriganm95 731e5ec
Removed assert
bryates 06149ab
Removed MEU params from generate_MP.py
bryates ed14b18
Delete MatchProcessor_parameters.h
carriganm95 a92a1b3
Fixes to MatchProcessor - now full agreement in L1-L6
bd72f87
Updated scripts, CI should no longer fail
bryates 2dab0c3
Commented out custom TVs, allow MP CI to fail again
bryates c13b4b9
Fixed download.sh issue
bryates File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
// Test bench for MatchProcessor | ||
#include "MatchProcessorTop.h" | ||
|
||
#include <vector> | ||
#include <algorithm> | ||
#include <iterator> | ||
#include <iterator> | ||
|
||
#include "Macros.h" | ||
#include "FileReadUtility.h" | ||
#include "Constants.h" | ||
|
||
// No macros can be defined from the command line in the case of C/RTL | ||
// cosimulation, so we define defaults here. | ||
#if !defined MODULE_ | ||
#define MODULE_ MP_L3PHIC_ | ||
#endif | ||
#if !defined TOP_FUNC_ | ||
#define TOP_FUNC_ MatchProcessor_L3PHIC | ||
#endif | ||
|
||
const int nevents = 100; //number of events to run | ||
|
||
using namespace std; | ||
|
||
int main() | ||
{ | ||
// Define memory patterns | ||
const string trackletProjectionPattern = "TrackletProjections*"; | ||
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 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_]); | ||
|
||
// error counts | ||
int err = 0; | ||
|
||
/////////////////////////// | ||
// input memories | ||
const auto nTrackletProjections = tb.nFiles(trackletProjectionPattern); | ||
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); | ||
vector<FullMatchMemory<fmProjMemType> > fullmatcharray(nFullMatches); | ||
|
||
// print the input files loaded | ||
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 < 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; | ||
|
||
// loop over events | ||
cout << "Start event loop ..." << endl; | ||
for (unsigned int ievt = 0; ievt < nevents; ++ievt) { | ||
cout << "Event: " << dec << ievt << endl; | ||
|
||
// read event and write to memories | ||
auto &fin_TrackletProjections = tb.files(trackletProjectionPattern); | ||
for (unsigned int i = 0; i < nTrackletProjections; i++) | ||
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++) | ||
fullmatcharray[i].clear(); | ||
|
||
// bx | ||
BXType bx = ievt; | ||
BXType bx_out; | ||
|
||
// Unit Under Test | ||
TOP_FUNC_(bx, tprojarray.data(), vmstub, allstub.data(), bx_out, fullmatcharray.data()); | ||
|
||
bool truncation = false; | ||
auto &fout_fullmatch = tb.files(fullMatchPattern); | ||
const auto &fullmatch_names = tb.fileNames(fullMatchPattern); | ||
|
||
// compare the computed outputs with the expected ones | ||
for (unsigned int i = 0; i < fullmatch_names.size(); i++) { | ||
const auto &fullmatch_name = fullmatch_names.at(i); | ||
auto &fout = fout_fullmatch.at(i); | ||
string label = "FullMatch " + to_string(i); | ||
err += compareMemWithFile<FullMatchMemory<fmProjMemType> > | ||
(fullmatcharray[i], fout, ievt, label, truncation); | ||
} | ||
|
||
} // end of event loop | ||
|
||
// This is necessary because HLS seems to only return an 8-bit error count, so if err%256==0, the test bench can falsely pass | ||
if (err > 255) err = 255; | ||
// cout << "Module actually has " << err << " errors." << endl; | ||
// return 0; | ||
return err; | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I think the xmacros could be simplified to just be X(TP_L5L6D) and then generate the underscore and the text substitution directly. This is more universally true for all X-macros. @bryates @aperloff