pyipcore 0.4.30__tar.gz → 0.4.32__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {pyipcore-0.4.30 → pyipcore-0.4.32}/PKG-INFO +2 -1
  2. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ipc_utils.py +1 -1
  3. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/splash.py +1 -1
  4. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ui_main/tablexp_page/__init__.py +6 -3
  5. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore.egg-info/PKG-INFO +2 -1
  6. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore.egg-info/SOURCES.txt +1 -3
  7. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore.egg-info/requires.txt +1 -0
  8. {pyipcore-0.4.30 → pyipcore-0.4.32}/setup.py +2 -1
  9. pyipcore-0.4.30/pyipcore/ui_tblexport/__init__.py +0 -0
  10. pyipcore-0.4.30/pyipcore/ui_tblexport/_tools.py +0 -186
  11. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/__init__.py +0 -0
  12. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/icon_rc.py +0 -0
  13. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ip_module_view.py +0 -0
  14. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ipcdir.py +0 -0
  15. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ipcore.py +0 -0
  16. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ipcrc.py +0 -0
  17. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/main.py +0 -0
  18. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/test.py +0 -0
  19. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/test2.py +0 -0
  20. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/tfi.py +0 -0
  21. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ui_main/__init__.py +0 -0
  22. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ui_main/creator_page/__init__.py +0 -0
  23. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ui_main/creator_page/ipc_creator.py +0 -0
  24. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ui_main/tablexp_page/_tools.py +0 -0
  25. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ui_main/ui_main.py +0 -0
  26. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ui_main/ui_style.py +0 -0
  27. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/ui_utils.py +0 -0
  28. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore/utils.py +0 -0
  29. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore.egg-info/dependency_links.txt +0 -0
  30. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore.egg-info/entry_points.txt +0 -0
  31. {pyipcore-0.4.30 → pyipcore-0.4.32}/pyipcore.egg-info/top_level.txt +0 -0
  32. {pyipcore-0.4.30 → pyipcore-0.4.32}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyipcore
3
- Version: 0.4.30
3
+ Version: 0.4.32
4
4
  Summary: (PyQt5 based) Create "Ipcore" from verilog(Need iverilog). Provide "Param Value" and "Port Control" function. This kind of IpCore is not safe, only for convenience
5
5
  Author-email: 2229066748@qq.com
6
6
  Maintainer: Eagle'sBaby
@@ -19,4 +19,5 @@ Requires-Dist: pyverilog==1.3.0
19
19
  Requires-Dist: rbpop>=0.1.4
20
20
  Requires-Dist: files3>=0.9.1
21
21
  Requires-Dist: chardet
22
+ Requires-Dist: pandas
22
23
  Requires-Dist: qwork>=0.0.4
@@ -12,7 +12,7 @@ from PyQt5.QtWidgets import QMessageBox
12
12
  from reft import *
13
13
  from reft.ft import FTMatched
14
14
 
15
- VERSION = "0.4.30"
15
+ VERSION = "0.4.32"
16
16
  GITEE_URL = "https://gitee.com/eagle-s_baby/pyipcore"
17
17
  APP_NAME = "Py IP-Core Wizard"
18
18
 
@@ -145,7 +145,7 @@ class SplashTask(QWidget):
145
145
  # 绘制圆角矩形
146
146
  painter = QPainter(self)
147
147
  painter.setRenderHint(QPainter.Antialiasing)
148
- painter.setPen(QPen(LT_DOGERBLUE.darker(), 5, Qt.SolidLine))
148
+ painter.setPen(QPen(LT_DODGERBLUE.darker(), 5, Qt.SolidLine))
149
149
  painter.setBrush(LT_YELLOW.lighter().lighter())
150
150
 
151
151
  rect = QRectF(0, 0, self.width(), self.height())
@@ -6,9 +6,11 @@ from pyipcore.ui_main.tablexp_page._tools import *
6
6
 
7
7
 
8
8
  class QExcelExampleShower(QWidget):
9
- def __init__(self, fixed_width, fixed_height, parent=None, width:int=4):
9
+ def __init__(self, parent=None, width:int=4):
10
10
  super(QExcelExampleShower, self).__init__(parent)
11
- self.setFixedSize(fixed_width, fixed_height)
11
+ self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
12
+ self.setMinimumWidth(250)
13
+ self.setMinimumHeight(300)
12
14
  self._font = LBL_FONT_MINI
13
15
  self.bias:tuple[int, int] = (0, 0)
14
16
  self.target:tuple[int, int] = (1, 1)
@@ -227,6 +229,7 @@ class QExcelFileHeaderCollector(QWidget):
227
229
  self._on_value_changed()
228
230
 
229
231
  def initUI(self, bias:tuple[int, int]=(0, 1), target:tuple[int, int]=(6, 30), delta:tuple[int, int]=(0, 2)):
232
+ self.setMinimumHeight(750)
230
233
  self._layout = QVBoxLayout()
231
234
  self._layout.setContentsMargins(1, 1, 1, 1)
232
235
  self._layout.setSpacing(8)
@@ -261,7 +264,7 @@ class QExcelFileHeaderCollector(QWidget):
261
264
  v0.addWidget(self._cslbl)
262
265
  v0.addStretch(1)
263
266
  h2.addLayout(v0)
264
- self._shower = QExcelExampleShower(320, 480)
267
+ self._shower = QExcelExampleShower()
265
268
  h2.addWidget(self._shower)
266
269
  self._layout.addLayout(h2)
267
270
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyipcore
3
- Version: 0.4.30
3
+ Version: 0.4.32
4
4
  Summary: (PyQt5 based) Create "Ipcore" from verilog(Need iverilog). Provide "Param Value" and "Port Control" function. This kind of IpCore is not safe, only for convenience
5
5
  Author-email: 2229066748@qq.com
6
6
  Maintainer: Eagle'sBaby
@@ -19,4 +19,5 @@ Requires-Dist: pyverilog==1.3.0
19
19
  Requires-Dist: rbpop>=0.1.4
20
20
  Requires-Dist: files3>=0.9.1
21
21
  Requires-Dist: chardet
22
+ Requires-Dist: pandas
22
23
  Requires-Dist: qwork>=0.0.4
@@ -25,6 +25,4 @@ pyipcore/ui_main/ui_style.py
25
25
  pyipcore/ui_main/creator_page/__init__.py
26
26
  pyipcore/ui_main/creator_page/ipc_creator.py
27
27
  pyipcore/ui_main/tablexp_page/__init__.py
28
- pyipcore/ui_main/tablexp_page/_tools.py
29
- pyipcore/ui_tblexport/__init__.py
30
- pyipcore/ui_tblexport/_tools.py
28
+ pyipcore/ui_main/tablexp_page/_tools.py
@@ -7,4 +7,5 @@ pyverilog==1.3.0
7
7
  rbpop>=0.1.4
8
8
  files3>=0.9.1
9
9
  chardet
10
+ pandas
10
11
  qwork>=0.0.4
@@ -13,7 +13,7 @@ from setuptools.command.install import install
13
13
 
14
14
  setup(
15
15
  name='pyipcore',
16
- version='0.4.30',
16
+ version='0.4.32',
17
17
  description='(PyQt5 based) Create "Ipcore" from verilog(Need iverilog). Provide "Param Value" and "Port Control" function. This kind of IpCore is not safe, only for convenience',
18
18
  # long_description=long_description,
19
19
  author_email='2229066748@qq.com',
@@ -38,6 +38,7 @@ setup(
38
38
  "rbpop>=0.1.4",
39
39
  "files3>=0.9.1",
40
40
  "chardet",
41
+ "pandas",
41
42
  "qwork>=0.0.4",
42
43
  ],
43
44
  # CMD: ipc_ui -> cmd_ipc_ui
File without changes
@@ -1,186 +0,0 @@
1
- from pyipcore.ipc_utils import *
2
- from reft import FT, FTMatched
3
- import pandas as pd
4
-
5
-
6
- def DFtoDict(df: pd.DataFrame) -> list[dict]:
7
- """
8
- 将DataFrame转换为字典列表
9
- """
10
- res = df.to_dict(orient='records')
11
- # remove NaN to None
12
- for i in res:
13
- for k, v in i.items():
14
- if pd.isna(v):
15
- i[k] = None
16
- return res
17
-
18
- def DFLowerHeader(df: pd.DataFrame) -> pd.DataFrame:
19
- """
20
- 将DataFrame的表头转换为小写
21
- """
22
- df.columns = [col.lower() for col in df.columns]
23
- return df
24
-
25
- def MatrixArrayRead(
26
- tbl: pd.DataFrame, # 读取的excel时最好忽略header和index
27
- offset: tuple[int, int], # 忽略起始的若干列和行,即(offx, offy)
28
- target: tuple[int, int], # 目标‘矩阵’的宽和高
29
- delta: tuple[int, int], # 矩阵的间隔
30
- *,
31
- header: bool = True, # 描述target的第一行是否是表头 # 如果是表头,要检查每个表头是否一致
32
- index: bool = True # 描述target的第一列是否是索引
33
- ) -> pd.DataFrame: # 将所有target纵向拼接.
34
- # 切换为pd格式
35
- offset = (offset[1], offset[0])
36
- target = (target[1], target[0])
37
- delta = (delta[1], delta[0])
38
-
39
- _shape = tbl.shape
40
- # 计算shape可以容纳的矩阵数量
41
- _full_size = (target[0] + delta[0], target[1] + delta[1])
42
-
43
- # 计算可以提取的矩阵数量
44
- num_matrices_x = (_shape[1] + 1 - offset[1] + delta[1]) // _full_size[1]
45
- num_matrices_y = (_shape[0] + 1 - offset[0] + delta[0]) // _full_size[0]
46
-
47
- matrices, _m0 = [], None
48
-
49
- for y in range(num_matrices_y):
50
- for x in range(num_matrices_x):
51
- start_x = offset[1] + x * _full_size[1]
52
- start_y = offset[0] + y * _full_size[0]
53
- end_x = start_x + target[1]
54
- end_y = start_y + target[0]
55
-
56
- # 提取矩阵
57
- matrix:pd.DataFrame = tbl.iloc[start_y:end_y, start_x:end_x]
58
- tmp = str(matrix)
59
-
60
- #header & column
61
- if header:
62
- columns = matrix.iloc[0].tolist()
63
- matrix = matrix.iloc[1:]
64
- matrix.columns = columns
65
- if index:
66
- matrix = matrix.reset_index(drop=True)
67
- tmp = str(matrix)
68
-
69
- # 记录首个元素
70
- if not matrices:
71
- _m0 = set(matrix.columns.tolist())
72
-
73
- # 如果需要检查表头一致性
74
- if header and matrices:
75
- _this = set(matrix.columns.tolist())
76
- if _this != _m0:
77
- raise ValueError(f"MatrixArrayRead: 表头不一致: at x={x}, y={y}:\n{_this}\n{_m0}")
78
-
79
- # # 如果需要检查索引列
80
- # if index and x > 0:
81
- # if not pd.Series.equals(matrices[0].iloc[:, 0], matrix.iloc[:, 0]):
82
- # raise ValueError("索引列不一致")
83
-
84
- matrices.append(matrix)
85
-
86
- # 将所有矩阵纵向拼接
87
- result = pd.concat(matrices, axis=0)
88
- # 移除整行全为NaN的行
89
- result = result.dropna(how='all')
90
- return result
91
-
92
-
93
- def ReadExcelTables(file_path: str) -> dict[pd.DataFrame]:
94
- """
95
- 读取excel文件中的所有表格
96
- """
97
- xls = pd.ExcelFile(file_path)
98
- return {sheet: xls.parse(sheet, header=None, index_col=None) for sheet in xls.sheet_names}
99
-
100
- def tbl_export_read(file_path: str,
101
- offset: tuple[int, int], # 忽略起始的若干列和行,即(offx, offy)
102
- target: tuple[int, int], # 目标‘矩阵’的宽和高
103
- delta: tuple[int, int], # 矩阵的间隔
104
- *,
105
- header: bool = True, # 描述target的第一行是否是表头 # 如果是表头,要检查每个表头是否一致
106
- index: bool = True # 描述target的第一列是否是索引
107
- ) -> list[PhysicsIoDef]:
108
- """
109
- 读取一个excel文件中的表格,并转换为PhysicsIoDef列表
110
-
111
- """
112
- dfs = ReadExcelTables(file_path)
113
- result = []
114
- for tbl in dfs.values():
115
- _ = MatrixArrayRead(tbl, offset, target, delta, header=header, index=index)
116
- _ = DFLowerHeader(_)
117
- _ = DFtoDict(_)
118
- _ = PhysicsIoDef.FromTableDict(_)
119
- result.extend(_)
120
-
121
- return result
122
-
123
-
124
- def EvalCst(txt_tpl:str, piodefs:list[PhysicsIoDef]) -> str:
125
- def _inner(s, env:dict):
126
- try:
127
- _ = eval(str(s), env)
128
- except Exception as e:
129
- _env = {k: v for k, v in env.items() if not k.startswith("__")}
130
- raise ValueError(f"EvalCst: Failed to evaluate '{s}' \n\t:with env: {_env}. \n\t:Details: {e}")
131
- return str(_)
132
-
133
- txt = ""
134
- ft = FT()
135
- ft.login(lambda s: _inner(s, ft.env), "\$", "[^$]+", "\$", areas=[1])
136
- for pio in piodefs:
137
- envs = pio.todict(list=True)
138
- for env in envs:
139
- ft.env = env
140
- _ = ft.handle(txt_tpl)
141
- txt += _
142
- return txt
143
-
144
- def GenerateVerilogTopModule(pins_list:list[PhysicsIoDef]) -> str:
145
- module_name = "Top"
146
- header = f"module {module_name}(\n"
147
- ports = []
148
-
149
- for pio in pins_list:
150
- dct = pio.todict()
151
- if isinstance(dct, list):
152
- dct = dct[0]
153
-
154
- direction = dct.get('direct', 'input') # 默认为输入
155
- if direction == 'output':
156
- a= 0
157
- name = dct['name']
158
- if pio.width and pio.width > 1:
159
- port = f" {direction} wire {name}[{pio.width - 1}:0],\n"
160
- else:
161
- port = f" {direction} wire {name},\n"
162
- ports.append(port)
163
-
164
- # 移除最后一个逗号
165
- ports = ''.join(ports).rstrip(',\n')
166
- footer = "\n);\n\n// Your code here\n\n\nendmodule\n"
167
-
168
- verilog_code = header + ports + footer
169
- return verilog_code
170
-
171
-
172
-
173
- # 调用函数
174
- result = tbl_export_read("IO分配表.xlsx", (0, 1), (6, 30), (0, 2), header=True, index=False)
175
-
176
- tpl_txt = open(r"H:\FPGA_Learns\00 IPC\_ip_wizard\pyipcore gowin_cst.txt", 'r').read()
177
- # print(*result, sep='\n')
178
- # result = EvalCst(tpl_txt, result)
179
- # print(result)
180
- result = GenerateVerilogTopModule(result)
181
- print(result)
182
-
183
-
184
-
185
- if __name__ == '__main__':
186
- ...
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes