Skip to content

Commit

Permalink
Fixed small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
neoneela committed Jul 18, 2024
1 parent 972c40c commit 78373a7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <QGridLayout>
#include <QTabWidget>
#include <QLineEdit>
#include <QCheckBox>
#include <QLabel>

namespace hal {
Expand All @@ -45,7 +46,7 @@ namespace hal {
private:
QGridLayout* mLayout;

QComboBox* mAscending;
QCheckBox* mAscending;
//QLineEdit* mAscending;

QLabel* mLabAscending;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <QGridLayout>
#include <QTabWidget>
#include <QLineEdit>
#include <QCheckBox>
#include <QTextEdit>
#include <QLabel>

Expand All @@ -45,7 +46,7 @@ namespace hal {
QLineEdit* addressGroup;
QLineEdit* clockFunction;
QLineEdit* enableFunciton;
QComboBox* isWritePort;
QCheckBox* isWritePort;
};
QList<RAMPort> getRamPorts();
void setData(GateType* gate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@ namespace hal
for(std::pair<const std::basic_string<char>, BooleanFunction> bf : boolFunctions){
QLabel* label = new QLabel(QString::fromStdString(bf.first));
BooleanFunctionEdit* lineEdit;
if(mWizard->generalInfoPage->getProperties().contains("ff"))

if(mWizard->generalInfoPage->getProperties().contains("ff") || mWizard->generalInfoPage->getProperties().contains("latch"))
{
legVars.insert(mWizard->statePage->mStateIdentifier->text().toStdString());
lineEdit = new BooleanFunctionEdit(legVars, this);
legVars.insert(mWizard->statePage->mNegStateIdentifier->text().toStdString());
}
else lineEdit = new BooleanFunctionEdit(legVars, this);
lineEdit = new BooleanFunctionEdit(legVars, this);
mLayout->addWidget(label, boolFuncCnt, 0);
mLayout->addWidget(lineEdit, boolFuncCnt, 1);
lineEdit->setText(QString::fromStdString(bf.second.to_string()));
Expand All @@ -118,12 +119,14 @@ namespace hal
QLabel* label = new QLabel(pin->getName());
QString name = label->text();
BooleanFunctionEdit* lineEdit;
if(mWizard->generalInfoPage->getProperties().contains("ff"))

if(mWizard->generalInfoPage->getProperties().contains("ff") || mWizard->generalInfoPage->getProperties().contains("latch"))
{
legVars.insert(mWizard->statePage->mStateIdentifier->text().toStdString());
lineEdit = new BooleanFunctionEdit(legVars, this);
legVars.insert(mWizard->statePage->mNegStateIdentifier->text().toStdString());
}
else lineEdit = new BooleanFunctionEdit(legVars, this);
lineEdit = new BooleanFunctionEdit(legVars, this);

mLayout->addWidget(label, rowCount, 0);
mLayout->addWidget(lineEdit, rowCount, 1);
connect(lineEdit,&BooleanFunctionEdit::stateChanged,this,&BoolWizardPage::handleStateChanged);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ namespace hal
setSubTitle("Enter parameters for LUT component");
mLayout = new QGridLayout(this);

mAscending = new QComboBox(this);
mAscending->addItems({"Ascending", "Descending"});
mAscending = new QCheckBox(this);

mLabAscending = new QLabel("Bit order: ");
mLabAscending = new QLabel("Bit order ascending: ");

mLayout->addWidget(mLabAscending, 0, 0);
mLayout->addWidget(mAscending, 0, 1);
Expand All @@ -27,7 +26,7 @@ namespace hal
{
auto lutc = gate->get_component_as<LUTComponent>([](const GateTypeComponent* c) { return LUTComponent::is_class_of(c); });

if(lutc != nullptr) mAscending->setCurrentText(QString::fromStdString(lutc->is_init_ascending() ? "Ascending" : "Descending"));
if(lutc != nullptr) mAscending->setChecked(lutc->is_init_ascending());
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void RAMPortWizardPage::initializePage(){

//create empty lines for ram_port for each data/address pair
//assumption at this point: #data fields = #address fields
for (int i=0; i<pinGroups.length(); i++) { //-1 for dummy entries
for (int i=0; i<pinGroups.length(); i++) {
if(pinGroups[i]->getItemType() == PinItem::TreeItemType::GroupCreator) continue;
PinType type = pinGroups[i]->getPinType();
if(type == PinType::data)
Expand All @@ -38,8 +38,7 @@ void RAMPortWizardPage::initializePage(){
rp.addressGroup = new QLineEdit(this);
rp.clockFunction = new QLineEdit(this);
rp.enableFunciton = new QLineEdit(this);
rp.isWritePort = new QComboBox(this);
rp.isWritePort->addItems({"True", "False"});
rp.isWritePort = new QCheckBox(this);

mLabDataGroup = new QLabel("Name of the data pingroup: ");
mLabAddressGroup = new QLabel("Name of the address pingroup: ");
Expand All @@ -58,13 +57,13 @@ void RAMPortWizardPage::initializePage(){
mLayout->addWidget(mLabIsWritePort, 6*(ramPortCnt-1)+5, 0);
mLayout->addWidget(rp.isWritePort, 6*(ramPortCnt-1)+5, 1);

if(!ram_ports.empty()) {
if(!ram_ports.empty() && ramPortCnt<=ram_ports.size()) {
auto ram_port = ram_ports[ramPortCnt-1]->convert_to<RAMPortComponent>();
rp.dataGroup->setText(QString::fromStdString(ram_port->get_data_group()));
rp.addressGroup->setText(QString::fromStdString(ram_port->get_address_group()));
rp.clockFunction->setText(QString::fromStdString(ram_port->get_clock_function().to_string()));
rp.enableFunciton->setText(QString::fromStdString(ram_port->get_clock_function().to_string()));
rp.isWritePort->setCurrentText(ram_port->is_write_port() ? "True":"False");
rp.enableFunciton->setText(QString::fromStdString(ram_port->get_enable_function().to_string()));
rp.isWritePort->setChecked(ram_port->is_write_port());
}
mRamPortEdits.append(rp);
}
Expand Down
11 changes: 4 additions & 7 deletions plugins/gui/src/gatelibrary_management/gatelibrary_wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ namespace hal
identifiers.push_back(id.toStdString());
}
std::unique_ptr<GateTypeComponent> init_component = GateTypeComponent::create_init_component(initPage->mCategory->text().toStdString(), identifiers);
parentComponent = GateTypeComponent::create_lut_component(std::move(init_component), lutPage->mAscending->currentText() == "Ascending");
parentComponent = GateTypeComponent::create_lut_component(std::move(init_component), lutPage->mAscending->isChecked());
}
else if(prop == "ff")
{
Expand Down Expand Up @@ -203,14 +203,11 @@ namespace hal
std::unique_ptr<GateTypeComponent> component = GateTypeComponent::create_latch_component(std::move(state_component));
LatchComponent* latch_component = component->convert_to<LatchComponent>();

BooleanFunction data_in_bf;
BooleanFunction enable_bf;

auto data_in_res = BooleanFunction::from_string(latchPage->mDataIn->text().toStdString());
auto enable_res = BooleanFunction::from_string(latchPage->mEnableOn->text().toStdString());

if(data_in_res.is_ok()) data_in_bf = data_in_res.get();
if(enable_res.is_ok()) enable_bf = enable_res.get();
if(data_in_res.is_ok()) latch_component->set_data_in_function(data_in_res.get());
if(enable_res.is_ok()) latch_component->set_enable_function(enable_res.get());

BooleanFunction async_reset;
auto async_reset_res = BooleanFunction::from_string(latchPage->mAReset->text().toStdString());
Expand Down Expand Up @@ -251,7 +248,7 @@ namespace hal
rpEdit.addressGroup->text().toStdString(),
clocked_on_bf,
enabled_on_bf,
rpEdit.isWritePort->currentText() == "True");
rpEdit.isWritePort->isChecked());
}
parentComponent = GateTypeComponent::create_ram_component(std::move(sub_component), ramPage->mBitSize->text().toInt());
}
Expand Down

0 comments on commit 78373a7

Please sign in to comment.