From a366afb0bd31e2acccc0ad2e983f11d73f1b81c2 Mon Sep 17 00:00:00 2001 From: Andrew Hart Date: Thu, 22 Jun 2023 19:25:28 -0400 Subject: [PATCH 1/6] Added compiler flags from CMSSW. --- project/env_hls.tcl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/project/env_hls.tcl b/project/env_hls.tcl index 42e4420ca7d..d6401928613 100644 --- a/project/env_hls.tcl +++ b/project/env_hls.tcl @@ -13,3 +13,7 @@ if { ([string first "vitis" $exe] > -1) && ($year > 2019) } { interp alias {} cosim_design {} interp invokehidden {} -- cosim_design -verbose } +# CXXFLAGS adapted from CMSSW_12_6_0_pre5 +# Retrieved by running the following: +# $ scram b echo_CXXFLAGS +set ::env(CCFLAG) "-Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-deprecated-copy -Wno-unused-parameter -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-unused-label" From 67b407ab460040ba161d543afb9f054ef0d5ba4d Mon Sep 17 00:00:00 2001 From: Andrew Hart Date: Thu, 22 Jun 2023 19:27:09 -0400 Subject: [PATCH 2/6] Append to CCFLAG. --- project/script_MC.tcl | 2 +- project/script_ME.tcl | 2 +- project/script_MP.tcl | 2 +- project/script_PR.tcl | 2 +- project/script_TB.tcl | 2 +- project/script_TC.tcl | 2 +- project/script_TE.tcl | 2 +- project/script_TP.tcl | 2 +- project/script_VMR.tcl | 2 +- project/script_VMRCM.tcl | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/project/script_MC.tcl b/project/script_MC.tcl index 60fc409b7d1..f6381ae5876 100644 --- a/project/script_MC.tcl +++ b/project/script_MC.tcl @@ -39,7 +39,7 @@ foreach i $modules_to_test { puts [join [list "top function = " $top_func] ""] # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] # run C-simulation for each module in modules_to_test set_top $top_func diff --git a/project/script_ME.tcl b/project/script_ME.tcl index ef81510619b..b8f2c34621e 100644 --- a/project/script_ME.tcl +++ b/project/script_ME.tcl @@ -56,7 +56,7 @@ foreach i $modules_to_test { puts [join [list "top function = " $topfunction] ""] # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"KLAYERDISK=" $kLayerDisk "\" -D \"KMODULE=" $i "_\" -D \"TOPFUNCTION=" $topfunction "\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"KLAYERDISK=" $kLayerDisk "\" -D \"KMODULE=" $i "_\" -D \"TOPFUNCTION=" $topfunction "\""] ""] # run C-simulation for each module in modules_to_test set_top $topfunction diff --git a/project/script_MP.tcl b/project/script_MP.tcl index 3d328d99663..18c2e0ae742 100644 --- a/project/script_MP.tcl +++ b/project/script_MP.tcl @@ -44,7 +44,7 @@ foreach i $modules_to_test { puts [join [list "top function = " $top_func] ""] # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] # run C-simulation for each module in modules_to_test set_top $top_func diff --git a/project/script_PR.tcl b/project/script_PR.tcl index 8d752d78e4a..c61dfd4280e 100644 --- a/project/script_PR.tcl +++ b/project/script_PR.tcl @@ -58,7 +58,7 @@ foreach i $modules_to_test { set top_func [join [list "ProjectionRouterTop_" [string range $i 3 8]] ""] # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"MODULE_=" $module "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"MODULE_=" $module "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] # run C-simulation for each module in modules_to_test set_top $top_func diff --git a/project/script_TB.tcl b/project/script_TB.tcl index 3553b4390b7..32f77cffe6f 100644 --- a/project/script_TB.tcl +++ b/project/script_TB.tcl @@ -38,7 +38,7 @@ foreach i $modules_to_test { set top_func [join [list "TrackBuilder_" $seed] ""] # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"SEED_=" $seed "_\" -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"SEED_=" $seed "_\" -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] # run C-simulation for each module in modules_to_test set_top $top_func diff --git a/project/script_TC.tcl b/project/script_TC.tcl index 9d18be20b6b..16d6ac7c579 100644 --- a/project/script_TC.tcl +++ b/project/script_TC.tcl @@ -55,7 +55,7 @@ foreach i $modules_to_test { set top_func [join [list "TrackletCalculator_" $seed $iTC] ""] # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"SEED_=" $seed "_\" -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"SEED_=" $seed "_\" -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] # run C-simulation for each module in modules_to_test set_top $top_func diff --git a/project/script_TE.tcl b/project/script_TE.tcl index 18c74dcaa98..201f1facf82 100644 --- a/project/script_TE.tcl +++ b/project/script_TE.tcl @@ -64,7 +64,7 @@ foreach i $modules_to_test { } # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"SEED_=" $seed "_\" -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\" -D \"INNER_TABLE_=\\\"" $innerTable "\\\"\" -D \"OUTER_TABLE_=\\\"" $outerTable "\\\"\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"SEED_=" $seed "_\" -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\" -D \"INNER_TABLE_=\\\"" $innerTable "\\\"\" -D \"OUTER_TABLE_=\\\"" $outerTable "\\\"\""] ""] # run C-simulation for each module in modules_to_test set_top $top_func diff --git a/project/script_TP.tcl b/project/script_TP.tcl index b297a37d755..1cda9af4337 100644 --- a/project/script_TP.tcl +++ b/project/script_TP.tcl @@ -40,7 +40,7 @@ foreach i $modules_to_test { set top_func [join [list "TrackletProcessor_" $seed $iTC] ""] # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"SEED_=" $seed "_\" -D \"ITC_=" $iTC "_\" -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"SEED_=" $seed "_\" -D \"ITC_=" $iTC "_\" -D \"MODULE_=" $i "_\" -D \"TOP_FUNC_=" $top_func "\""] ""] # run C-simulation for each module in modules_to_test set_top $top_func diff --git a/project/script_VMR.tcl b/project/script_VMR.tcl index a9a702e7d76..41ede523679 100644 --- a/project/script_VMR.tcl +++ b/project/script_VMR.tcl @@ -80,7 +80,7 @@ foreach i $modules_to_test { set header_file [join [list "\\\"" $top_func ".h\\\""] ""] # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"TOP_FUNC_=" $top_func "\" -D \"HEADER_FILE_=" $header_file "\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"TOP_FUNC_=" $top_func "\" -D \"HEADER_FILE_=" $header_file "\""] ""] # run C-simulation for each module in modules_to_test add_files ../TopFunctions/$top_func.cc -cflags "$CFLAGS" diff --git a/project/script_VMRCM.tcl b/project/script_VMRCM.tcl index 24382949d1a..6a2588aec29 100644 --- a/project/script_VMRCM.tcl +++ b/project/script_VMRCM.tcl @@ -80,7 +80,7 @@ foreach i $modules_to_test { set header_file [join [list "\\\"" $top_func ".h\\\""] ""] # set macros for this module in CCFLAG environment variable - set ::env(CCFLAG) [join [list "-D \"TOP_FUNC_=" $top_func "\" -D \"HEADER_FILE_=" $header_file "\""] ""] + set ::env(CCFLAG) [join [list $::env(CCFLAG) " -D \"TOP_FUNC_=" $top_func "\" -D \"HEADER_FILE_=" $header_file "\""] ""] # run C-simulation for each module in modules_to_test add_files ../TopFunctions/CombinedConfig/$top_func.cc -cflags "$CFLAGS" From 30c0284ee094c91f29b72ccf29404b0a31c93f98 Mon Sep 17 00:00:00 2001 From: Andrew Hart Date: Thu, 9 Nov 2023 11:42:13 -0500 Subject: [PATCH 3/6] Sorted flags and removed unrecognized ones. --- project/env_hls.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/env_hls.tcl b/project/env_hls.tcl index d6401928613..875e4da7236 100644 --- a/project/env_hls.tcl +++ b/project/env_hls.tcl @@ -16,4 +16,4 @@ if { ([string first "vitis" $exe] > -1) && ($year > 2019) } { # CXXFLAGS adapted from CMSSW_12_6_0_pre5 # Retrieved by running the following: # $ scram b echo_CXXFLAGS -set ::env(CCFLAG) "-Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-deprecated-copy -Wno-unused-parameter -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-unused-label" +set ::env(CCFLAG) "-Wall -Werror=address -Werror=array-bounds -Werror=conversion-null -Werror=delete-non-virtual-dtor -Werror=format -Werror=format-contains-nul -Werror=main -Werror=missing-braces -Werror=narrowing -Werror=overflow -Werror=overlength-strings -Werror=pointer-arith -Werror=reorder -Werror=return-local-addr -Werror=return-type -Werror=sign-compare -Werror=strict-aliasing -Werror=switch -Werror=type-limits -Werror=unused-but-set-variable -Werror=unused-value -Werror=unused-variable -Werror=write-strings -Wno-attributes -Wno-deprecated -Wno-ignored-qualifiers -Wno-long-long -Wno-non-template-friend -Wnon-virtual-dtor -Wno-psabi -Wno-unused-but-set-parameter -Wno-unused-label -Wno-unused-local-typedefs -Wno-unused-parameter -Wno-vla -Wparentheses -Wreturn-type -Wunused" From 17e45a35d1a0112a31170dd56773d607df77b0d4 Mon Sep 17 00:00:00 2001 From: Andrew Hart Date: Thu, 9 Nov 2023 11:43:34 -0500 Subject: [PATCH 4/6] Fixed compiler errors/warnings. --- TestBenches/InputRouter_test.cpp | 20 +++----------------- TestBenches/MatchCalculator_test.cpp | 1 - TestBenches/MatchEngine_test.cpp | 3 --- TestBenches/MatchProcessor_test.cpp | 1 - TestBenches/VMRouterCM_test.cpp | 13 +++++-------- TestBenches/VMRouter_test.cpp | 15 +++++++-------- TrackletAlgorithm/InputRouter.h | 4 ++-- TrackletAlgorithm/MatchCalculator.h | 11 ----------- TrackletAlgorithm/MatchProcessor.h | 4 ++-- TrackletAlgorithm/TrackBuilder.h | 8 ++++---- TrackletAlgorithm/VMRouter.h | 4 ---- 11 files changed, 23 insertions(+), 61 deletions(-) diff --git a/TestBenches/InputRouter_test.cpp b/TestBenches/InputRouter_test.cpp index 3ad6a2e13b6..bf2985d8d3e 100644 --- a/TestBenches/InputRouter_test.cpp +++ b/TestBenches/InputRouter_test.cpp @@ -42,18 +42,11 @@ CablingMap getMap( std::string pInputWiresMap ) // read line // and look for connections where // VMR is the output - bool cFoundInputLink=false; std::string cInputLink = ""; std::string cVMRMemory = ""; while (cStream >> cToken) { - if( cPrevToken.find("input") != std::string::npos - && cToken.find("output") != std::string::npos ) - { - cFoundInputLink = true; - } - if( cPrevToken.find("output") != std::string::npos && cToken.find("VMR") != std::string::npos ) { @@ -168,18 +161,11 @@ DtcMap getCablingMap( std::string pInputWiresMap ) // read line // and look for connections where // VMR is the output - bool cFoundInputLink=false; std::string cInputLink = ""; std::string cVMRMemory = ""; while (cStream >> cToken) { - if( cPrevToken.find("input") != std::string::npos - && cToken.find("output") != std::string::npos ) - { - cFoundInputLink = true; - } - if( cPrevToken.find("output") != std::string::npos && cToken.find("VMR") != std::string::npos ) { @@ -454,8 +440,8 @@ ap_uint getLnkWrd(CablingMap pDtcMap } void decodeLnkWrd(ap_uint pLnkWrd) { - int cNlyrs = pLnkWrd.range( kLINKMAPwidth-1, kLINKMAPwidth-1-(3-1)); - int cIs2S = pLnkWrd.range(kLINKMAPwidth-4,kLINKMAPwidth-4); + unsigned int cNlyrs = pLnkWrd.range( kLINKMAPwidth-1, kLINKMAPwidth-1-(3-1)); + unsigned int cIs2S = pLnkWrd.range(kLINKMAPwidth-4,kLINKMAPwidth-4); std::cout << "LnkWrd 0x" << std::hex << int(pLnkWrd) << std::dec << "\t..." @@ -497,7 +483,7 @@ void prepareInputStreams( ifstream * pInputStreams auto hLinkWord = getLnkWrd(pDtcMap,pLinkId); int cMemIndx=0; std::vector cLyrs = getLyrs( pDtcMap , pLinkId ); - for(int cLyrIndx=0; cLyrIndx< cLyrs.size(); cLyrIndx++) + for(unsigned int cLyrIndx=0; cLyrIndx< cLyrs.size(); cLyrIndx++) { ap_uint hWrd = hLinkWord.range(kSizeLinkWord*cLyrIndx+kSizeLinkWord-1,kSizeLinkWord*cLyrIndx); //if( hWrd == 0) continue; diff --git a/TestBenches/MatchCalculator_test.cpp b/TestBenches/MatchCalculator_test.cpp index 322eeb543de..d5a874b5cff 100644 --- a/TestBenches/MatchCalculator_test.cpp +++ b/TestBenches/MatchCalculator_test.cpp @@ -97,7 +97,6 @@ int main() // 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 > diff --git a/TestBenches/MatchEngine_test.cpp b/TestBenches/MatchEngine_test.cpp index 0242b392504..0116b94ff74 100644 --- a/TestBenches/MatchEngine_test.cpp +++ b/TestBenches/MatchEngine_test.cpp @@ -8,9 +8,6 @@ #include "FileReadUtility.h" #include "Macros.h" -// HLS Headers -#include "hls_math.h" - // STL Headers #include #include diff --git a/TestBenches/MatchProcessor_test.cpp b/TestBenches/MatchProcessor_test.cpp index 9416b99db1c..255dc911766 100644 --- a/TestBenches/MatchProcessor_test.cpp +++ b/TestBenches/MatchProcessor_test.cpp @@ -98,7 +98,6 @@ int main() // 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 > diff --git a/TestBenches/VMRouterCM_test.cpp b/TestBenches/VMRouterCM_test.cpp index 172129984d2..886df79f7d1 100644 --- a/TestBenches/VMRouterCM_test.cpp +++ b/TestBenches/VMRouterCM_test.cpp @@ -25,8 +25,6 @@ const int nEvents = 100; //number of events to run int main() { - constexpr int sector = 4; // Specifies the sector/nonant - //////////////////////////////////////////////////////////////// // Get the test vectors @@ -49,7 +47,6 @@ int main() { const auto nASCopies = tb.nFiles(allStubPattern); const auto nASInnerCopies = tb.nFiles(allStubInnerPattern); - const auto nVMSME = tb.nFiles(mePattern); const auto nVMSTE = tb.nFiles(tePattern); // Make sure that the number of input and output memories are correct @@ -93,25 +90,25 @@ int main() { cout << "Event: " << dec << ievt << endl; // Clear output memories - for (int i=0; i>(inputStubs[i], fin_inputstubs[i], ievt); } - for (unsigned int i = 0; i < numInputsDisk2S; i++) { + for (int i = 0; i < numInputsDisk2S; i++) { writeMemFromFile>(inputStubsDisk2S[i], fin_inputstubs_disk2s[i], ievt); } diff --git a/TestBenches/VMRouter_test.cpp b/TestBenches/VMRouter_test.cpp index e41da2a0ce9..13c3b1e2f1c 100644 --- a/TestBenches/VMRouter_test.cpp +++ b/TestBenches/VMRouter_test.cpp @@ -24,8 +24,8 @@ using namespace std; const int nEvents = 100; //number of events to run // Count the number of copies of each memory in a file name vector -vector countCopies(const vector &fileNames) { - vector numCopies; // Each element in vector corresponds to one memory, i.e. L1PHIE17 +vector countCopies(const vector &fileNames) { + vector numCopies; // Each element in vector corresponds to one memory, i.e. L1PHIE17 string fileName = "temporary file name"; // Loop over all file names for (auto f = fileNames.begin(); f != fileNames.end(); ++f) { @@ -42,7 +42,6 @@ vector countCopies(const vector &fileNames) { int main() { - constexpr int sector = 4; // Specifies the sector constexpr char phi = 'A' + phiRegion; // Converts phiRegion to char char overlapPhiRegion[] = {'X', 'Y', 'Z', 'W', 'Q', 'R', 'S', 'T'}; // Special naming for the TE overlap memories, and outer memories in Disk 1 @@ -89,7 +88,7 @@ int main() { auto &fout_vmstubteo = tb.files(teoPattern); // Get the number of copies for each TE memory - vector zero = {0}; + vector zero = {0}; auto numCopiesTEI = (nTotVMSTEI) ? countCopies(tb.fileNames(teiPattern)) : zero; auto numCopiesOL = (nTotVMSTEOL) ? countCopies(tb.fileNames(teolPattern)) : zero; auto numCopiesTEO = (nTotVMSTEO) ? countCopies(tb.fileNames(teoPattern)) : zero; @@ -148,7 +147,7 @@ int main() { for (unsigned int i = 0; i < numInputs; i++) { writeMemFromFile>(inputStubs[i], fin_inputstubs[i], ievt); } - for (unsigned int i = 0; i < numInputsDisk2S; i++) { + for (int i = 0; i < numInputsDisk2S; i++) { writeMemFromFile>(inputStubsDisk2S[i], fin_inputstubs_disk2s[i], ievt); } @@ -194,7 +193,7 @@ int main() { // TE Inner Memories if (nTotVMSTEI) { - int k = 0; + unsigned int k = 0; for (unsigned int i = 0; i < nvmTEI; i++) { for (unsigned int j = 0; j < numCopiesTEI[i]; j++) { if (k >= nTotVMSTEI) break; @@ -206,7 +205,7 @@ int main() { // TE Inner Overlap memories if (nTotVMSTEOL) { - int k = 0; + unsigned int k = 0; for (unsigned int i = 0; i < nvmOL; i++) { for (unsigned int j = 0; j < numCopiesOL[i]; j++) { if (k >= nTotVMSTEOL) break; @@ -218,7 +217,7 @@ int main() { // TE Outer memories if (nTotVMSTEO) { - int k = 0; + unsigned int k = 0; for (unsigned int i = 0; i < nvmTEO; i++) { for (unsigned int j = 0; j < numCopiesTEO[i]; j++) { if (k >= nTotVMSTEO) break; diff --git a/TrackletAlgorithm/InputRouter.h b/TrackletAlgorithm/InputRouter.h index 97b3a80ef16..f46a5734aee 100644 --- a/TrackletAlgorithm/InputRouter.h +++ b/TrackletAlgorithm/InputRouter.h @@ -208,7 +208,7 @@ void ClearCounters(unsigned int nMemories #pragma HLS inline #pragma HLS array_partition variable = nEntries complete LOOP_ClearCounters: - for (int cIndx = 0; cIndx < nEntriesSize ; cIndx++) + for (unsigned int cIndx = 0; cIndx < nEntriesSize ; cIndx++) { #pragma HLS unroll nEntries[cIndx]=0; @@ -225,7 +225,7 @@ void CountMemories(const ap_uint hPhBnWord #pragma HLS array_partition variable = nMemsPerLyr complete int cPrevSize=0; LOOP_CountOutputMemories: - for (int cLyr = 0; cLyr < kMaxLyrsPerDTC ; cLyr++) + for (unsigned int cLyr = 0; cLyr < kMaxLyrsPerDTC ; cLyr++) { #pragma HLS unroll //auto hBnWrd = hPhBnWord.range(kSizeBinWord * cLyr + (kSizeBinWord-1), kSizeBinWord * cLyr); diff --git a/TrackletAlgorithm/MatchCalculator.h b/TrackletAlgorithm/MatchCalculator.h index bbeb0d6ecfb..aa66e39ead0 100644 --- a/TrackletAlgorithm/MatchCalculator.h +++ b/TrackletAlgorithm/MatchCalculator.h @@ -751,7 +751,6 @@ void MatchCalculator(BXType bx, // Full match shift register to store best match typename AllProjection::AProjTCSEED projseed; FullMatch bestmatch; - bool goodmatch = false; ap_uint<1> inc_fm = 1; @@ -846,14 +845,6 @@ void MatchCalculator(BXType bx, bool vB_L3_next = false; bool sA_L3_next = false; bool sB_L3_next = false; - bool read1_next = false; - bool read2_next = false; - bool read3_next = false; - bool read4_next = false; - bool read5_next = false; - bool read6_next = false; - bool read7_next = false; - bool read8_next = false; bool read_next[8]; read_next_loop: for(int i = 0; i < totalMatchCopies; ++i) { // priority encoder ALWAYS expects 8 #pragma HLS unroll @@ -1104,7 +1095,6 @@ void MatchCalculator(BXType bx, typename AllProjection::AProjRZ proj_z = proj.getRZ(); typename AllProjection::AProjPHIDER proj_phid = proj.getPhiDer(); typename AllProjection::AProjRZDER proj_zd = proj.getRZDer(); - bool isProjDisk = proj_seed >= TF::D1; // Calculate residuals @@ -1270,7 +1260,6 @@ void MatchCalculator(BXType bx, // pipeline the bestmatch registers bestmatch = bestmatch_next; - goodmatch = goodmatch_next; projseed = projseed_next; }// end MC_LOOP diff --git a/TrackletAlgorithm/MatchProcessor.h b/TrackletAlgorithm/MatchProcessor.h index 5fc9fc4bd64..c854af0b606 100644 --- a/TrackletAlgorithm/MatchProcessor.h +++ b/TrackletAlgorithm/MatchProcessor.h @@ -1195,7 +1195,7 @@ void MatchProcessor(BXType bx, ap_uint<1> table[kNMatchEngines][LAYER(table[iMEU]); } @@ -1318,7 +1318,7 @@ void MatchProcessor(BXType bx, bool anyidle = false; - MEU_get_trkids: for(int iMEU = 0; iMEU < kNMatchEngines; ++iMEU) { + MEU_get_trkids: for(unsigned int iMEU = 0; iMEU < kNMatchEngines; ++iMEU) { #pragma HLS unroll matchengine[iMEU].set_empty(); idles[iMEU] = matchengine[iMEU].idle(); diff --git a/TrackletAlgorithm/TrackBuilder.h b/TrackletAlgorithm/TrackBuilder.h index 2a4aca2e2b4..fc70a99cd40 100644 --- a/TrackletAlgorithm/TrackBuilder.h +++ b/TrackletAlgorithm/TrackBuilder.h @@ -32,7 +32,7 @@ getFM(const BXType bx, const FullMatchMemory &fullMatches, const uns } // TrackBuilder top template function -template +template void TrackBuilder( const BXType bx, const TrackletParameterMemory trackletParameters[], @@ -45,8 +45,8 @@ void TrackBuilder( ) { - constexpr unsigned NFMBarrel = NFMPerStubBarrel0 + (NBarrelStubs - 1) * NFMPerStubBarrel; - constexpr unsigned NFMDisk = NDiskStubs * NFMPerStubDisk; + constexpr int NFMBarrel = NFMPerStubBarrel0 + (NBarrelStubs - 1) * NFMPerStubBarrel; + constexpr int NFMDisk = NDiskStubs * NFMPerStubDisk; // Circular buffers for each of the input full-match memories. FullMatch barrel_fm[NFMBarrel][1< barrel_stub_valid = false; diff --git a/TrackletAlgorithm/VMRouter.h b/TrackletAlgorithm/VMRouter.h index 8588dae05a7..a3ee4a06288 100644 --- a/TrackletAlgorithm/VMRouter.h +++ b/TrackletAlgorithm/VMRouter.h @@ -195,7 +195,6 @@ inline VMStubME createStubME(const InputStub stub, int nrBits = r.length(); // Number of bits for r int nzBits = z.length(); // Number of bits for z - int nbendBits = bend.length(); // Number of bits for bend int nfinerzbits = stubME.getFineZ().length(); // Number of bits for finer/z int nFinePhiBits = stubME.getFinePhi().length(); // Number of bits used for fine phi @@ -300,7 +299,6 @@ inline VMStubTEInner createStubTEInner(const InputStub stub, int nrBits = r.length(); // Number of bits for r int nzBits = z.length(); // Number of bits for z - int nbendBits = bend.length(); // Number of bits for bend int nFinePhiBits = stubTEI.getFinePhi().length(); // Number of bits used for fine phi // Number of bits used for table indices @@ -380,7 +378,6 @@ inline VMStubTEOuter createStubTEOuter(const InputStub stub, int nrBits = r.length(); // Number of bits for r int nzBits = z.length(); // Number of bits for z - int nbendBits = bend.length(); // Number of bits for bend int nfinerzbits = stubTEO.getFineZ().length(); // Number of bits for finer/z int nFinePhiBits = stubTEO.getFinePhi().length(); // Number of bits for finephi @@ -470,7 +467,6 @@ inline VMStubTEInner createStubTEOverlap(const InputStub stub, int nrBits = r.length(); // Number of bits for r int nzBits = z.length(); // Number of bits for z - int nbendBits = bend.length(); // Number of bits for bend // Number of bits constexpr auto vmbits = ((Layer == 1) || (Layer == 2)) ? nbitsallstubs[Layer - 1] + nbits_vmte_overlap[Layer - 1] : 0; // Number of bits used for VMs From a503e65b4d4e8b8a1081aa7b18eaae4b6fbfeacc Mon Sep 17 00:00:00 2001 From: Andrew Hart Date: Wed, 6 Dec 2023 10:09:44 -0500 Subject: [PATCH 5/6] Fixed errors missed in first pass. --- TestBenches/ProjectionRouter_test.cpp | 1 - TestBenches/TrackBuilder_test.cpp | 36 +++++++++++++-------------- TrackletAlgorithm/ProjectionRouter.h | 6 ++--- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/TestBenches/ProjectionRouter_test.cpp b/TestBenches/ProjectionRouter_test.cpp index 59e7c57f93d..b60689a566d 100644 --- a/TestBenches/ProjectionRouter_test.cpp +++ b/TestBenches/ProjectionRouter_test.cpp @@ -92,7 +92,6 @@ int main() err += compareMemWithFile >(allproj, fout_aproj.at(0), ievt, "AllProjection", truncation); for (unsigned int i = 0; i < vmproj_names.size(); i++) { - const auto &vmproj_name = vmproj_names.at(i); auto &fout = fout_vmproj.at(i); string label = "VMProjection " + to_string(i); err += compareMemWithFile > diff --git a/TestBenches/TrackBuilder_test.cpp b/TestBenches/TrackBuilder_test.cpp index 3e4a7a548d8..9bac6cd31fe 100644 --- a/TestBenches/TrackBuilder_test.cpp +++ b/TestBenches/TrackBuilder_test.cpp @@ -21,29 +21,29 @@ using namespace std; #endif #if SEED_ == L1L2_ - constexpr unsigned kNBarrelStubs = 4; - constexpr unsigned kNDiskStubs = 4; + constexpr int kNBarrelStubs = 4; + constexpr int kNDiskStubs = 4; #elif SEED_ == L2L3_ - constexpr unsigned kNBarrelStubs = 3; - constexpr unsigned kNDiskStubs = 4; + constexpr int kNBarrelStubs = 3; + constexpr int kNDiskStubs = 4; #elif SEED_ == L3L4_ - constexpr unsigned kNBarrelStubs = 4; - constexpr unsigned kNDiskStubs = 2; + constexpr int kNBarrelStubs = 4; + constexpr int kNDiskStubs = 2; #elif SEED_ == L5L6_ - constexpr unsigned kNBarrelStubs = 4; - constexpr unsigned kNDiskStubs = 0; + constexpr int kNBarrelStubs = 4; + constexpr int kNDiskStubs = 0; #elif SEED_ == D1D2_ - constexpr unsigned kNBarrelStubs = 2; - constexpr unsigned kNDiskStubs = 3; + constexpr int kNBarrelStubs = 2; + constexpr int kNDiskStubs = 3; #elif SEED_ == D3D4_ - constexpr unsigned kNBarrelStubs = 1; - constexpr unsigned kNDiskStubs = 3; + constexpr int kNBarrelStubs = 1; + constexpr int kNDiskStubs = 3; #elif SEED_ == L1D1_ - constexpr unsigned kNBarrelStubs = 0; - constexpr unsigned kNDiskStubs = 4; + constexpr int kNBarrelStubs = 0; + constexpr int kNDiskStubs = 4; #elif SEED_ == L2D1_ - constexpr unsigned kNBarrelStubs = 1; - constexpr unsigned kNDiskStubs = 3; + constexpr int kNBarrelStubs = 1; + constexpr int kNDiskStubs = 3; #else # error "Undefined seed" #endif @@ -138,9 +138,9 @@ int main() // Clear all output memories before starting. for (unsigned short i = 0; i < kMaxProc; i++) { trackWord[i] = TrackFit_t::TrackWord(0); - for (unsigned short j = 0; j < kNBarrelStubs; j++) + for (short j = 0; j < kNBarrelStubs; j++) barrelStubWords[j][i] = TrackFit_t::BarrelStubWord(0); - for (unsigned short j = 0; j < kNDiskStubs; j++) + for (short j = 0; j < kNDiskStubs; j++) diskStubWords[j][i] = TrackFit_t::DiskStubWord(0); } tracksMem.clear(); diff --git a/TrackletAlgorithm/ProjectionRouter.h b/TrackletAlgorithm/ProjectionRouter.h index a1b1d5f9c2a..d840fa17c88 100644 --- a/TrackletAlgorithm/ProjectionRouter.h +++ b/TrackletAlgorithm/ProjectionRouter.h @@ -82,14 +82,14 @@ void ProjectionRouter(BXType bx, ap_uint numbersin[nINMEM]; ap_uint mem_read_addr; - PROC_LOOP: for (int istep = 0; istep < kMaxProc - kMaxProcOffset(module::PR); ++istep) { + PROC_LOOP: for (unsigned int istep = 0; istep < kMaxProc - kMaxProcOffset(module::PR); ++istep) { #pragma HLS PIPELINE II=1 rewind if (istep == 0) { // reset output memories & counters nallproj = 0; #pragma HLS ARRAY_PARTITION variable=nvmprojout complete dim=0 - for (int i=0; i 0) mem_hasdata.set(i); From d081fc3e812ded5bc5b3d79418bfd32c345ccfd5 Mon Sep 17 00:00:00 2001 From: Andrew Hart Date: Thu, 7 Dec 2023 12:41:20 -0500 Subject: [PATCH 6/6] Reverted template parameters to unsigned for C-synthesis. --- TrackletAlgorithm/TrackBuilder.h | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/TrackletAlgorithm/TrackBuilder.h b/TrackletAlgorithm/TrackBuilder.h index fc70a99cd40..795da904bce 100644 --- a/TrackletAlgorithm/TrackBuilder.h +++ b/TrackletAlgorithm/TrackBuilder.h @@ -32,7 +32,7 @@ getFM(const BXType bx, const FullMatchMemory &fullMatches, const uns } // TrackBuilder top template function -template +template void TrackBuilder( const BXType bx, const TrackletParameterMemory trackletParameters[], @@ -45,8 +45,8 @@ void TrackBuilder( ) { - constexpr int NFMBarrel = NFMPerStubBarrel0 + (NBarrelStubs - 1) * NFMPerStubBarrel; - constexpr int NFMDisk = NDiskStubs * NFMPerStubDisk; + constexpr unsigned NFMBarrel = NFMPerStubBarrel0 + (NBarrelStubs - 1) * NFMPerStubBarrel; + constexpr unsigned NFMDisk = NDiskStubs * NFMPerStubDisk; // Circular buffers for each of the input full-match memories. FullMatch barrel_fm[NFMBarrel][1< nMatches = 0; // there can be up to eight matches (3 bits) - barrel_stub_association : for (short j = 0; j < NBarrelStubs; j++) { + barrel_stub_association : for (unsigned short j = 0; j < NBarrelStubs; j++) { - const int nFM = (j == 0 ? NFMPerStubBarrel0 : NFMPerStubBarrel); + const unsigned nFM = (j == 0 ? NFMPerStubBarrel0 : NFMPerStubBarrel); const unsigned nFMCumulative = (j == 0 ? 0 : (j == 1 ? NFMPerStubBarrel0 : NFMPerStubBarrel0 + (j - 1) * NFMPerStubBarrel)); ap_uint<1> barrel_stub_valid = false; - barrel_stub_valid : for (short k = 0; k < nFM; k++) + barrel_stub_valid : for (unsigned short k = 0; k < nFM; k++) barrel_stub_valid = (barrel_stub_valid || barrel_valid[nFMCumulative + k]); nMatches += (barrel_stub_valid ? 1 : 0); @@ -227,10 +227,10 @@ void TrackBuilder( } } - disk_stub_association : for (short j = 0; j < NDiskStubs; j++) { + disk_stub_association : for (unsigned short j = 0; j < NDiskStubs; j++) { ap_uint<1> disk_stub_valid = false; - disk_stub_valid : for (short k = 0; k < NFMPerStubDisk; k++) + disk_stub_valid : for (unsigned short k = 0; k < NFMPerStubDisk; k++) disk_stub_valid = (disk_stub_valid || disk_valid[j * NFMPerStubDisk + k]); nMatches += (disk_stub_valid ? 1 : 0); @@ -292,7 +292,7 @@ void TrackBuilder( // object that was constructed. if (track.getTrackValid()) { trackWord[nTracks] = track.getTrackWord(); - barrel_stub_words: for (short j = 0 ; j < NBarrelStubs; j++) { + barrel_stub_words: for (unsigned short j = 0 ; j < NBarrelStubs; j++) { switch (j) { case 0: barrelStubWords[j][nTracks] = track.template getStubValid<0>() ? track.template getBarrelStubWord<0>() : typename TrackFit::BarrelStubWord(0); @@ -308,7 +308,7 @@ void TrackBuilder( break; } } - disk_stub_words: for (short j = 0 ; j < NDiskStubs; j++) { + disk_stub_words: for (unsigned short j = 0 ; j < NDiskStubs; j++) { switch (j) { case 0: diskStubWords[j][nTracks] = track.template getStubValid() ? track.template getDiskStubWord() : typename TrackFit::DiskStubWord(0); @@ -329,7 +329,7 @@ void TrackBuilder( // Update the circular buffer indices and read a new element from each of // the input full-match memories. - barrel_circular_buffer_update : for (short j = 0; j < NFMBarrel; j++) { + barrel_circular_buffer_update : for (unsigned short j = 0; j < NFMBarrel; j++) { barrel_read_index[j] += (barrel_valid[j] ? 1 : 0); const ap_uint barrel_next_write_index = barrel_write_index[j] + 1; const ap_uint<1> barrel_not_full = (barrel_next_write_index != barrel_read_index[j]); @@ -338,7 +338,7 @@ void TrackBuilder( barrel_write_index[j] += ((empty || barrel_not_full) ? 1 : 0); } - disk_circular_buffer_update : for (short j = 0; j < NFMDisk; j++) { + disk_circular_buffer_update : for (unsigned short j = 0; j < NFMDisk; j++) { disk_read_index[j] += (disk_valid[j] ? 1 : 0); const ap_uint disk_next_write_index = disk_write_index[j] + 1; const ap_uint<1> disk_not_full = (disk_next_write_index != disk_read_index[j]);