From 42b533434bbff391847427d605b6a054d5f64411 Mon Sep 17 00:00:00 2001 From: Mukendi Mputu Date: Tue, 24 May 2022 21:53:15 +0200 Subject: [PATCH] first intent --- .gitignore | 3 ++- CacheAnalysisPass/CacheAnalysisPass.cpp | 4 +-- helper.sh | 2 +- include/AbstractState.h | 34 +++++++++++++++++++++---- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index e275226..93685fb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ build/ .cache/ *.solution compile_commands.json -llvm/ \ No newline at end of file +llvm/ +.idea \ No newline at end of file diff --git a/CacheAnalysisPass/CacheAnalysisPass.cpp b/CacheAnalysisPass/CacheAnalysisPass.cpp index 97c4d2a..9313f12 100644 --- a/CacheAnalysisPass/CacheAnalysisPass.cpp +++ b/CacheAnalysisPass/CacheAnalysisPass.cpp @@ -56,10 +56,10 @@ struct CacheAnalysisPass : PassInfoMixin { bool PrintEdgesPost = false; bool DumpToDot = false; bool DumpNodes = false; - bool LoopUnrolling = true; + bool LoopUnrolling = false; // Assume a 4kB Cache - // with 16 Sets, associativity of 4 and Cachelines fitting two + // with 16 Sets, associativity of 4 and Cachelines fitting two times the instruction size CacheType Cache = CacheType(16, 4, 128); StringRef EntryPoint = "main"; unsigned int EntryAddress; diff --git a/helper.sh b/helper.sh index c4138d6..6afb7bf 100755 --- a/helper.sh +++ b/helper.sh @@ -7,7 +7,7 @@ clean () { } config () { - echo "==== Crating build folder ====" + echo "==== Creating build folder ====" mkdir build cd build echo "==== Configuring cmake ====" diff --git a/include/AbstractState.h b/include/AbstractState.h index 46149d6..b5defef 100644 --- a/include/AbstractState.h +++ b/include/AbstractState.h @@ -100,10 +100,6 @@ public: // everything is public, because IDGAF Unrolled = UnrolledIn; } - // AbstractState(Address Addr) { - // Sets[Addr.Index].Associativity[0] = {{Addr.Tag}}; - // } - void setUnrolled(unsigned int In) { Unrolled = In; } bool operator==(AbstractState In) { @@ -140,6 +136,35 @@ public: // everything is public, because IDGAF * The exercise is to Fill this function with an LRU must Join. * For this you need to use Sets. Associativity and Blocks. */ + // TODO: Due date 08.06.2022 + + // Loop through all 16 sets + for (int Index; Index < 16; Index++) { + + // create a temporary set of associativity + struct Set temp_set; + + // loop through all 4 Ages + for (int Age; Age < 4; Age++) { + struct Set current_set = Sets[Index]; + struct Set incoming_set = In.Sets[Index]; + + // loop through current set and build list of all contained blocks + for (auto age: current_set.Associativity) { + std::cout << age.first + << ":"; + for (auto block : age.second.Blocks) + std::cout << block << std::endl; + } + // loop through incoming set and build list of all contained blocks + for (auto E2 : In.Sets[Index].Associativity[Age].Blocks) { + + } + } + + Sets[Index] = temp_set; + + } } /** @@ -244,6 +269,5 @@ public: // everything is public, because IDGAF } llvm::outs() << "}\n"; } - }; // namespace #endif // STATE_H \ No newline at end of file