Skip to content

Commit

Permalink
Merge pull request #595 from emsec/feature/GateLibraryManager
Browse files Browse the repository at this point in the history
Feature/gate library manager
  • Loading branch information
joern274 authored Oct 29, 2024
2 parents 909b4c4 + 1d13f84 commit 3ad0a0e
Show file tree
Hide file tree
Showing 105 changed files with 9,328 additions and 1,266 deletions.
2 changes: 1 addition & 1 deletion examples/fsm/.project.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"serialization_format_version":10,"netlist":"fsm.hal","gate_library":"example_library.hgl","serializer":{"modulecolor":"modulecolor.json","pythoneditor":"pythoneditor.json","comments":"comments.json","groupingcolor":"groupingcolor.json","groupings":"groupings.json","views":"views.json"}}
{"serialization_format_version":10,"netlist":"fsm.hal","gate_library":"example_library.hgl","serializer":{"groupings":"groupings.json","modulecolor":"modulecolor.json","comments":"comments.json","pythoneditor":"pythoneditor.json","groupingcolor":"groupingcolor.json","views":"views.json"}}
2 changes: 1 addition & 1 deletion examples/fsm/fsm.hal

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/fsm/modulecolor.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"modcolors":[{"color":"#ff606e70","id":1}]}
{"modcolors":[{"color":"#ff606e70","id":1},{"color":"#ff30f2b1","id":2},{"color":"#ff30f249","id":3},{"color":"#fff23051","id":4},{"color":"#ff3089f2","id":5},{"color":"#ffea30f2","id":7},{"color":"#ff30f2b1","id":8},{"color":"#ff9af230","id":9}]}
2 changes: 2 additions & 0 deletions examples/fsm/py/.unnamed_tab0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for n in internal_nets:
print(n.get_id())
2 changes: 1 addition & 1 deletion examples/fsm/pythoneditor.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"python_dir":"py","tabs":[{"tab":0,"filename":".unnamed_tab0.py"}]}
{"python_dir":"py","tabs":[{"tab":0,"active":1,"filename":".unnamed_tab0.py"}]}
2 changes: 1 addition & 1 deletion examples/fsm/views.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"views":[{"exclusiveModuleId":1,"gates":[],"id":1,"modules":[{"id":1,"x":0,"y":0}],"name":"top_module (ID: 1)","nets":[{"id":10},{"id":8},{"id":9},{"id":6},{"id":7},{"id":4},{"id":5},{"id":3}],"timestamp":"Mon Mar 6 14:55:57 2023","visible":2}]}
{"views":[{"exclusiveModuleId":0,"gates":[{"id":6,"x":0,"y":4},{"id":15,"x":0,"y":3}],"id":1,"modules":[],"name":"top_module modified","nets":[{"id":26},{"id":27},{"id":24},{"id":25},{"id":28},{"id":29}],"timestamp":"Mo. März 6 14:55:57 2023","visible":0},{"exclusiveModuleId":0,"gates":[],"id":5,"modules":[{"id":8,"x":1,"y":1}],"name":"Submodule modified","nets":[{"id":6},{"id":5},{"id":26},{"id":8},{"id":27},{"id":25},{"id":28},{"id":29}],"timestamp":"Mi. Jan. 31 09:35:38 2024","visible":0},{"exclusiveModuleId":0,"gates":[{"id":4,"x":1,"y":2},{"id":5,"x":0,"y":1},{"id":9,"x":1,"y":-2},{"id":15,"x":2,"y":-2},{"id":13,"x":1,"y":0},{"id":2,"x":0,"y":0}],"id":6,"modules":[{"id":5,"x":1,"y":1},{"id":2,"x":0,"y":-2}],"name":"PythonModule modified","nets":[{"id":6},{"id":22},{"id":23},{"id":20},{"id":5},{"id":36},{"id":37},{"id":26},{"id":27},{"id":8},{"id":25},{"id":31},{"id":28},{"id":29},{"id":3},{"id":19}],"timestamp":"Mi. Jan. 31 12:29:34 2024","visible":2},{"exclusiveModuleId":0,"gates":[{"id":17,"x":0,"y":0},{"id":20,"x":1,"y":0},{"id":18,"x":0,"y":1}],"id":7,"modules":[{"id":7,"x":1,"y":1},{"id":5,"x":2,"y":0},{"id":3,"x":2,"y":1}],"name":"Isolated View 1","nets":[{"id":32},{"id":6},{"id":33},{"id":20},{"id":5},{"id":36},{"id":37},{"id":26},{"id":27},{"id":8},{"id":9},{"id":25},{"id":28},{"id":29},{"id":3},{"id":19}],"timestamp":"Mi. Jan. 31 12:52:44 2024","visible":0}]}
10 changes: 10 additions & 0 deletions include/hal_core/netlist/gate_library/gate_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ namespace hal
*/
void set_path(const std::filesystem::path& modified_path);

/**
* Hack to alter the name if gate library gets modified and written to a new location.
* Use this function only if you know exactly what you are doing
*
* @param[in] modified_name - The new name.
*/
void set_name(const std::string& modified_name);

/**
* Set the data category of the gate location information.
*
Expand Down Expand Up @@ -202,6 +210,8 @@ namespace hal
*/
std::vector<std::string> get_includes() const;

void remove_gate_type(const std::string& name);

private:
std::string m_name;
std::filesystem::path m_path;
Expand Down
1 change: 1 addition & 0 deletions include/hal_core/netlist/gate_library/gate_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace hal
{
class GateLibrary;


/**
* A gate type contains information about its internals such as input and output pins as well as its Boolean functions.
*
Expand Down
31 changes: 24 additions & 7 deletions include/hal_core/plugin_system/gui_extension_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@ namespace hal

class GuiExtensionInterface : public AbstractExtensionInterface
{
bool mContributionEnabled;
std::string mContributionTopLabel;
public:
GuiExtensionInterface()
{
;
}
GuiExtensionInterface(const std::string& toplabel = std::string()) : mContributionEnabled(true), mContributionTopLabel(toplabel)
{;}

virtual ~GuiExtensionInterface()
{
;
}
{;}

/**
* Get list of configurable parameter
Expand Down Expand Up @@ -115,5 +114,23 @@ namespace hal
* @param[in] nl - The netlist.
*/
virtual void netlist_about_to_close(Netlist* nl);

/**
* Check whether context menu contributions are enabled for this plugin
* @return True if enabled, false otherwise
*/
bool is_contribution_enabled() const { return mContributionEnabled; }

/**
* Set flag whether context menu contributions are enabled for this plugin
* @param[in] enabled - New value for context menu contribution flag
*/
void set_contribution_enabled(bool enabled) { mContributionEnabled = enabled; }

/**
* Get top label for context menu contributions. If empty the plugin name will show as top label.
* @return The label or empty if no label different from plugin name was provided for constructor.
*/
std::string contribution_top_label() const { return mContributionTopLabel; }
};
} // namespace hal
1 change: 1 addition & 0 deletions plugins/gate_libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if(PL_GATE_LIBRARIES OR BUILD_ALL_PLUGINS)
# Add the include directory to the include search path
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/hal/gate_libraries/)
file(GLOB GATE_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/definitions/*)
set_property(GLOBAL PROPERTY GATE_LIBS_DEFINITIONS "${CMAKE_CURRENT_SOURCE_DIR}/definitions")
message(STATUS "GATE_LIBS: ${GATE_LIBS}")
foreach(file ${GATE_LIBS})
get_filename_component(f ${file} NAME)
Expand Down
Loading

0 comments on commit 3ad0a0e

Please sign in to comment.