Skip to content

Commit

Permalink
Reorganized Core Directory (#239)
Browse files Browse the repository at this point in the history
Added several subdirectories to the `core` directory to created new
libraries for each "unit" to make the repo easier to navigate.
  • Loading branch information
kathlenemagnus authored Dec 17, 2024
1 parent e370d4f commit 0a1d7b4
Show file tree
Hide file tree
Showing 62 changed files with 127 additions and 122 deletions.
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,8 @@ include_directories (SYSTEM fsl)
include_directories (SYSTEM mavis)
include_directories (SYSTEM stf_lib)

# Mavis, the Core, MSS, the simulator and Fusion

# Mavis
add_subdirectory (mavis)
add_subdirectory (core)
add_subdirectory (mss)

# Tell FSL to use the top mavis submodule, instead of fsl's submodule
set(FSL_MAVIS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/mavis")
Expand All @@ -79,6 +76,10 @@ add_subdirectory (fsl)
# Add STF library to the build
add_subdirectory (${STF_LIB_BASE})

# The Core and MSS
add_subdirectory (core)
add_subdirectory (mss)

# Add testing, but do not build as part of the 'all' target
add_subdirectory (test EXCLUDE_FROM_ALL)

Expand All @@ -87,7 +88,7 @@ add_executable(olympia
sim/OlympiaSim.cpp
sim/main.cpp
)
target_link_libraries (olympia core mss SPARTA::sparta mavis ${STF_LINK_LIBS})
target_link_libraries (olympia core mss SPARTA::sparta ${STF_LINK_LIBS})
if (CMAKE_BUILD_TYPE MATCHES "^[Rr]elease")
target_compile_options (core PUBLIC -flto)
target_compile_options (mss PUBLIC -flto)
Expand Down
39 changes: 20 additions & 19 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
project (core)
add_library(core
FusionDecode.cpp
Core.cpp
SimpleBranchPred.cpp
ICache.cpp
Fetch.cpp
Decode.cpp
VectorUopGenerator.cpp
Rename.cpp
Dispatch.cpp
Dispatcher.cpp
Execute.cpp
ExecutePipe.cpp
Inst.cpp
InstArchInfo.cpp
InstGroup.cpp
InstGenerator.cpp
IssueQueue.cpp
ROB.cpp
LSU.cpp
MMU.cpp
DCache.cpp
MavisUnit.cpp
Preloader.cpp
CPU.cpp
CPUFactory.cpp
CPUTopology.cpp
)

add_library(instgen
Inst.cpp
InstArchInfo.cpp
InstGroup.cpp
InstGenerator.cpp
)

target_link_libraries(instgen stf zstd mavis)

get_property(SPARTA_INCLUDE_PROP TARGET SPARTA::sparta PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(core SYSTEM PRIVATE ${SPARTA_INCLUDE_PROP})

add_subdirectory(fetch)
add_subdirectory(decode)
add_subdirectory(rename)
add_subdirectory(dispatch)
add_subdirectory(execute)
add_subdirectory(vector)
add_subdirectory(lsu)

target_link_libraries(core fetch decode rename dispatch execute vector lsu instgen)
20 changes: 10 additions & 10 deletions core/CPUFactories.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

#include "sparta/simulation/ResourceFactory.hpp"
#include "Core.hpp"
#include "ICache.hpp"
#include "Fetch.hpp"
#include "Decode.hpp"
#include "VectorUopGenerator.hpp"
#include "Rename.hpp"
#include "Dispatch.hpp"
#include "Execute.hpp"
#include "LSU.hpp"
#include "fetch/ICache.hpp"
#include "fetch/Fetch.hpp"
#include "decode/Decode.hpp"
#include "vector/VectorUopGenerator.hpp"
#include "rename/Rename.hpp"
#include "dispatch/Dispatch.hpp"
#include "execute/Execute.hpp"
#include "lsu/LSU.hpp"
#include "MMU.hpp"
#include "SimpleTLB.hpp"
#include "BIU.hpp"
Expand All @@ -21,8 +21,8 @@
#include "ROB.hpp"
#include "FlushManager.hpp"
#include "Preloader.hpp"
#include "MavisUnit.hpp"
#include "IssueQueue.hpp"
#include "decode/MavisUnit.hpp"
#include "execute/IssueQueue.hpp"

namespace olympia{

Expand Down
2 changes: 1 addition & 1 deletion core/Inst.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "InstArchInfo.hpp"
#include "CoreTypes.hpp"
#include "VectorConfig.hpp"
#include "vector/VectorConfig.hpp"
#include "MiscUtils.hpp"

#include <cstdint>
Expand Down
2 changes: 1 addition & 1 deletion core/InstGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <memory>

#include "Inst.hpp"
#include "MavisUnit.hpp"
#include "decode/MavisUnit.hpp"
#include "sparta/utils/SpartaAssert.hpp"

#include "stf-inc/stf_inst_reader.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/MMU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ namespace olympia {
"Number of TLB misses", sparta::Counter::COUNT_NORMAL
};
};
}
}
6 changes: 6 additions & 0 deletions core/decode/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
add_library(decode
FusionDecode.cpp
Decode.cpp
MavisUnit.cpp
)
target_link_libraries(decode instgen)
4 changes: 2 additions & 2 deletions core/Decode.cpp → core/decode/Decode.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// <Decode.cpp> -*- C++ -*-

#include "Decode.hpp"
#include "VectorUopGenerator.hpp"
#include "decode/Decode.hpp"
#include "vector/VectorUopGenerator.hpp"
#include "fsl_api/FusionTypes.h"

#include "sparta/events/StartupEvent.hpp"
Expand Down
2 changes: 1 addition & 1 deletion core/Decode.hpp → core/decode/Decode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "CoreTypes.hpp"
#include "FlushManager.hpp"
#include "InstGroup.hpp"
#include "MavisUnit.hpp"
#include "decode/MavisUnit.hpp"

#include "fsl_api/FieldExtractor.h"
#include "fsl_api/Fusion.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions core/dispatch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_library(dispatch
Dispatch.cpp
Dispatcher.cpp
)
target_link_libraries(dispatch instgen)
2 changes: 1 addition & 1 deletion core/Dispatch.cpp → core/dispatch/Dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <algorithm>
#include "CoreUtils.hpp"
#include "Dispatch.hpp"
#include "dispatch/Dispatch.hpp"
#include "sparta/events/StartupEvent.hpp"

namespace olympia
Expand Down
2 changes: 1 addition & 1 deletion core/Dispatch.hpp → core/dispatch/Dispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "sparta/statistics/WeightedContextCounter.hpp"
#include "sparta/simulation/ResourceFactory.hpp"

#include "Dispatcher.hpp"
#include "dispatch/Dispatcher.hpp"
#include "CoreTypes.hpp"
#include "InstGroup.hpp"
#include "FlushManager.hpp"
Expand Down
4 changes: 2 additions & 2 deletions core/Dispatcher.cpp → core/dispatch/Dispatcher.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#include "Dispatcher.hpp"
#include "Dispatch.hpp"
#include "dispatch/Dispatcher.hpp"
#include "dispatch/Dispatch.hpp"

namespace olympia
{
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions core/execute/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_library(execute
Execute.cpp
ExecutePipe.cpp
IssueQueue.cpp
)
4 changes: 2 additions & 2 deletions core/Execute.cpp → core/execute/Execute.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// <Execute.cpp> -*- C++ -*-
#include "Execute.hpp"
#include "execute/Execute.hpp"
#include "CoreUtils.hpp"
#include "IssueQueue.hpp"
#include "execute/IssueQueue.hpp"
#include "sparta/utils/SpartaAssert.hpp"

namespace olympia
Expand Down
4 changes: 2 additions & 2 deletions core/Execute.hpp → core/execute/Execute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include "sparta/simulation/ResourceFactory.hpp"

#include "Inst.hpp"
#include "ExecutePipe.hpp"
#include "IssueQueue.hpp"
#include "execute/ExecutePipe.hpp"
#include "execute/IssueQueue.hpp"

namespace olympia
{
Expand Down
2 changes: 1 addition & 1 deletion core/ExecutePipe.cpp → core/execute/ExecutePipe.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <ExecutePipePipe.cpp> -*- C++ -*-

#include "ExecutePipe.hpp"
#include "execute/ExecutePipe.hpp"
#include "CoreUtils.hpp"
#include "sparta/utils/LogUtils.hpp"
#include "sparta/utils/SpartaAssert.hpp"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion core/IssueQueue.cpp → core/execute/IssueQueue.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <IssueQueue.cpp> -*- C++ -*-

#include "IssueQueue.hpp"
#include "execute/IssueQueue.hpp"
#include "CoreUtils.hpp"

namespace olympia
Expand Down
2 changes: 1 addition & 1 deletion core/IssueQueue.hpp → core/execute/IssueQueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "sparta/resources/PriorityQueue.hpp"

#include "CoreTypes.hpp"
#include "ExecutePipe.hpp"
#include "execute/ExecutePipe.hpp"
#include "FlushManager.hpp"
#include "Inst.hpp"

Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions core/fetch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
add_library(fetch
Fetch.cpp
ICache.cpp
SimpleBranchPred.cpp
)
target_link_libraries(fetch instgen)
4 changes: 2 additions & 2 deletions core/Fetch.cpp → core/fetch/Fetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//!

#include <algorithm>
#include "Fetch.hpp"
#include "fetch/Fetch.hpp"
#include "InstGenerator.hpp"
#include "MavisUnit.hpp"
#include "decode/MavisUnit.hpp"
#include "OlympiaAllocators.hpp"

#include "sparta/utils/MathUtils.hpp"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions core/lsu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_library(lsu
DCache.cpp
LSU.cpp
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions core/rename/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_library(rename
Rename.cpp
)
target_link_libraries(rename instgen)
2 changes: 1 addition & 1 deletion core/Rename.cpp → core/rename/Rename.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <algorithm>
#include "CoreUtils.hpp"
#include "Rename.hpp"
#include "rename/Rename.hpp"
#include "sparta/events/StartupEvent.hpp"
#include "sparta/app/FeatureConfiguration.hpp"
#include "sparta/report/DatabaseInterface.hpp"
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions core/vector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_library(vector
VectorUopGenerator.cpp
)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "VectorUopGenerator.hpp"
#include "vector/VectorUopGenerator.hpp"
#include "Inst.hpp"
#include "InstArchInfo.hpp"
#include "mavis/Mavis.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "Inst.hpp"
#include "FlushManager.hpp"
#include "MavisUnit.hpp"
#include "decode/MavisUnit.hpp"

#include <optional>

Expand Down
2 changes: 1 addition & 1 deletion mss/L2Cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "MemoryAccessInfo.hpp"

#include "CacheFuncModel.hpp"
#include "LSU.hpp"
#include "lsu/LSU.hpp"

namespace olympia_mss
{
Expand Down
2 changes: 1 addition & 1 deletion test/core/branch_pred/BranchPred_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "SimpleBranchPred.hpp"
#include "fetch/SimpleBranchPred.hpp"
#include "sparta/utils/SpartaTester.hpp"

TEST_INIT
Expand Down
2 changes: 1 addition & 1 deletion test/core/common/SourceUnit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#pragma once

#include "core/InstGenerator.hpp"
#include "core/MavisUnit.hpp"
#include "core/decode/MavisUnit.hpp"
#include "core/InstGroup.hpp"

#include "mavis/ExtractorDirectInfo.h"
Expand Down
2 changes: 1 addition & 1 deletion test/core/dcache/Dcache_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include "DCache.hpp"
#include "core/lsu/DCache.hpp"
#include <sparta/app/SimulationConfiguration.hpp>
#include <sparta/app/CommandLineSimulator.hpp>
#include "sparta/utils/SpartaTester.hpp"
Expand Down
4 changes: 2 additions & 2 deletions test/core/dcache/NextLvlSourceSinkUnit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "sparta/simulation/TreeNode.hpp"
#include "sparta/utils/LogUtils.hpp"
#include "core/MemoryAccessInfo.hpp"
#include "core/MavisUnit.hpp"
#include "core/decode/MavisUnit.hpp"

namespace dcache_test
{
Expand Down Expand Up @@ -50,4 +50,4 @@ namespace dcache_test
std::string purpose_;
sparta::Clock::Cycle sink_latency_;
};
} // namespace dcache_test
} // namespace dcache_test
32 changes: 1 addition & 31 deletions test/core/dispatch/Dispatch_test.cpp
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@

#include "CPUFactory.hpp"
#include "CoreUtils.hpp"
#include "Dispatch.hpp"
#include "MavisUnit.hpp"
#include "OlympiaAllocators.hpp"
#include "OlympiaSim.hpp"
#include "Rename.hpp"

#include "test/core/common/SinkUnit.hpp"
#include "test/core/common/SourceUnit.hpp"
#include "test/core/dispatch/Dispatch_test.hpp"
#include "test/core/dispatch/ExecutePipeSinkUnit.hpp"
#include "test/core/rename/ROBSinkUnit.hpp"

#include "sparta/app/CommandLineSimulator.hpp"
#include "sparta/app/Simulation.hpp"
#include "sparta/events/UniqueEvent.hpp"
#include "sparta/kernel/Scheduler.hpp"
#include "sparta/report/Report.hpp"
#include "sparta/resources/Buffer.hpp"
#include "sparta/simulation/ClockManager.hpp"
#include "sparta/sparta.hpp"
#include "sparta/statistics/StatisticSet.hpp"
#include "sparta/utils/SpartaSharedPointer.hpp"
#include "sparta/utils/SpartaTester.hpp"

#include <cinttypes>
#include <initializer_list>
#include <memory>
#include <sstream>
#include <vector>
#include "Dispatch_test.hpp"

TEST_INIT

Expand Down
Loading

0 comments on commit 0a1d7b4

Please sign in to comment.