Skip to content

Commit

Permalink
Merge branch 'master' into feature/toggle_nets
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed Nov 17, 2023
2 parents ebe1a77 + 1776c0d commit 3af13db
Show file tree
Hide file tree
Showing 17 changed files with 1,299 additions and 2,496 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,40 @@ All notable changes to this project will be documented in this file.

## [Unreleased]
* miscellaneous
* added GUI PluginParameter type 'ComboBox' for parameters that can be requested from plugin
* added GUI PluginParameter types 'Module' and 'Gated' for parameters that can be requested from plugin
* added GUI PluginParameter type `ComboBox` for parameters that can be requested from plugin
* added GUI PluginParameter types `Module` and `Gated` for parameters that can be requested from plugin
* added `Show content` button to `Groupings` widget to show content of grouping as a list
* added flag which python editor tab is active when serializing project
* added `GateType::delete_pin_group` and `GateType::assign_pin_to_group` to enable more operations on pin groups of gate pins
* added extended gate library picker when importing a netlist
* added keyboard shortcut for delete-item action from toolbar
* added parameter `force_name` to enforce pin (group) renaming to `Module::set_pin_name`, `Module::set_pin_group_name`, `Module::create_pin`, and `Module::create_pin_group`
* changed supported input file formats for import from hard coded list to list provided by loadable parser plugins
* changed behavior of import netlist dialog, suggest only non-existing directory names and loop until an acceptable name was entered
* changed appearance and behavior of import project dialog, make sure existing hal projects don't get overwritten
* changed installation script policy to install Python packages (omit 'pip install' which would need virtual environment)
* bugfixes
* fixed colors in Python Console when switching between color schemes
* fixed pybind of `Module::get_gates`
* fixed Python script execution abort button disappearing when switching tabs
* fixed Python interpreter crash due to release of GIL semaphore before cleanup is done
* fixed segfault when deleting a module for which an exclusive view exists
* fixed not loading all plugins if the GUI is not in control
* fixed Verilog writer not being a dependency of Verilator plugin
* fixed order of pins within pin groups not being properly handled for modules and gate types
* fixed netlist parsers assigning gate pins in wrong order (compensated by the bug above, imported netlists were still correct)
* fixed wrong order of pins within pin groups in provided gate libraries
* fixed format string handling of enums in log outputs
* fixed restoring user assigned module colors from project file
* fixed no scrollbar shown in `Data` tab of `Selection Details` widget
* fixed problems in GUI plugin management caused by addressing plugins by absolute path
* fixed several bugs related to moving node boxes in GUI by drag'n'drop

* refactored layouter module
* switched to multithreaded algorithm
* boosted performance by using classes with faster memory access
* removed layouter code used prior to version 3.1.0 - thus removing the setting option to use that code
* added setting option to dump junction layout input data for experts to debug in case of layout errors

## [4.2.0](v4.2.0) - 2023-05-24 10:02:04-07:00 (urgency: medium)
* GUI plugin manager
Expand Down
7 changes: 3 additions & 4 deletions install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ elif [[ "$platform" == 'linux' ]]; then
libqt5svg5-dev libqt5svg5* ninja-build lcov gcovr python3-sphinx \
doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \
pybind11-dev python3-pybind11 rapidjson-dev libspdlog-dev libz3-dev z3 \
libreadline-dev apport \
libreadline-dev apport python3-dateutil \
$additional_deps \
graphviz libomp-dev libsuitesparse-dev # For documentation
sudo pip3 install -r requirements.txt
elif [[ "$distribution" == "Arch" ]]; then
yay -S --needed base-devel lsb-release git verilator cmake boost-libs pkgconf \
qt5-base python ccache autoconf libsodium qt5-svg ninja lcov \
Expand All @@ -97,7 +96,7 @@ elif [[ "$platform" == 'docker' ]]; then
libpython3-dev ccache autoconf autotools-dev libsodium-dev \
libqt5svg5-dev libqt5svg5* ninja-build lcov gcovr python3-sphinx \
doxygen python3-sphinx-rtd-theme python3-jedi python3-pip \
pybind11-dev python3-pybind11 rapidjson-dev libspdlog-dev libz3-dev libreadline-dev \
pybind11-dev python3-pybind11 python3-dateutil rapidjson-dev \
libspdlog-dev libz3-dev libreadline-dev \
graphviz libomp-dev libsuitesparse-dev # For documentation
pip3 install -r requirements.txt
fi
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ namespace hal
u32 mMaxContextId;
void dump(const QString& title, u32 mid, u32 xid) const;
SettingsItemCheckbox* mSettingDebugGrid;
SettingsItemCheckbox* mSettingNetLayout;
SettingsItemCheckbox* mSettingDumpJunction;
SettingsItemCheckbox* mSettingParseLayout;
SettingsItemCheckbox* mSettingLayoutBoxes;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace hal {
* @param n - The underlying net
* @param l - The lines this GraphicsNet consists of
*/
StandardArrowNet(Net* n, const Lines& l);
StandardArrowNet(Net* n, const Lines& l, const QList<QPointF>& knots = QList<QPointF>());
/**
* Adds an input position.
*
Expand All @@ -67,7 +67,7 @@ namespace hal {
*
* @param v - The visuals to set.
*/
virtual void setVisuals(const Visuals& v);
virtual void setVisuals(const Visuals& v) override;

/**
* Overwritten qt function to draw the net.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ namespace hal
*/
void appendVLine(const qreal x, const qreal mSmallY, const qreal mBigY);

/**
* Merges all horizontal and vertical lines so that overlapping lines are replaced by only a single line.
*/
void mergeLines();

/**
* Gets the total amount of lines (includes horizontal AND vertical lines).
*
Expand Down Expand Up @@ -129,7 +124,7 @@ namespace hal
* @param n - The undelying net of the StandardGraphicsNet
* @param l - The lines this GraphicsNet consists of
*/
StandardGraphicsNet(Net* n, const Lines& l);
StandardGraphicsNet(Net* n, const Lines& l, const QList<QPointF>& knots = QList<QPointF>());

/**
* Draws the StandardGraphicsNet in the scene.
Expand Down
160 changes: 57 additions & 103 deletions plugins/gui/include/gui/graph_widget/layouters/graph_layouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <QRect>
#include <QSet>
#include <QVector>
#include <QThread>

namespace hal
{
Expand All @@ -59,6 +60,8 @@ namespace hal
class NetLayoutJunctionEntries;
class CommentSpeechBubble;
class CommentEntry;
class JunctionThread;
class DrawNetThread;

/**
* @ingroup graph-layouter
Expand All @@ -75,6 +78,8 @@ namespace hal
{
Q_OBJECT

friend class DrawNetThread;

class SceneCoordinate
{
int minLane;
Expand Down Expand Up @@ -115,6 +120,16 @@ namespace hal
float xBoxOffset() const;
};

class SceneCoordinateArray
{
float* mArray;
int mFirstIndex;
public:
SceneCoordinateArray(const QMap<int,SceneCoordinate>& inputMap);
~SceneCoordinateArray();
float lanePosition(int igrid, int ilane) const;
};

class EndpointCoordinate
{
float mYoffset;
Expand Down Expand Up @@ -203,48 +218,10 @@ namespace hal
unsigned int mLanes = 0;
};

struct Junction
{
Junction(const int x_coordinate, const int y_coordinate)
: x(x_coordinate), y(y_coordinate), mHLanes(0), mVLanes(0), mCloseLeftLaneChanges(0), mCloseRightLaneChanges(0), mCloseTopLaneChanges(0), mCloseBottomLaneChanges(0),
mFarLeftLaneChanges(0), mFarRightLaneChanges(0), mFarTopLaneChanges(0), mFarBottomLaneChanges(0)
{
}

int x;
int y;

unsigned int mHLanes = 0;
unsigned int mVLanes = 0;

unsigned int mCloseLeftLaneChanges = 0;
unsigned int mCloseRightLaneChanges = 0;
unsigned int mCloseTopLaneChanges = 0;
unsigned int mCloseBottomLaneChanges = 0;

unsigned int mFarLeftLaneChanges = 0;
unsigned int mFarRightLaneChanges = 0;
unsigned int mFarTopLaneChanges = 0;
unsigned int mFarBottomLaneChanges = 0;
};

struct UsedPaths
{
QSet<Road*> mHRoads;
QSet<Road*> mVRoads;

QSet<Junction*> mHJunctions;
QSet<Junction*> mVJunctions;

QSet<Junction*> mCloseLeftJunctions;
QSet<Junction*> mCloseRightJunctions;
QSet<Junction*> mCloseTopJunctions;
QSet<Junction*> mCloseBottomJunctions;

QSet<Junction*> mFarLeftJunctions;
QSet<Junction*> mFarRightJunctions;
QSet<Junction*> mFarTopJunctions;
QSet<Junction*> mFarBottomJunctions;
};

public:
Expand Down Expand Up @@ -309,8 +286,8 @@ namespace hal

bool done() const;

bool optimizeNetLayoutEnabled();
void setOptimizeNetLayoutEnabled(bool enbabled);
bool dumpJunctionEnabled();
void setDumpJunctionEnabled(bool enabled);

QVector<qreal> xValues() const;
QVector<qreal> yValues() const;
Expand Down Expand Up @@ -340,27 +317,22 @@ namespace hal
QMap<QPoint, Node> mPositionToNodeMap;
QMap<Node, QPoint> mNodeToPositionRollback;

private Q_SLOTS:
void handleDrawNetThreadFinished();
void handleJunctionThreadFinished();

private:
void clearLayoutData();
void clearComments();
void createBoxes();
void calculateNets();
void getWireHash();
void findMaxBoxDimensions();
void alternateMaxChannelLanes();
void findMaxChannelLanes();
void calculateMaxChannelDimensions();
void calculateJunctionMinDistance();
void alternateGateOffsets();
void calculateGateOffsets();
void alternatePlaceGates();
void placeGates();
void resetRoadsAndJunctions();
void drawNets();
void alternateDrawNets();
void drawComments();
void drawNetsJunction(StandardGraphicsNet::Lines& lines, u32 id);
void drawNetsEndpoint(StandardGraphicsNet::Lines& lines, u32 id);
void drawNetsIsolated(u32 id, Net* n, const EndpointList& epl);
void updateSceneRect();
static bool verifyModulePort(Net* n, const Node& modNode, bool isModInput);
Expand All @@ -375,72 +347,19 @@ namespace hal
bool vRoadJumpPossible(const int x1, const int x2, const int y) const;
bool vRoadJumpPossible(const Road* const r1, const Road* const r2) const;

Road* getHRoad(const int x, const int y);
Road* getVRoad(const int x, const int y);
Junction* getJunction(const int x, const int y);

qreal hRoadHeight(const unsigned int mLanes) const;
qreal vRoadWidth(const unsigned int mLanes) const;

qreal sceneYForHChannelLane(const int y, const unsigned int lane) const;
qreal sceneXForVChannelLane(const int x, const unsigned int lane) const;

qreal sceneXForCloseLeftLaneChange(const int channel_x, unsigned int lane_change) const;
qreal sceneXForFarLeftLaneChange(const int channel_x, unsigned int lane_change) const;

qreal sceneXForCloseRightLaneChange(const int channel_x, unsigned int lane_change) const;
qreal sceneXForFarRightLaneChange(const int channel_x, unsigned int lane_change) const;

qreal sceneYForCloseTopLaneChange(const int channel_y, unsigned int lane_change) const;
qreal sceneYForFarTopLaneChange(const int channel_y, unsigned int lane_change) const;

qreal sceneYForCloseBottomLaneChange(const int channel_y, unsigned int lane_change) const;
qreal sceneYForFarBottomLaneChange(const int channel_y, unsigned int lane_change) const;

qreal sceneXForCloseLeftLaneChange(const Junction* const j) const;
qreal sceneXForFarLeftLaneChange(const Junction* const j) const;

qreal sceneXForCloseRightLaneChange(const Junction* const j) const;
qreal sceneXForFarRightLaneChange(const Junction* const j) const;

qreal sceneYForCloseTopLaneChange(const Junction* const j) const;
qreal sceneYForFarTopLaneChange(const Junction* const j) const;

qreal sceneYForCloseBottomLaneChange(const Junction* const j) const;
qreal sceneYForFarBottomLaneChange(const Junction* const j) const;

void commitUsedPaths(const UsedPaths& used);
static bool isConstNet(const Net* n);

NodeBoxes mBoxes;

QHash<QPoint, Road*> mHRoads;
QHash<QPoint, Road*> mVRoads;
QHash<QPoint, Junction*> mJunctions;

QMap<int, qreal> mMaxNodeWidthForX;
QMap<int, qreal> mMaxNodeHeightForY;

QMap<int, unsigned int> mMaxVChannelLanesForX;
QMap<int, unsigned int> mMaxHChannelLanesForY;

QMap<int, qreal> mMaxVChannelLeftSpacingForX;
QMap<int, qreal> mMaxVChannelRightSpacingForX;
QMap<int, qreal> mMaxHChannelTopSpacingForY;
QMap<int, qreal> mMaxHChannelBottomSpacingForY;

QMap<int, qreal> mMaxVChannelWidthForX;
QMap<int, qreal> mMaxHChannelHeightForY;

QMap<int, qreal> mNodeOffsetForX;
QMap<int, qreal> mNodeOffsetForY;

QMap<int, qreal> mMaxLeftJunctionSpacingForX;
QMap<int, qreal> mMaxRightJunctionSpacingForX;

QMap<int, qreal> mMaxTopJunctionSpacingForY;
QMap<int, qreal> mMaxBottomJunctionSpacingForY;

QMap<int, qreal> mMaxLeftIoPaddingForChannelX;
QMap<int, qreal> mMaxRightIoPaddingForChannelX;

Expand Down Expand Up @@ -477,7 +396,42 @@ namespace hal
QHash<u32, int> mGlobalInputHash;
QHash<u32, int> mGlobalOutputHash;

bool mOptimizeNetLayout;
bool mDumpJunctions;
QList<CommentSpeechBubble*> mCommentBubbles;
QSet<u32> mNetsToDraw;
QSet<u32>::const_iterator mNetIterator;
QList<DrawNetThread*> mDrawNetThreads;
QList<JunctionThread*> mJunctionThreads;
QHash<u32, QHash<NetLayoutWire, int>> mLaneMap;

SceneCoordinateArray* mCoordArrayX;
SceneCoordinateArray* mCoordArrayY;
};

class DrawNetThread : public QThread
{
Q_OBJECT
u32 mId;
GraphLayouter* mLayouter;
void drawJunction();
void drawEndpoint();
public:
StandardGraphicsNet::Lines mLines;
QList<QPointF> mKnots;
DrawNetThread(u32 id, GraphLayouter* parent) : QThread(parent), mId(id), mLayouter(parent) {;}
u32 id() const { return mId; }
void run() override;
};

class JunctionThread : public QThread
{
Q_OBJECT
public:
NetLayoutPoint mNetLayoutPoint;
NetLayoutJunctionEntries mEntries;
NetLayoutJunction* mJunction;
JunctionThread(const NetLayoutPoint& nlp, const NetLayoutJunctionEntries& entr)
: mNetLayoutPoint(nlp), mEntries(entr), mJunction(nullptr) {;}
void run() override;
};
} // namespace hal
Loading

0 comments on commit 3af13db

Please sign in to comment.