diff --git a/Help/communityGuideLines.html b/Help/communityGuideLines.html index 661d67734..6413172ad 100644 --- a/Help/communityGuideLines.html +++ b/Help/communityGuideLines.html @@ -17,7 +17,7 @@

Community Guidelines

diff --git a/Plugins/MemoryViewGenerator/MemoryViewGenerator.pro b/Plugins/MemoryViewGenerator/MemoryViewGenerator.pro index 5b8b7e2ce..cd9766521 100644 --- a/Plugins/MemoryViewGenerator/MemoryViewGenerator.pro +++ b/Plugins/MemoryViewGenerator/MemoryViewGenerator.pro @@ -23,5 +23,5 @@ UI_DIR += ./GeneratedFiles RCC_DIR += ./GeneratedFiles include(MemoryViewGenerator.pri) -target.path = /usr/share/kactus2/plugins +target.path = $$plugin_path INSTALLS += target diff --git a/Plugins/PluginSystem/GeneratorPlugin/ViewSelection.cpp b/Plugins/PluginSystem/GeneratorPlugin/ViewSelection.cpp index 78154ecb4..0f7757a37 100644 --- a/Plugins/PluginSystem/GeneratorPlugin/ViewSelection.cpp +++ b/Plugins/PluginSystem/GeneratorPlugin/ViewSelection.cpp @@ -47,9 +47,10 @@ ViewSelection::ViewSelection( QString targetLanguage, { QSharedPointer cimp = instantiations_[view->getComponentInstantiationRef()]; - if (cimp && cimp->getLanguage() == targetLanguage_) + if (cimp && cimp->getLanguage().toLower() == targetLanguage_.toLower()) { view_ = view; + break; } } diff --git a/Plugins/PluginSystem/GeneratorPlugin/ViewSelectionWidget.cpp b/Plugins/PluginSystem/GeneratorPlugin/ViewSelectionWidget.cpp index 0b20d30f0..28103d6b4 100644 --- a/Plugins/PluginSystem/GeneratorPlugin/ViewSelectionWidget.cpp +++ b/Plugins/PluginSystem/GeneratorPlugin/ViewSelectionWidget.cpp @@ -150,7 +150,7 @@ void ViewSelectionWidget::setLanguage(QString selectedLanguage) } // Select color depending on match. - if (selectedLanguage == configuration_->getTargetLanguage()) + if (selectedLanguage.toLower() == configuration_->getTargetLanguage().toLower()) { instantiationLanguage_->setStyleSheet("QLabel { color : green; }"); } diff --git a/Plugins/common/HDLParser/HDLDesignParser.cpp b/Plugins/common/HDLParser/HDLDesignParser.cpp index b982becd5..abfdc52a2 100644 --- a/Plugins/common/HDLParser/HDLDesignParser.cpp +++ b/Plugins/common/HDLParser/HDLDesignParser.cpp @@ -90,7 +90,7 @@ void HDLDesignParser::parseDesign(QSharedPointer topCompone findInternalAdhocs(); assignInternalAdHocs(); - // Hiearchical ad hocs need to be considered separately. + // Hierarchical ad-hocs need to be considered separately. parseHierarchicallAdhocs(); // Finally add the parsed design to the list. @@ -574,7 +574,7 @@ void HDLDesignParser::assignLargerBounds(QSharedPointer wire, QP // Check the size of the new bounds. newBounds.first = boundCand.first.toInt(); - newBounds.second = boundCand.second.toInt();; + newBounds.second = boundCand.second.toInt(); // Find the widest alignment order of the new bounds. int maxAlignment1 = qMax(newBounds.first, newBounds.second); @@ -584,7 +584,7 @@ void HDLDesignParser::assignLargerBounds(QSharedPointer wire, QP // Check the size of the existing bounds. existingBound.first = wire->bounds.first.toInt(); - existingBound.second = wire->bounds.second.toInt();; + existingBound.second = wire->bounds.second.toInt(); // Find the widest alignment order of the existing bounds. int maxAlignment2 = qMax(existingBound.first, existingBound.second); @@ -620,57 +620,93 @@ void HDLDesignParser::findInternalAdhocs() QSharedPointer gah; // ...and ports connected to it. - QList > foundPorts; + QList > foundPorts; // Go through the port references within the ad-hoc connection. foreach(QSharedPointer internalPort, *adHocConnection->getInternalPortReferences()) - { - // Pair the instance and the port. - QPair port; - port.first = internalPort->getComponentRef(); - port.second = internalPort->getPortRef(); - foundPorts.append(port); - - // Go through existing detected ad-hocs. - foreach(QSharedPointer existing, retval_->adHocs_) - { - typedef QPair customPair; - foreach(customPair theirPort, existing->ports) - { - // If both instance and port matches, we use this ad-hoc connection. - if (theirPort.first == port.first && theirPort.second == port.second) - { - gah = existing; - break; - } - } + { + QSharedPointer gi = retval_->instances_.value(internalPort->getComponentRef()); - if(gah) - { - break; - } - } + // If instance could not be found, the port reference must be discarded. + if (!gi) + { + continue; + } + + // If the referred port is not found from the component of the instance, it cannot be used. + QSharedPointer ourPort = gi->component->ports.value(internalPort->getPortRef()); + + if (!ourPort) + { + continue; + } + + // Find the matching port assignment. + QSharedPointer gpa = gi->portAssignments_.value(ourPort->port->name()); + + // Create a new one if not found. + if (!gpa) + { + gpa = QSharedPointer(new GenerationPortAssignMent); + gi->portAssignments_.insert(ourPort->port->name(),gpa); + gpa->port = ourPort; + gpa->adhoc = true; + + // Try to apply a tie-off value. + gpa->tieOff = connectTieOff(adHocConnection->getTiedValue(), ourPort, DirectionTypes::IN); + + // Assigning bounds. + QPair bounds; + + if (internalPort->getPartSelect() && !internalPort->getPartSelect()->getLeftRange().isEmpty() + && !internalPort->getPartSelect()->getRightRange().isEmpty()) + { + // If Part select exists, it shall be used. + bounds.first = internalPort->getPartSelect()->getLeftRange(); + bounds.second = internalPort->getPartSelect()->getRightRange(); + } + else + { + // Otherwise, since it is an ad-hoc connection, a physical port is the only choice. + bounds = physicalPortBoundsInInstance(gi, ourPort); + } + + // Assign the bounds. + gpa->bounds = bounds; + } + + // Go through existing detected ad-hocs. + foreach(QSharedPointer existing, retval_->adHocs_) + { + if (existing->ports.contains(gpa)) + { + gah = existing; + break; + } + } + + if (!foundPorts.contains(gpa)) + { + foundPorts.append(gpa); + } } - // If the instance and its port was not found in existing ones, create a new. if (!gah) - { - gah = QSharedPointer(new GenerationAdHoc); - - // Create the wire of the ad hoc connection. - QSharedPointer gw(new GenerationWire); - gw->name = adHocConnection->name(); - gah->wire = gw; + { + // If the instance and its port was not found in existing ones, create a new. + gah = QSharedPointer(new GenerationAdHoc); - // If any tied value exists, it will be recorded as well. - gah->tieOff = adHocConnection->getTiedValue(); + // Create the wire of the ad hoc connection. + QSharedPointer gw(new GenerationWire); + gw->name = adHocConnection->name(); + gah->wire = gw; // Add to the pool of existing ones. - retval_->adHocs_.append(gah); - } + retval_->adHocs_.append(gah); + } - // Finally, the found pairs are appended to the connection. - gah->ports.append(foundPorts); + // Finally, the found pairs are appended to the connection. + gah->ports.append(foundPorts); } } @@ -679,58 +715,20 @@ void HDLDesignParser::findInternalAdhocs() //----------------------------------------------------------------------------- void HDLDesignParser::assignInternalAdHocs() { - // Go through each instance. - foreach (QSharedPointer gi, retval_->instances_) + // Go through each detected internal adhoc interconnection. + foreach(QSharedPointer existing, retval_->adHocs_) { - // Go through each detected internal adhoc interconnection. - foreach(QSharedPointer existing, retval_->adHocs_) + // Go through each port reference associated with the interconnection. + foreach(QSharedPointer theirPort, existing->ports) { - // Go through each port reference associated with the interconnection. - typedef QPair customPair; - foreach(customPair theirPort, existing->ports) + if (theirPort->tieOff.isEmpty()) { - // If the instance name does not match, it does not belong to this instance. - if (theirPort.first != gi->componentInstance_->getInstanceName()) - { - continue; - } + // If no tie-off connection cannot be applied, the wire is used. + QSharedPointer gw = existing->wire; + theirPort->wire = gw; - // If the port is not found from the component of the instance, it cannot be used. - QSharedPointer ourPort = gi->component->ports.value(theirPort.second); - - if (!ourPort) - { - continue; - } - - // Find the matching port assignment. - QSharedPointer gpa = gi->portAssignments_.value(ourPort->port->name()); - - // Create a new one if not found. - if (!gpa) - { - gpa = QSharedPointer(new GenerationPortAssignMent); - gi->portAssignments_.insert(ourPort->port->name(),gpa); - gpa->port = ourPort; - gpa->adhoc = true; - } - - // Try to apply a tie off value. - gpa->tieOff = connectTieOff(existing->tieOff, ourPort, DirectionTypes::IN); - - if (gpa->tieOff.isEmpty()) - { - // If no tie-off connection cannot be applied, the wire is used. - QSharedPointer gw = existing->wire; - gpa->wire = gw; - - // Since it is an ad-hoc connection, a physical connection is the only choice. - QPair bounds = physicalPortBoundsInInstance(gi, ourPort); - - // Assign if they are larger than existing ones. - assignLargerBounds(gw, bounds); - gpa->bounds = gw->bounds; - } + // Assign if they are larger than existing ones. + assignLargerBounds(gw, theirPort->bounds); } } } diff --git a/Plugins/common/HDLParser/HDLParserCommon.h b/Plugins/common/HDLParser/HDLParserCommon.h index f8bfe1337..f6c563749 100644 --- a/Plugins/common/HDLParser/HDLParserCommon.h +++ b/Plugins/common/HDLParser/HDLParserCommon.h @@ -143,16 +143,6 @@ struct GenerationWire QString name; }; -struct GenerationAdHoc -{ - //! The ports of the ad-hoc interconnection. - QList > ports; - //! The wire of the ad-hoc connection. - QSharedPointer wire; - //! If this is actually tied value assignment, this is non-empty. - QString tieOff; -}; - struct GenerationInterconnection { //! The interfaces assigned to the interconnection. @@ -191,6 +181,14 @@ struct GenerationPortAssignMent bool adhoc; }; +struct GenerationAdHoc +{ + //! The ports of the ad-hoc interconnection. + QList > ports; + //! The wire of the ad-hoc connection. + QSharedPointer wire; +}; + struct GenerationInstance { //! The component referenced by the instance. diff --git a/README.Linux b/README.Linux index d4b33e44b..9b77ef63d 100644 --- a/README.Linux +++ b/README.Linux @@ -1,55 +1,60 @@ -In order to build Kactus2, Qt5 must be installed on your system. -There are two ways to do this: +1. To build and run Kactus2, Qt5 must be installed on your system. + There are two ways to do this: -A) Installing Qt5 packages through the package manager (needs admin privileges) + A) Installing required Qt5 packages through the package manager (needs admin privileges) -The following packages are needed: -qt5-default -libqt5xmlpatterns5-dev -qttools5-private-dev -qttools5-dev-tools + On Ubuntu the following packages are needed: + qt5-default + libqt5xmlpatterns5-dev + qttools5-private-dev + qttools5-dev-tools -B) Manually downloading and installing from http://qt-project.org/downloads + B) Manually downloading and installing from https://www.qt.io/download/ -However, when using manually installed Qt5, you need to make sure that Kactus2 is installed -using its files. Open file configure and set the binary path of Qt5 as the value of variable QTBIN_PATH. -Notice that you need to have a slash at the end of the path. + When using manually installed Qt5, you need to make sure that Kactus2 is installed using its files: + Open file configure at the directory of Kactus2 and set the path of Qt5 build commands as the value of variable + QTBIN_PATH. Notice that you need to have a slash at the end of the path. + + Example: QTBIN_PATH="/home/username/Qt/5.7/gcc_64/bin/" -After successful installation of Qt5, change to directory of Kactus2. -There are two ways to build: +2. After successful installation of Qt5, change to the directory of Kactus2. + There are two ways to build: -A) An installation for all users, using admin privileges: -./configure -make -make install (needs admin privileges) + A) An installation for all users, using admin privileges: + ./configure + make + make install -B) A local installation for the current user: -Open file .qmake.conf and set the installation directory as the value of variable LOCAL_INSTALL_DIR. -./configure -make -make install + B) A local installation for the current user: + Open file .qmake.conf and set the installation directory as the value of variable LOCAL_INSTALL_DIR. + Example: LOCAL_INSTALL_DIR="/home/termospullo/kactus2" + + Now use the following commands in the given order: + ./configure + make + make install -WARNING: If you run file configure with wrong Qt binaries, you will have to delete the generated -makefiles before configuring again! + WARNING: If you do ./configure with wrong Qt binaries, you will have to delete the generated + makefiles before configuring again! -There are three ways to run Kactus2: +3. There are three ways to run Kactus2: -A) An installation shared between users: -/usr/bin/Kactus2 + A) An installation shared between users: + /usr/bin/Kactus2 -B) A local installation from the installation directory: -LD_LIBRARY_PATH=. ./Kactus2 + B) A local installation from the installation directory: + LD_LIBRARY_PATH=. ./Kactus2 -C) In some systems, a link to the executable may appear if Kactus2 was installed for all users. + C) In some systems, a link to the executable may appear if Kactus2 was installed for all users. Success reports --------------- -Tested on Ubuntu 16.04 64-bit on 20th Jun 2016 +Tested on Ubuntu 16.04.1 64-bit on 1st Dec 2016 Locally installed Qt 5.7.0 - Locally installed Kactus2 3.1.0 + Locally installed Kactus2 3.2.283 Required installation of package libglu1-mesa-dev with admin privileges -Tested on Ubuntu 16.04 64-bit on 16th Jun 2016 +Tested on Ubuntu 16.04.1 64-bit on 1st Dec 2016 Installed Qt 5.5.1 from packages - Installed Kactus2 3.0.193 for all users + Installed Kactus2 3.2.268 for all users diff --git a/configure b/configure index 498ad8a02..e770b4b98 100755 --- a/configure +++ b/configure @@ -5,9 +5,15 @@ echo "" QTBIN_PATH="" print_success() { - echo "" - echo "Kactus2 has now been configured. Run make to start the build." - echo "To install, run make install after the build has completed." + if [ -f "Makefile" ]; + then + echo "" + echo "Kactus2 has now been configured. Run make to start the build." + echo "To install, run make install after the build has completed." + else + echo "" + echo "The makefile was not created." + fi } # Generate compressed help files. @@ -15,16 +21,16 @@ echo "Generating compressed help files..." ${QTBIN_PATH}qhelpgenerator Help/kactus2help.qhp -o Help/Kactus2Help.qch ${QTBIN_PATH}qcollectiongenerator Help/kactus2help.qhcp -o Help/Kactus2Help.qhc -#Run qmake using qtchooser. if command -v ${QTBIN_PATH}qtchooser >/dev/null 2>&1; then + #Run qmake using qtchooser. echo "Qtchooser found. Running qmake through qtchooser..." ${QTBIN_PATH}qtchooser -run-tool=${QTBIN_PATH}qmake -qt=qt5 Kactus2_Solution.pro print_success elif command -v ${QTBIN_PATH}qmake >/dev/null 2>&1; then + #Run qmake directly. echo "Qtchooser not found. Running qmake directly..." ${QTBIN_PATH}qmake Kactus2_Solution.pro print_success else echo "Qmake not found. Please set variable QTBIN_PATH to Qt binary files." -fi - +fi \ No newline at end of file diff --git a/designEditors/MemoryDesigner/FieldGraphicsItem.cpp b/designEditors/MemoryDesigner/FieldGraphicsItem.cpp index 9e34b9597..93ab875c8 100644 --- a/designEditors/MemoryDesigner/FieldGraphicsItem.cpp +++ b/designEditors/MemoryDesigner/FieldGraphicsItem.cpp @@ -115,7 +115,7 @@ QString FieldGraphicsItem::removeZerosFromRangeValue(quint64 rangeValue) const QString formattedValue = getValueFormattedToHexadecimal(rangeValue); if (formattedValue.size() > 0) { - while (formattedValue.size() > 1 && formattedValue.at(0) == "0") + while (formattedValue.size() > 1 && formattedValue.at(0) == '0') { formattedValue = formattedValue.right(formattedValue.size() - 1); } diff --git a/tests/Plugins/HDLParser/tst_HDLParser.cpp b/tests/Plugins/HDLParser/tst_HDLParser.cpp index 26cf05e8c..1c0bf0929 100644 --- a/tests/Plugins/HDLParser/tst_HDLParser.cpp +++ b/tests/Plugins/HDLParser/tst_HDLParser.cpp @@ -67,6 +67,7 @@ private slots: void testPortMapsWithoutBoundsInInterconnection(); void testAdhocConnectionBetweenComponentInstances(); void testAdhocConnectionToVaryingSizePorts(); + void testAdhocConnectionWithPartSelect(); void testAdhocTieOffInComponentInstance(); void testMultipleAdhocConnectionsBetweenComponentInstances(); void testAdHocConnectionBetweenComponentInstancesWithExpressions(); @@ -1723,7 +1724,76 @@ void tst_HDLParser::testAdhocConnectionToVaryingSizePorts() QSharedPointer gpa = gi0->portAssignments_["enable_out"]; QCOMPARE( gpa->wire->name, QString("enableAdHoc") ); QCOMPARE( gpa->bounds.first, QString("16") ); + QCOMPARE( gpa->bounds.second, QString("4") ); + + gpa = gi1->portAssignments_["enable_in"]; + QCOMPARE( gpa->wire->name, QString("enableAdHoc") ); + QCOMPARE( gpa->bounds.first, QString("0") ); QCOMPARE( gpa->bounds.second, QString("0") ); +} + +//----------------------------------------------------------------------------- +// Function: tst_HDLParser::testAdhocConnectionWithPartSelect() +//----------------------------------------------------------------------------- +void tst_HDLParser::testAdhocConnectionWithPartSelect() +{ + QSharedPointer activeView(new View("rtl")); + activeView->setComponentInstantiationRef("instance1"); + + VLNV senderVLNV(VLNV::COMPONENT, "Test", "TestLibrary", "TestSender", "1.0"); + QSharedPointer senderComponent(new Component(senderVLNV)); + library_.addComponent(senderComponent); + addInstanceToDesign("sender", senderVLNV, activeView); + senderComponent->getViews()->append(activeView); + + QSharedPointer senderPort = QSharedPointer(new Port("enable_out", DirectionTypes::OUT)); + senderPort->setLeftBound("16"); + senderPort->setRightBound("4"); + senderComponent->getPorts()->append(senderPort); + + VLNV receiverVLNV(VLNV::COMPONENT, "Test", "TestLibrary", "TestReceiver", "1.0"); + QSharedPointer receiverView = addReceiverComponentToLibrary(receiverVLNV, General::SLAVE); + addInstanceToDesign("receiver", receiverVLNV, receiverView); + + addAdhocConnection("enableAdHoc", "sender", "enable_out", "receiver", "enable_in"); + + QSharedPointer ps(new PartSelect); + ps->setLeftRange("5"); + ps->setRightRange("3"); + design_->getAdHocConnections()->first()->getInternalPortReferences()->first()->setPartSelect(ps); + + QSharedPointer componentParser = + QSharedPointer(new HDLComponentParser(&library_, topComponent_)); + + componentParser->parseComponent(topView_); + QSharedPointer designParser = + QSharedPointer(new HDLDesignParser(&library_, design_, designConf_)); + designParser->parseDesign(componentParser->getParsedComponent(), topView_); + + QList > designs = designParser->getParsedDesigns(); + + QCOMPARE( designs.size(), 1 ); + QSharedPointer design = designs.first(); + + QCOMPARE( design->adHocs_.size(), 1 ); + + QSharedPointer gw0 = design->adHocs_.at(0)->wire; + + QCOMPARE( gw0->bounds.first, QString("5") ); + QCOMPARE( gw0->bounds.second, QString("0") ); + + QCOMPARE( design->instances_.size(), 2 ); + + QSharedPointer gi0 = design->instances_["sender"];; + QSharedPointer gi1 = design->instances_["receiver"]; + + QCOMPARE( gi0->portAssignments_.size(), 1 ); + QCOMPARE( gi1->portAssignments_.size(), 1 ); + + QSharedPointer gpa = gi0->portAssignments_["enable_out"]; + QCOMPARE( gpa->wire->name, QString("enableAdHoc") ); + QCOMPARE( gpa->bounds.first, QString("5") ); + QCOMPARE( gpa->bounds.second, QString("3") ); gpa = gi1->portAssignments_["enable_in"]; QCOMPARE( gpa->wire->name, QString("enableAdHoc") );