diff --git a/README.md b/README.md index 5311b324cce9a6fc436f6981327faa0ab863da90..6e293a4b70bc862bac822a4c15e70dea12abc760 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,12 @@ wire a; reg b; reg c; 另外要注意:当端口的数据长度定义为i(正整数)时,相应的在上述 **第二段、第三段** 代码中要有所改变,在端口名前加[i-1:0] 例如:![输入图片说明](https://images.gitee.com/uploads/images/2021/0123/234717_374091e7_8607408.png "QQ截图20210123234621.png")用户定义了p0为3位 ![输入图片说明](https://images.gitee.com/uploads/images/2021/0123/234922_d18c6d0d_8607408.png "QQ截图20210123234626.png") ![输入图片说明](https://images.gitee.com/uploads/images/2021/0123/234930_6490091b_8607408.png "QQ截图20210123234630.png") -则p0前面加[2:0] +则p0前面加[2:0] +### ------------003------------ +应有“保存模块”和“生成代码”两个按钮。其中: +保存模块:做到将此次用户新建的模块里的所有内容打包保存 下次用户双击时可以直接在软件里打开 +生成代码:将软件生成的代码 让用户选择位置保存。保存为 **verilog目录** 目录下应有 **此模块及其内部子模块** 所有的verilog代码文件 **扩展名为.v** + diff --git a/eda/.keep b/src/.keep similarity index 100% rename from eda/.keep rename to src/.keep diff --git a/eda/eda_qt/eda_qt.pro b/src/eda_qt/eda_qt.pro similarity index 88% rename from eda/eda_qt/eda_qt.pro rename to src/eda_qt/eda_qt.pro index e1a204664ae1c58d111f4e2766ce0883a3669a21..11f8211f1c651ec01085122cbbcbec084e8250c7 100644 --- a/eda/eda_qt/eda_qt.pro +++ b/src/eda_qt/eda_qt.pro @@ -18,11 +18,15 @@ DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ main.cpp \ mainwindow.cpp \ - new_file.cpp + module.cpp \ + new_file.cpp \ + port.cpp HEADERS += \ mainwindow.h \ - new_file.h + module.h \ + new_file.h \ + port.h FORMS += \ mainwindow.ui \ diff --git a/eda/eda_qt/eda_qt.pro.user b/src/eda_qt/eda_qt.pro.user similarity index 33% rename from eda/eda_qt/eda_qt.pro.user rename to src/eda_qt/eda_qt.pro.user index 4d0e24b15fc2677119d3b2dd57fbecb63f24b3d8..3f8d8c859607cf76e1d57bb57eafed78651a595c 100644 --- a/eda/eda_qt/eda_qt.pro.user +++ b/src/eda_qt/eda_qt.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {f13ef12e-62a1-4aaf-ac39-302b77838bbe} + {c7d49916-8da1-4252-9fa0-c2c4861f43da} ProjectExplorer.Project.ActiveTarget @@ -55,14 +55,21 @@ ProjectExplorer.Project.PluginSettings + + true + true + true + true + + 0 + true -fno-delayed-template-parsing true - Builtin.Questionable true - Builtin.DefaultTidyAndClazy + Builtin.TidyAndClazy 2 @@ -73,260 +80,6 @@ ProjectExplorer.Project.Target.0 - - Desktop Qt 5.14.2 MinGW 32-bit - Desktop Qt 5.14.2 MinGW 32-bit - qt.qt5.5142.win32_mingw73_kit - 0 - 0 - 0 - - true - 0 - C:\Users\dawn\Documents\Project\build-eda_qt-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - C:\Users\dawn\Documents\Project\build-eda_qt-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - - false - - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - 2 - 2 - - - true - 2 - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_32_bit-Release - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - - false - - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - 2 - - - true - 0 - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - - false - - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/dawn/Documents/Project/eda_qt/eda_qt.pro - C:/Users/dawn/Documents/Project/eda_qt/eda_qt.pro - - false - - false - true - true - false - false - true - - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_32_bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 Desktop Qt 5.14.2 MinGW 64-bit Desktop Qt 5.14.2 MinGW 64-bit @@ -335,17 +88,16 @@ 0 0 - true - 0 - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Debug - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Debug + C:/Users/Dell/Desktop/eda_qt/eda/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Debug true QtProjectManager.QMakeBuildStep + true false - + false + false true @@ -382,21 +134,18 @@ Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - 2 - 2 - true - 2 - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Release - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Release + C:/Users/Dell/Desktop/eda_qt/eda/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Release true QtProjectManager.QMakeBuildStep + false false - + false + true true @@ -433,21 +182,18 @@ Release Qt4ProjectManager.Qt4BuildConfiguration 0 - 0 - 2 - true - 0 - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Profile - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Profile + C:/Users/Dell/Desktop/eda_qt/eda/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Profile true QtProjectManager.QMakeBuildStep + true false - + true + true true @@ -484,8 +230,6 @@ Profile Qt4ProjectManager.Qt4BuildConfiguration 0 - 0 - 0 3 @@ -496,8 +240,6 @@ ProjectExplorer.BuildSteps.Deploy 1 - - false ProjectExplorer.DefaultDeployConfiguration 1 @@ -562,280 +304,27 @@ 2 - - ProjectExplorer.CustomExecutableRunConfiguration - - - false - - false - true - false - false - true - - - - 1 - - - - ProjectExplorer.Project.Target.2 - - Desktop Qt 5.9.9 MinGW 32bit - Desktop Qt 5.9.9 MinGW 32bit - qt.qt5.599.win32_mingw53_kit - 0 - 0 - 0 - - true - 0 - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_9_9_MinGW_32bit-Debug - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_9_9_MinGW_32bit-Debug - - - true - QtProjectManager.QMakeBuildStep - - false - - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - 2 - 2 - - - true - 2 - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_9_9_MinGW_32bit-Release - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_9_9_MinGW_32bit-Release - - - true - QtProjectManager.QMakeBuildStep - - false - - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 2 - 2 - - - true - 0 - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_9_9_MinGW_32bit-Profile - C:/Users/dawn/Documents/Project/build-eda_qt-Desktop_Qt_5_9_9_MinGW_32bit-Profile - - - true - QtProjectManager.QMakeBuildStep - - false - - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 2 - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - - ProjectExplorer.CustomExecutableRunConfiguration - + eda_qt2 + Qt4ProjectManager.Qt4RunConfiguration:F:/Leoric/新建文件夹 (2)/eda_qt/eda/eda_qt/eda_qt.pro + F:/Leoric/新建文件夹 (2)/eda_qt/eda/eda_qt/eda_qt.pro false false true + true false false true - + C:/Users/Dell/Desktop/eda_qt/eda/build-eda_qt-Desktop_Qt_5_14_2_MinGW_64_bit-Debug 1 ProjectExplorer.Project.TargetCount - 3 + 1 ProjectExplorer.Project.Updater.FileVersion diff --git a/eda/eda_qt/main.cpp b/src/eda_qt/main.cpp similarity index 100% rename from eda/eda_qt/main.cpp rename to src/eda_qt/main.cpp diff --git a/eda/eda_qt/mainwindow.cpp b/src/eda_qt/mainwindow.cpp similarity index 100% rename from eda/eda_qt/mainwindow.cpp rename to src/eda_qt/mainwindow.cpp diff --git a/eda/eda_qt/mainwindow.h b/src/eda_qt/mainwindow.h similarity index 100% rename from eda/eda_qt/mainwindow.h rename to src/eda_qt/mainwindow.h diff --git a/eda/eda_qt/mainwindow.ui b/src/eda_qt/mainwindow.ui similarity index 88% rename from eda/eda_qt/mainwindow.ui rename to src/eda_qt/mainwindow.ui index b3db99894c8961190603274771bc8f31272184d2..6c166d43f3851b08e916170fe19103a894aaf666 100644 --- a/eda/eda_qt/mainwindow.ui +++ b/src/eda_qt/mainwindow.ui @@ -24,9 +24,6 @@ - - - @@ -39,7 +36,7 @@ 0 0 1056 - 25 + 23 diff --git a/src/eda_qt/module.cpp b/src/eda_qt/module.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5ea69e2bf50cf50832bea969452888631930a5e5 --- /dev/null +++ b/src/eda_qt/module.cpp @@ -0,0 +1,40 @@ +#include "module.h" +#include + +Module::Module() +{ + +} + +Module::Module(std::string name,int inputPorts,int outputPorts,int inOutPorts) +{ + this->name = name; + int portsNum = 0; + for(int i = 0;iports.push_back(Port("p"+std::to_string(portsNum),INPUT,0,1)); + } + for(int i = 0;iports.push_back(Port("p"+std::to_string(portsNum),OUTPUT,0,1)); + } + for(int i = 0;iports.push_back(Port("p"+std::to_string(portsNum),INOUT,0,1)); + } +} + +void Module::setCode(std::string code) +{ + this->code = code; +} + +std::string Module::getCode() +{ + return this->code; +} + +std::string Module::generateCode() +{ + +} diff --git a/src/eda_qt/module.h b/src/eda_qt/module.h new file mode 100644 index 0000000000000000000000000000000000000000..804962c32af8c06705d330163d9837656f9acd39 --- /dev/null +++ b/src/eda_qt/module.h @@ -0,0 +1,23 @@ +#ifndef MODULE_H +#define MODULE_H +#include +#include +#include "port.h" +class Module +{ +private: + std::string name; + int inputPorts; + int ouputPorts; + int inOutPorts; + std::string code; + std::vector ports; +public: + Module(); + Module(std::string,int,int,int); + void setCode(std::string); + std::string getCode(); + std::string generateCode(); +}; + +#endif // MODULE_H diff --git a/eda/eda_qt/new_file.cpp b/src/eda_qt/new_file.cpp similarity index 100% rename from eda/eda_qt/new_file.cpp rename to src/eda_qt/new_file.cpp diff --git a/eda/eda_qt/new_file.h b/src/eda_qt/new_file.h similarity index 100% rename from eda/eda_qt/new_file.h rename to src/eda_qt/new_file.h diff --git a/eda/eda_qt/new_file.ui b/src/eda_qt/new_file.ui similarity index 100% rename from eda/eda_qt/new_file.ui rename to src/eda_qt/new_file.ui diff --git a/src/eda_qt/port.cpp b/src/eda_qt/port.cpp new file mode 100644 index 0000000000000000000000000000000000000000..077830f65684e03a803808f82d0f513caf0729fb --- /dev/null +++ b/src/eda_qt/port.cpp @@ -0,0 +1,51 @@ +#include "port.h" + +Port::Port() +{ + +} + +Port::Port(std::string name,PortType portType,bool dataType,int dataSize) +{ + this->name = name; + this->portType = portType; + this->dataSize =dataSize; + this->dataType = dataType; +} + +void Port::setName(std::string name) +{ + this->name = name; +} + +std::string Port::getName() +{ + return this->name; +} + +void Port::setPortType(PortType portType) +{ + this->portType = portType; +} +PortType Port::getPortType() +{ + return this->portType; +} + +void Port::setDataType(bool dataType) +{ + this->dataType = dataType; +} +bool Port::getDataType() +{ + return this->dataType; +} + +void Port::setDataSize(int dataSize) +{ + this->dataSize = dataSize; +} +int Port::getDataSize() +{ + return this->dataSize; +} diff --git a/src/eda_qt/port.h b/src/eda_qt/port.h new file mode 100644 index 0000000000000000000000000000000000000000..813d0ec05b49df6180b9cb7d1dfbe42c317891f6 --- /dev/null +++ b/src/eda_qt/port.h @@ -0,0 +1,28 @@ +#ifndef PORT_H +#define PORT_H +#include + +enum PortType{INPUT,OUTPUT,INOUT}; + +class Port +{ +private: + std::string name; //端口名 + PortType portType; //输入或输出 0为in 1为out + bool dataType; //数据类型 0为wire 1为reg + int dataSize; //数据长度 +public: + Port(); + Port(std::string,PortType,bool,int); + void setName(std::string); + std::string getName(); + void setPortType(PortType); + PortType getPortType(); + void setDataType(bool); + bool getDataType(); + void setDataSize(int); + int getDataSize(); + +}; + +#endif // PORT_H