Skip to content
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

Options: Options class with libboost program_options #7

Merged
merged 1 commit into from
Jun 9, 2020
Merged
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
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ cmake_minimum_required (VERSION 3.1)
project(mcpat DESCRIPTION "Power Timing Area Calculator"
LANGUAGES CXX)

find_package(Boost 1.56 REQUIRED COMPONENTS
program_options)

set(THREADS_PREFER_PTHREAD_FLAG ON)

find_package(Threads REQUIRED)


set (MCPAT_VERSION_MAJOR 1)
set (MCPAT_VERSION_MINOR 3)
set (MCPAT_VERSION_PATCH 0)
Expand Down
34 changes: 17 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
add_subdirectory(cacti)

add_executable(mcpat
XML_Parse.h
arch_const.h
array.h
array.cc
basic_components.h
basic_components.cc
core.h
core.cc
globalvar.h
interconnect.h
iocontrollers.h
logic.h
memoryctrl.h
noc.h
processor.h
sharedcache.h
version.h
xmlParser.h
XML_Parse.cc
array.cc
basic_components.cc
core.cc
interconnect.cc
iocontrollers.h
iocontrollers.cc
logic.h
logic.cc
noc.h
noc.cc
main.cc
memoryctrl.h
memoryctrl.cc
noc.cc
options.h
options.cc
processor.h
processor.cc
sharedcache.h
sharedcache.cc
version.h
xmlParser.h
xmlParser.cc
XML_Parse.h
XML_Parse.cc
)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(mcpat LINK_PUBLIC cacti Threads::Threads)
target_link_libraries(mcpat LINK_PUBLIC cacti Threads::Threads Boost::program_options)

add_custom_command(TARGET mcpat POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:mcpat> ${PROJECT_BINARY_DIR}/mcpat
Expand Down
6 changes: 4 additions & 2 deletions src/XML_Parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@

using namespace std;

void ParseXML::parse(char *filepath) {
void ParseXML::parse(std::string filepath) {
unsigned int i, j, k, m, n;
unsigned int NumofCom_4;
unsigned int itmp;
char *fp = new char[filepath.length() + 1];
strcpy(fp, filepath.c_str());
// Initialize all structures
ParseXML::initialize();

// this open and parse the XML file:
XMLNode xMainNode = XMLNode::openFileHelper(
filepath, "component"); // the 'component' in the first layer
fp, "component"); // the 'component' in the first layer

XMLNode xNode2 = xMainNode.getChildNode(
"component"); // the 'component' in the second layer
Expand Down
2 changes: 1 addition & 1 deletion src/XML_Parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ typedef struct {

class ParseXML {
public:
void parse(char *filepath);
void parse(std::string filepath);
void initialize();

public:
Expand Down
12 changes: 8 additions & 4 deletions src/array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@

using namespace std;

ArrayST::ArrayST(const InputParameter *configure_interface, string _name,
enum Device_ty device_ty_, bool opt_local_,
enum Core_type core_ty_, bool _is_default)
ArrayST::ArrayST(const InputParameter *configure_interface,
string _name,
enum Device_ty device_ty_,
bool opt_local_,
enum Core_type core_ty_,
bool _is_default)
: l_ip(*configure_interface), name(_name), device_ty(device_ty_),
opt_local(opt_local_), core_ty(core_ty_), is_default(_is_default) {

Expand Down Expand Up @@ -221,7 +224,8 @@ void ArrayST::optimize_array() {
if (candidate_solutions.empty() == false) {
local_result.valid = true;
for (candidate_iter = candidate_solutions.begin();
candidate_iter != candidate_solutions.end(); ++candidate_iter)
candidate_iter != candidate_solutions.end();
++candidate_iter)

{
if (min_dynamic_energy > (candidate_iter)->power.readOp.dynamic) {
Expand Down
9 changes: 6 additions & 3 deletions src/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ using namespace std;
class ArrayST : public Component {
public:
ArrayST(){};
ArrayST(const InputParameter *configure_interface, string _name,
enum Device_ty device_ty_, bool opt_local_ = true,
enum Core_type core_ty_ = Inorder, bool _is_default = true);
ArrayST(const InputParameter *configure_interface,
string _name,
enum Device_ty device_ty_,
bool opt_local_ = true,
enum Core_type core_ty_ = Inorder,
bool _is_default = true);

InputParameter l_ip;
string name;
Expand Down
Loading