-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added wizard pages for State component and RAM Port
- Loading branch information
Showing
7 changed files
with
330 additions
and
27 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
plugins/gui/include/gui/gatelibrary_management/gatelibrary_pages/ram_port_wizardpage.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// 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 "gui/gatelibrary_management/gatelibrary_pages/generalinfo_wizardpage.h" | ||
|
||
|
||
#include <QWizardPage> | ||
#include <QGridLayout> | ||
#include <QTabWidget> | ||
#include <QLineEdit> | ||
#include <QTextEdit> | ||
#include <QLabel> | ||
|
||
namespace hal { | ||
class RAMPortWizardPage:public QWizardPage{ | ||
public: | ||
RAMPortWizardPage(QWidget* parent = nullptr); | ||
//void initializePage() override; | ||
//int nextId() const override; | ||
void setData(GateType* gate); | ||
|
||
private: | ||
QGridLayout* mLayout; | ||
|
||
QLineEdit* mDataGroup; | ||
QLineEdit* mAddressGroup; | ||
QLineEdit* mClockFunction; | ||
QLineEdit* mEnableFunciton; | ||
QLineEdit* mIsWritePort; | ||
|
||
QLabel* mLabDataGroup; | ||
QLabel* mLabAddressGroup; | ||
QLabel* mLabClockFunction; | ||
QLabel* mLabEnableFunciton; | ||
QLabel* mLabIsWritePort; | ||
}; | ||
} |
54 changes: 54 additions & 0 deletions
54
plugins/gui/include/gui/gatelibrary_management/gatelibrary_pages/state_wizardpage.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// 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 "gui/gatelibrary_management/gatelibrary_pages/generalinfo_wizardpage.h" | ||
|
||
|
||
#include <QWizardPage> | ||
#include <QGridLayout> | ||
#include <QTabWidget> | ||
#include <QLineEdit> | ||
#include <QTextEdit> | ||
#include <QLabel> | ||
|
||
namespace hal { | ||
class StateWizardPage:public QWizardPage{ | ||
public: | ||
StateWizardPage(QWidget* parent = nullptr); | ||
//void initializePage() override; | ||
//int nextId() const override; | ||
void setData(GateType* gate); | ||
|
||
private: | ||
QGridLayout* mLayout; | ||
|
||
QLineEdit* mStateIdentifier; | ||
QLineEdit* mNegStateIdentifier; | ||
|
||
QLabel* mLabStateIdentifier; | ||
QLabel* mLabNegStateIdentifier; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
plugins/gui/src/gatelibrary_management/gatelibrary_pages/ram_port_wizardpage.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
#include "gui/gatelibrary_management/gatelibrary_pages/ram_port_wizardpage.h" | ||
#include "gui/gatelibrary_management/gatelibrary_wizard.h" | ||
#include "gui/gatelibrary_management/gatelibrary_label.h" | ||
#include "hal_core/netlist/gate_library/gate_type_component/ram_port_component.h" | ||
|
||
namespace hal | ||
{ | ||
RAMPortWizardPage::RAMPortWizardPage(QWidget* parent) : QWizardPage(parent) | ||
{ | ||
setTitle("RAM Port"); | ||
setSubTitle("Enter parameters for RAM Port component"); | ||
mLayout = new QGridLayout(this); | ||
mLabDataGroup = new QLabel("Name of the data pingroup: "); | ||
mLabAddressGroup = new QLabel("Name of the address pingroup: "); | ||
mLabClockFunction = new QLabel("Clock boolean function: "); | ||
mLabEnableFunciton = new QLabel("Enable boolean function: "); | ||
mLabIsWritePort = new QLabel("Is a write port: "); | ||
|
||
|
||
int dataCnt =0, addrCnt=0; | ||
|
||
//Error at casting | ||
//GateLibraryWizard *wizard = reinterpret_cast<GateLibraryWizard*>(this->wizard()); | ||
//QList<PinModel::PINGROUP*> pingroups = wizard->getPingroups(); | ||
|
||
|
||
/*for (auto pinGroup : pingroups) { | ||
if(pinGroup->type == PinType::data) dataCnt++; | ||
if(pinGroup->type == PinType::address) addrCnt++; | ||
}*/ | ||
|
||
//check for equality? | ||
//if(dataCnt!=addrCnt) | ||
|
||
//create empty lines for ram_port for each data/address pair | ||
for (int i=0; i<dataCnt; i++) { | ||
mLayout->addWidget(new GateLibraryLabel(false, QString("RAM Port %1").arg(i+1), this)); | ||
|
||
mDataGroup = new QLineEdit(this); | ||
mAddressGroup = new QLineEdit(this); | ||
mClockFunction = new QLineEdit(this); | ||
mEnableFunciton = new QLineEdit(this); | ||
mIsWritePort = new QLineEdit(this); | ||
|
||
mLayout->addWidget(mLabDataGroup, 0, 0); | ||
mLayout->addWidget(mDataGroup, 0, 1); | ||
mLayout->addWidget(mLabAddressGroup, 1, 0); | ||
mLayout->addWidget(mAddressGroup, 1, 1); | ||
mLayout->addWidget(mLabClockFunction, 2, 0); | ||
mLayout->addWidget(mClockFunction, 2, 1); | ||
mLayout->addWidget(mLabEnableFunciton, 3, 0); | ||
mLayout->addWidget(mEnableFunciton, 3, 1); | ||
mLayout->addWidget(mLabIsWritePort, 4, 0); | ||
mLayout->addWidget(mIsWritePort, 4, 1); | ||
|
||
} | ||
|
||
/*mDataGroup = new QLineEdit(this); | ||
mAddressGroup = new QLineEdit(this); | ||
mClockFunction = new QLineEdit(this); | ||
mEnableFunciton = new QLineEdit(this); | ||
mIsWritePort = new QLineEdit(this); | ||
mLabDataGroup = new QLabel("Name of the data pingroup: "); | ||
mLabAddressGroup = new QLabel("Name of the address pingroup: "); | ||
mLabClockFunction = new QLabel("Clock boolean function: "); | ||
mLabEnableFunciton = new QLabel("Enable boolean function: "); | ||
mLabIsWritePort = new QLabel("Is a write port: "); | ||
mLayout->addWidget(mLabDataGroup, 0, 0); | ||
mLayout->addWidget(mDataGroup, 0, 1); | ||
mLayout->addWidget(mLabAddressGroup, 1, 0); | ||
mLayout->addWidget(mAddressGroup, 1, 1); | ||
mLayout->addWidget(mLabClockFunction, 2, 0); | ||
mLayout->addWidget(mClockFunction, 2, 1); | ||
mLayout->addWidget(mLabEnableFunciton, 3, 0); | ||
mLayout->addWidget(mEnableFunciton, 3, 1); | ||
mLayout->addWidget(mLabIsWritePort, 4, 0); | ||
mLayout->addWidget(mIsWritePort, 4, 1);*/ | ||
|
||
setLayout(mLayout); | ||
} | ||
|
||
// int InitWizardPage::nextId() const | ||
// { | ||
// auto parentWizard = wizard(); | ||
// if(!parentWizard) | ||
// return -1; | ||
// return static_cast<GateLibraryWizard*>(parentWizard)->getNextPageId(GateLibraryWizard::Init); | ||
// } | ||
|
||
void RAMPortWizardPage::setData(GateType *gate){ | ||
if(gate != nullptr && gate->has_component_of_type(GateTypeComponent::ComponentType::ram_port)) | ||
{ | ||
auto ram_ports = gate->get_components([](const GateTypeComponent* c) {return RAMPortComponent::is_class_of(c);}); | ||
int cnt = 1; | ||
|
||
if(!ram_ports.empty()) | ||
{ | ||
for (auto comp : ram_ports) { | ||
//mLayout->addWidget(new GateLibraryLabel(false, QString("RAM Port %1").arg(cnt), this)); | ||
auto ram_port = comp->convert_to<RAMPortComponent>(); | ||
|
||
GateLibraryLabel* dataGroup = new GateLibraryLabel(true,QString::fromStdString(ram_port->get_data_group()), this); | ||
GateLibraryLabel* addressGroup = new GateLibraryLabel(true, QString::fromStdString(ram_port->get_address_group()), this); | ||
GateLibraryLabel* clkFunc = new GateLibraryLabel(true, QString::fromStdString(ram_port->get_clock_function().to_string()), this); | ||
GateLibraryLabel* enableFunc = new GateLibraryLabel(true, QString::fromStdString(ram_port->get_enable_function().to_string()), this); | ||
GateLibraryLabel* writePort = new GateLibraryLabel(true, ram_port->is_write_port() ? "True" : "False", this); | ||
|
||
/*mLayout->addWidget(new GateLibraryLabel(false, "Name of the data pingroup:", this), dataGroup); | ||
mLayout->addWidget(new GateLibraryLabel(false, "Name of the address pingroup:", this), addressGroup); | ||
mLayout->addWidget(new GateLibraryLabel(false, "Clock boolean function:", this), clkFunc); | ||
mLayout->addWidget(new GateLibraryLabel(false, "Enable boolean function:", this), enableFunc); | ||
mLayout->addWidget(new GateLibraryLabel(false, "Is a write port:", this), writePort);*/ | ||
|
||
cnt++; | ||
} | ||
} | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
plugins/gui/src/gatelibrary_management/gatelibrary_pages/state_wizardpage.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "gui/gatelibrary_management/gatelibrary_pages/state_wizardpage.h" | ||
#include "gui/gatelibrary_management/gatelibrary_wizard.h" | ||
#include "hal_core/netlist/gate_library/gate_type_component/state_component.h" | ||
|
||
namespace hal | ||
{ | ||
StateWizardPage::StateWizardPage(QWidget* parent) : QWizardPage(parent) | ||
{ | ||
setTitle("State"); | ||
setSubTitle("Enter parameters for state component"); | ||
mLayout = new QGridLayout(this); | ||
|
||
mStateIdentifier = new QLineEdit(this); | ||
mNegStateIdentifier = new QLineEdit(this); | ||
|
||
mLabStateIdentifier = new QLabel("State identifier: "); | ||
mLabNegStateIdentifier = new QLabel("Negative state identifier: "); | ||
|
||
mLayout->addWidget(mLabStateIdentifier, 0, 0); | ||
mLayout->addWidget(mStateIdentifier, 0, 1); | ||
mLayout->addWidget(mLabNegStateIdentifier, 1, 0); | ||
mLayout->addWidget(mNegStateIdentifier, 1, 1); | ||
|
||
setLayout(mLayout); | ||
} | ||
|
||
// int InitWizardPage::nextId() const | ||
// { | ||
// auto parentWizard = wizard(); | ||
// if(!parentWizard) | ||
// return -1; | ||
// return static_cast<GateLibraryWizard*>(parentWizard)->getNextPageId(GateLibraryWizard::Init); | ||
// } | ||
|
||
void StateWizardPage::setData(GateType *gate){ | ||
if(gate != nullptr && gate->has_component_of_type(GateTypeComponent::ComponentType::state)) | ||
{ | ||
auto stat = gate->get_component_as<StateComponent>([](const GateTypeComponent* c) { return StateComponent::is_class_of(c); }); | ||
|
||
if(stat != nullptr) | ||
{ | ||
mStateIdentifier->setText(QString::fromStdString(stat->get_state_identifier())); | ||
mNegStateIdentifier->setText(QString::fromStdString(stat->get_neg_state_identifier())); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.