Skip to content

Commit

Permalink
logic_evaluator plugin added
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed Jul 3, 2024
1 parent 830c0d1 commit 92c0b50
Show file tree
Hide file tree
Showing 6 changed files with 242 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
!hgl_writer/**/*
!liberty_parser*
!liberty_parser/**/*
!logic_evaluator*
!logic_evaluator/**/*
!netlist_preprocessing*
!netlist_preprocessing/**/*
!python_shell*
Expand Down
24 changes: 24 additions & 0 deletions plugins/logic_evaluator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
option(PL_LOGIC_EVALUATOR "PL_LOGIC_EVALUATOR" ON)
if(PL_LOGIC_EVALUATOR OR BUILD_ALL_PLUGINS)

find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)

if(Qt5Core_FOUND)
message(VERBOSE "Qt5Core_INCLUDE_DIRS: ${Qt5Core_INCLUDE_DIRS}")
elseif(NOT Qt5Core_FOUND)
message(STATUS "Qt5Core not found for logic_evaluator")
endif(Qt5Core_FOUND)


file(GLOB_RECURSE LOGIC_EVALUATOR_INC ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
file(GLOB_RECURSE LOGIC_EVALUATOR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE LOGIC_EVALUATOR_PYTHON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/python/*.cpp)
qt5_wrap_cpp(MOC_HDR ${LOGIC_EVALUATOR_INC})

hal_add_plugin(logic_evaluator
SHARED
HEADER ${LOGIC_EVALUATOR_INC}
SOURCES ${LOGIC_EVALUATOR_SRC} ${LOGIC_EVALUATOR_PYTHON_SRC} ${MOC_HDR}
LINK_LIBRARIES PUBLIC gui Qt5::Core Qt5::Gui Qt5::Widgets)

endif()
74 changes: 74 additions & 0 deletions plugins/logic_evaluator/include/logic_evaluator/logic_evaluator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// MIT License
//
// Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
// Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
// Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
// Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma once

#include "hal_core/defines.h"
#include "hal_core/netlist/gate.h"
#include "hal_core/netlist/net.h"
#include "hal_core/netlist/netlist_writer/netlist_writer.h"
#include "gui/content_widget/content_widget.h"
#include "gui/content_manager/content_manager.h"
#include <functional>
#include <map>
#include <sstream>
#include <QString>
#include <QMap>
#include <QCheckBox>
#include <QTabWidget>
#include <vector>
#include <memory>
#include <unordered_set>

class QStatusBar;
class QProgressBar;
class QCloseEvent;

namespace hal
{
/* forward declaration */
class Netlist;

/**
* @ingroup netlist_writer
*/
class NETLIST_API LogicEvaluator : public QObject
{
Q_OBJECT

public:

LogicEvaluator(QWidget* parent = nullptr);
~LogicEvaluator();

void setGates(std::vector<Gate*> gates);

private Q_SLOTS:

public Q_SLOTS:

private:
};
} // namespace hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// MIT License
//
// Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
// Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
// Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
// Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma once

#include "hal_core/plugin_system/plugin_interface_base.h"
#include <QMetaType>

Q_DECLARE_METATYPE(std::string)

namespace hal
{

class LogicEvaluator;
class NetlistSimulator;

class PLUGIN_API LogicEvaluatorPlugin : public BasePluginInterface
{
public:
std::string get_name() const override;
std::string get_version() const override;
std::string get_description() const override;

void on_load() override;
void on_unload() override;
std::set<std::string> get_dependencies() const override;
};
} // namespace hal
45 changes: 45 additions & 0 deletions plugins/logic_evaluator/src/logic_evaluator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "logic_evaluator/logic_evaluator.h"

#include "hal_core/netlist/gate.h"
#include "hal_core/netlist/net.h"
#include "hal_core/netlist/netlist.h"
#include "hal_core/utilities/log.h"
#include "hal_core/plugin_system/plugin_manager.h"
#include "gui/gui_globals.h"
#include "gui/gui_utils/graphics.h"
#include "gui/toolbar/toolbar.h"

#include <QFile>
#include <QDate>
#include <QColor>
#include <QFileDialog>
#include <QStatusBar>
#include <QAction>
#include <QMenu>
#include <QDebug>
#include <QApplication>
#include <QScreen>
#include <QVBoxLayout>
#include <QProgressBar>
#include <QInputDialog>
#include <QTabBar>
#include "hal_core/plugin_system/plugin_manager.h"

namespace hal
{


LogicEvaluator::LogicEvaluator(QWidget *parent)
: QObject(parent)
{
}

LogicEvaluator::~LogicEvaluator()
{
}

void LogicEvaluator::setGates(std::vector<Gate*> gates)
{
}

} // namespace hal
47 changes: 47 additions & 0 deletions plugins/logic_evaluator/src/plugin_logic_evaluator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "logic_evaluator/plugin_logic_evaluator.h"

#include "hal_core/netlist/netlist_writer/netlist_writer_manager.h"
#include "logic_evaluator/logic_evaluator.h"
#include "gui/content_manager/content_manager.h"
#include "gui/gui_globals.h"
#include <QDebug>

namespace hal
{
extern std::unique_ptr<BasePluginInterface> create_plugin_instance()
{
return std::make_unique<LogicEvaluatorPlugin>();
}

std::string LogicEvaluatorPlugin::get_name() const
{
return std::string("waveform_viewer");
}

std::string LogicEvaluatorPlugin::get_version() const
{
return std::string("0.7");
}

std::string LogicEvaluatorPlugin::get_description() const
{
return std::string("GUI to control simulation and view resulting waveforms");
}

std::set<std::string> LogicEvaluatorPlugin::get_dependencies() const
{
std::set<std::string> retval;
retval.insert("netlist_simulator_controller");
retval.insert("hal_gui");
return retval;
}

void LogicEvaluatorPlugin::on_load()
{
qRegisterMetaType<std::string>();
}

void LogicEvaluatorPlugin::on_unload()
{
}
} // namespace hal

0 comments on commit 92c0b50

Please sign in to comment.