Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ release

# IDEs / Editors
.vscode/
.cache/
compile_commands.json
32 changes: 17 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.0.0)
project(dramsim3)
cmake_minimum_required(VERSION 3.10)
project(dramsim3 CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
Expand All @@ -14,9 +17,14 @@ endif()
add_library(inih INTERFACE)
target_include_directories(inih INTERFACE ext/headers)

add_library(format INTERFACE)
target_include_directories(format INTERFACE ext/fmt/include)
target_compile_definitions(format INTERFACE FMT_HEADER_ONLY=1)
find_package(fmt)
if(NOT fmt_FOUND)
message(STATUS "External fmt package not found, using internal one")
add_library(fmt INTERFACE)
target_include_directories(fmt INTERFACE ext/fmt/include)
target_compile_definitions(fmt INTERFACE FMT_HEADER_ONLY=1)
add_library(fmt::fmt-header-only ALIAS fmt)
endif(NOT fmt_FOUND)

# argparsing library, only used in main program not the library
add_library(args INTERFACE)
Expand All @@ -26,7 +34,7 @@ add_library(json INTERFACE)
target_include_directories(json INTERFACE ext/headers)

# Main DRAMSim Lib
add_library(dramsim3 SHARED
add_library(dramsim3
src/bankstate.cc
src/channel_state.cc
src/command_queue.cc
Expand Down Expand Up @@ -78,11 +86,8 @@ endif (ADDR_TRACE)

target_include_directories(dramsim3 INTERFACE src)
target_compile_options(dramsim3 PRIVATE -Wall)
target_link_libraries(dramsim3 PRIVATE inih format)
target_link_libraries(dramsim3 PRIVATE inih fmt::fmt-header-only)
set_target_properties(dramsim3 PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}
CXX_STANDARD 11
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)

Expand All @@ -91,21 +96,18 @@ add_executable(dramsim3main src/main.cc src/cpu.cc)
target_link_libraries(dramsim3main PRIVATE dramsim3 args)
target_compile_options(dramsim3main PRIVATE)
set_target_properties(dramsim3main PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)

# Unit testing
add_library(Catch INTERFACE)
target_include_directories(Catch INTERFACE ext/headers)
find_package(Catch2 3 REQUIRED)

add_executable(dramsim3test EXCLUDE_FROM_ALL
tests/test_config.cc
tests/test_dramsys.cc
tests/test_hmcsys.cc # IDK somehow this can literally crush your computer
)
target_link_libraries(dramsim3test Catch dramsim3)
target_link_libraries(dramsim3test Catch2::Catch2WithMain dramsim3)
target_include_directories(dramsim3test PRIVATE src/)

# We have to use this custome command because there's a bug in cmake
Expand Down
2 changes: 1 addition & 1 deletion src/command_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ bool CommandQueue::WillAcceptCommand(int rank, int bankgroup, int bank) const {
}

bool CommandQueue::QueueEmpty() const {
for (const auto q : queues_) {
for (const auto &q : queues_) {
if (!q.empty()) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/common.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "common.h"
#include "fmt/format.h"
#include <fmt/format.h>
#include <sstream>
#include <unordered_set>
#include <sys/stat.h>
Expand Down
4 changes: 2 additions & 2 deletions src/simple_stats.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <iostream>

#include "fmt/format.h"
#include <fmt/format.h>
#include "simple_stats.h"

namespace dramsim3 {
Expand Down Expand Up @@ -476,4 +476,4 @@ void SimpleStats::UpdateFinalStats() {
return;
}

} // namespace dramsim3
} // namespace dramsim3
2 changes: 1 addition & 1 deletion tests/test_config.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include "configuration.h"

TEST_CASE("Address Mapping", "[config]") {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dramsys.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include "configuration.h"
#include "dram_system.h"

Expand Down
2 changes: 1 addition & 1 deletion tests/test_hmcsys.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include "configuration.h"
#include "memory_system.h"

Expand Down