hwcomponents-library 1.1.0.dev21__py3-none-any.whl

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.
@@ -0,0 +1,12 @@
1
+ from hwcomponents_library.library.aladdin import *
2
+ from hwcomponents_library.library.atomlayer import *
3
+ from hwcomponents_library.library.brahms import *
4
+ from hwcomponents_library.library.dummy import *
5
+ from hwcomponents_library.library.forms import *
6
+ from hwcomponents_library.library.isaac import *
7
+ from hwcomponents_library.library.jia import *
8
+ from hwcomponents_library.library.misc import *
9
+ from hwcomponents_library.library.newton import *
10
+ from hwcomponents_library.library.raella import *
11
+ from hwcomponents_library.library.timely import *
12
+ from hwcomponents_library.library.wan import *
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '1.1.0.dev21'
32
+ __version_tuple__ = version_tuple = (1, 1, 0, 'dev21')
33
+
34
+ __commit_id__ = commit_id = None
@@ -0,0 +1,43 @@
1
+ """
2
+ Custom version scheme for setuptools-scm that creates post-release versions
3
+ instead of dev versions, making them installable by default.
4
+ """
5
+ from setuptools_scm.version import guess_next_version
6
+
7
+
8
+ def post_release_version_scheme(version):
9
+ """
10
+ Custom version scheme that creates post-release versions.
11
+ Instead of 1.1.0.dev17, creates 1.1.0.post17
12
+ Post-release versions are installable by default (not pre-releases).
13
+ """
14
+ if version.exact:
15
+ # Exact tag match - return the tag version (strip 'v' prefix if present)
16
+ tag = version.format_with("{tag}")
17
+ return tag.lstrip('v')
18
+
19
+ # Get the base version from the tag (or fallback)
20
+ if version.tag:
21
+ # Strip 'v' prefix if present
22
+ base_version = str(version.tag).lstrip('v')
23
+ else:
24
+ # No tag - use fallback or guess
25
+ base_version = guess_next_version(version) or "1.0.0"
26
+
27
+ # Get the distance from the last tag
28
+ distance = version.distance or 0
29
+
30
+ if distance == 0:
31
+ # No commits after tag - return base version
32
+ return base_version
33
+
34
+ # Return as post-release version
35
+ return f"{base_version}.post{distance}"
36
+
37
+
38
+ def post_release_local_scheme(version):
39
+ """
40
+ Local scheme that returns empty string (no local version identifier).
41
+ PyPI doesn't allow local versions, so we skip them.
42
+ """
43
+ return ""
@@ -0,0 +1,12 @@
1
+ from hwcomponents import EnergyAreaModel, actionDynamicEnergy
2
+ from hwcomponents.scaling import *
3
+
4
+
5
+ class LibraryEstimatorClassBase(EnergyAreaModel):
6
+ @actionDynamicEnergy
7
+ def write(self) -> float:
8
+ return 0
9
+
10
+ @actionDynamicEnergy
11
+ def read(self) -> float:
12
+ return 0
File without changes
@@ -0,0 +1,409 @@
1
+ """
2
+ @INPROCEEDINGS{6853196,
3
+ author={Shao, Yakun Sophia and Reagen, Brandon and Wei, Gu-Yeon and Brooks, David},
4
+ booktitle={2014 ACM/IEEE 41st International Symposium on Computer Architecture (ISCA)},
5
+ title={Aladdin: A pre-RTL, power-performance accelerator simulator enabling large design space exploration of customized architectures},
6
+ year={2014},
7
+ volume={},
8
+ number={},
9
+ pages={97-108},
10
+ doi={10.1109/ISCA.2014.6853196}}
11
+ """
12
+
13
+ from hwcomponents_library.base import LibraryEstimatorClassBase
14
+ from hwcomponents.scaling import *
15
+ from hwcomponents import actionDynamicEnergy
16
+
17
+
18
+ # Original CSV contents:
19
+ # tech_node,global_cycle_period,width|datawidth,energy,area,action
20
+ # 40nm,1e-9,32,0.21,2.78E+02,add|read
21
+ # 40nm,1e-9,32,0.0024,2.78E+02,leak
22
+ # 40nm,1e-9,32,0,2.78E+02,update|write
23
+ class AladdinAdder(LibraryEstimatorClassBase):
24
+ """
25
+ An adder from the Aladdin paper. Adds two values.
26
+
27
+ Parameters
28
+ ----------
29
+ tech_node : str
30
+ The technology node in meters.
31
+ width : int, optional
32
+ The width of the adder in bits. This is the number of bits of the input values.
33
+
34
+ Attributes
35
+ ----------
36
+ tech_node : str
37
+ The technology node in meters.
38
+ width : int
39
+ The width of the adder in bits. This is the number of bits of the input values.
40
+ """
41
+
42
+ component_name = ["adder", "intadder", "aladdin_adder"]
43
+ priority = 0.9
44
+
45
+ def __init__(self, tech_node: float, width: int = 32):
46
+ super().__init__(leak_power=2.40e-6, area=278.0e-12)
47
+ self.tech_node: float = self.scale(
48
+ "tech_node",
49
+ tech_node,
50
+ 40e-9,
51
+ tech_node_energy,
52
+ tech_node_area,
53
+ tech_node_leak,
54
+ )
55
+ self.width: int = self.scale("width", width, 32, linear, linear, linear)
56
+
57
+ @actionDynamicEnergy
58
+ def add(self) -> float:
59
+ """
60
+ Returns the energy for one addition operation in Joules.
61
+
62
+ Returns
63
+ -------
64
+ float
65
+ The energy for one addition operation in Joules.
66
+ """
67
+ return 0.21e-12
68
+
69
+ @actionDynamicEnergy
70
+ def read(self) -> float:
71
+ """
72
+ Returns the energy for one addition operation in Joules.
73
+
74
+ Returns
75
+ -------
76
+ float
77
+ The energy for one addition operation in Joules.
78
+ """
79
+ return 0.21e-12
80
+
81
+
82
+ # Original CSV contents:
83
+ # tech_node,global_cycle_period,width|datawidth,dynamic energy(pJ),area(um^2),action
84
+ # 40nm,1e-9,1,0.009,5.98E+00,read
85
+ # 40nm,1e-9,1,0,5.98E+00,write
86
+ # 40nm,1e-9,1,0,5.98E+00,leak|update
87
+ class AladdinRegister(LibraryEstimatorClassBase):
88
+ """
89
+ A register from the Aladdin paper. Stores a value.
90
+
91
+ Parameters
92
+ ----------
93
+ tech_node : str
94
+ The technology node in meters.
95
+ width : int, optional
96
+ The width of the register in bits.
97
+ """
98
+ component_name = ["register", "aladdin_register"]
99
+ priority = 0.9
100
+
101
+ def __init__(
102
+ self,
103
+ tech_node: float,
104
+ width: int = 1,
105
+ dynamic_energy: int = 1,
106
+ area: int = 5.98e00,
107
+ ):
108
+ super().__init__(leak_power=0.0, area=5.98e-12)
109
+ self.tech_node: float = self.scale(
110
+ "tech_node",
111
+ tech_node,
112
+ 40e-9,
113
+ tech_node_energy,
114
+ tech_node_area,
115
+ tech_node_leak,
116
+ )
117
+ self.width: int = self.scale("width", width, 1, linear, linear, linear)
118
+ self.dynamic_energy: int = self.scale(
119
+ "dynamic_energy", dynamic_energy, 1, linear, linear, linear
120
+ )
121
+
122
+ @actionDynamicEnergy(bits_per_action="width")
123
+ def read(self) -> float:
124
+ """
125
+ Returns the energy for one read operation in Joules.
126
+
127
+ Parameters
128
+ ----------
129
+ bits_per_action : int
130
+ The number of bits that are read.
131
+
132
+ Returns
133
+ -------
134
+ float
135
+ The energy for one read operation in Joules.
136
+ """
137
+ return 0.009e-12
138
+
139
+ @actionDynamicEnergy(bits_per_action="width")
140
+ def write(self) -> float:
141
+ """
142
+ Returns the energy for one write operation in Joules.
143
+
144
+ Parameters
145
+ ----------
146
+ bits_per_action : int
147
+ The number of bits that are written.
148
+
149
+ Returns
150
+ -------
151
+ float
152
+ The energy for one write operation in Joules.
153
+ """
154
+ return 0.009e-12
155
+
156
+
157
+ # Original CSV contents:
158
+ # tech_node,global_cycle_period,width|datawidth,energy(pJ),area(um^2),action
159
+ # 40nm,1e-9,32,0.02947,71,compare|read
160
+ # 40nm,1e-9,32,2.51E-05,71,leak
161
+ # 40nm,1e-9,32,0,71,update|write
162
+ class AladdinComparator(LibraryEstimatorClassBase):
163
+ """
164
+ A comparator from the Aladdin paper. Tells whether one value is greater than
165
+ another.
166
+
167
+ Parameters
168
+ ----------
169
+ tech_node : str
170
+ The technology node in meters.
171
+ width : int, optional
172
+ The width of the comparator in bits.
173
+ """
174
+ component_name = ["comparator", "aladdin_comparator"]
175
+ priority = 0.9
176
+
177
+ def __init__(self, tech_node: float, width: int = 32):
178
+ super().__init__(leak_power=2.51e-8, area=71.0e-12)
179
+ self.tech_node: float = self.scale(
180
+ "tech_node",
181
+ tech_node,
182
+ 40e-9,
183
+ tech_node_energy,
184
+ tech_node_area,
185
+ tech_node_leak,
186
+ )
187
+ self.width: int = self.scale("width", width, 32, linear, linear, linear)
188
+
189
+ @actionDynamicEnergy
190
+ def compare(self) -> float:
191
+ """
192
+ Returns the energy for one comparison operation in Joules.
193
+
194
+ Returns
195
+ -------
196
+ float
197
+ The energy for one comparison operation in Joules.
198
+ """
199
+ return 0.02947e-12
200
+
201
+ @actionDynamicEnergy
202
+ def read(self) -> float:
203
+ """
204
+ Returns the energy for one comparison operation in Joules.
205
+
206
+ Returns
207
+ -------
208
+ float
209
+ The energy for one comparison operation in Joules.
210
+ """
211
+ return 0.02947e-12
212
+
213
+
214
+ # Original CSV contents:
215
+ # tech_node,global_cycle_period,width|datawidth,width_a|datawidth_a,width_b|datawidth_b,energy(pJ),area(um^2),action
216
+ # 40nm,1e-9,32,32,32,12.68,6350,multiply|read
217
+ # 40nm,1e-9,32,32,32,0.08,6350,leak
218
+ # 40nm,1e-9,32,32,32,0,6350,update|write
219
+ class AladdinMultiplier(LibraryEstimatorClassBase):
220
+ """
221
+ A integer multiplier from the Aladdin paper. Multiplies two values.
222
+
223
+ Parameters
224
+ ----------
225
+ tech_node : str
226
+ The technology node in meters.
227
+ width : int, optional
228
+ The width of the multiplier in bits. Can not be set if width_a and width_b are
229
+ set.
230
+ width_a : int, optional
231
+ The width of the first input value in bits.
232
+ width_b : int, optional
233
+ The width of the second input value in bits.
234
+ """
235
+ component_name = ["intmultiplier", "multiplier", "aladdin_multiplier"]
236
+ priority = 0.9
237
+
238
+ def __init__(
239
+ self,
240
+ tech_node: float,
241
+ width: int = 32,
242
+ width_a: int = 32,
243
+ width_b: int = 32,
244
+ energy: int = 12.68,
245
+ area: int = 6350,
246
+ ):
247
+ super().__init__(leak_power=8.00e-5, area=6350.0e-12)
248
+ self.tech_node: float = self.scale(
249
+ "tech_node",
250
+ tech_node,
251
+ 40e-9,
252
+ tech_node_energy,
253
+ tech_node_area,
254
+ tech_node_leak,
255
+ )
256
+ if width_a != 32 and width != 32:
257
+ raise ValueError(
258
+ "width and width_a cannot both be set. Either set width of both inputs "
259
+ "or width_a and width_b separately."
260
+ )
261
+ if width != 32 and width_b != 32:
262
+ raise ValueError(
263
+ "width and width_b cannot both be set. Either set width of both inputs "
264
+ "or width_a and width_b separately."
265
+ )
266
+ self.width: int = self.scale("width", width, 32, quadratic, quadratic, quadratic)
267
+ self.width_a: int = self.scale("width_a", width_a, 32, linear, linear, linear)
268
+ self.width_b: int = self.scale("width_b", width_b, 32, linear, linear, linear)
269
+
270
+ @actionDynamicEnergy
271
+ def multiply(self) -> float:
272
+ """
273
+ Returns the energy for one multiplication operation in Joules.
274
+
275
+ Returns
276
+ -------
277
+ float
278
+ The energy for one multiplication operation in Joules.
279
+ """
280
+ return 12.68e-12
281
+
282
+ @actionDynamicEnergy
283
+ def read(self) -> float:
284
+ """
285
+ Returns the energy for one read operation in Joules.
286
+
287
+ Returns
288
+ -------
289
+ float
290
+ The energy for one read operation in Joules.
291
+ """
292
+ return 12.68e-12
293
+
294
+
295
+ # Original CSV contents:
296
+ # tech_node,global_cycle_period,width|datawidth,energy(pJ),area(um^2),action
297
+ # 40nm,1e-9,32,0.25074,495.5,count|read
298
+ # 40nm,1e-9,32,0.0003213,495.5,leak
299
+ # 40nm,1e-9,32,0,495.5,update|write
300
+ class AladdinCounter(LibraryEstimatorClassBase):
301
+ """
302
+ A counter from the Aladdin paper. Increments a stored value.
303
+
304
+ Parameters
305
+ ----------
306
+ tech_node : str
307
+ The technology node in meters.
308
+ width : int, optional
309
+ The width of the counter in bits.
310
+ """
311
+ component_name = ["counter", "aladdin_counter"]
312
+ priority = 0.9
313
+
314
+ def __init__(self, tech_node: float, width: int = 32):
315
+ super().__init__(leak_power=3.21e-7, area=495.5e-12)
316
+ self.tech_node: float = self.scale(
317
+ "tech_node",
318
+ tech_node,
319
+ 40e-9,
320
+ tech_node_energy,
321
+ tech_node_area,
322
+ tech_node_leak,
323
+ )
324
+ self.width: int = self.scale("width", width, 32, linear, linear, linear)
325
+
326
+ @actionDynamicEnergy
327
+ def count(self) -> float:
328
+ """
329
+ Returns the energy for one increment operation in Joules.
330
+
331
+ Returns
332
+ -------
333
+ float
334
+ The energy for one increment operation in Joules.
335
+ """
336
+ return 0.25074e-12
337
+
338
+ @actionDynamicEnergy
339
+ def read(self) -> float:
340
+ """
341
+ Returns the energy for one increment operation in Joules.
342
+
343
+ Returns
344
+ -------
345
+ float
346
+ The energy for one increment operation in Joules.
347
+ """
348
+ return 0.25074e-12
349
+
350
+ class AladdinIntMAC(LibraryEstimatorClassBase):
351
+ """
352
+ A integer multiply-accumulate unit from the Aladdin paper. Multiplies two values
353
+ and adds the result to a stored value.
354
+
355
+ Parameters
356
+ ----------
357
+ tech_node : str
358
+ The technology node in meters.
359
+ adder_width : int, optional
360
+ The width of the adder in bits.
361
+ multiplier_width : int, optional
362
+ The width of the multiplier in bits.
363
+ """
364
+ component_name = ["intmac", "aladdin_intmac"]
365
+ priority = 0.9
366
+
367
+ def __init__(self, tech_node: float, adder_width: int = 16, multiplier_width: int = 8):
368
+ self.adder = AladdinAdder(tech_node, adder_width)
369
+ self.multiplier = AladdinMultiplier(tech_node, multiplier_width)
370
+ super().__init__(
371
+ area=self.adder.area + self.multiplier.area,
372
+ leak_power=self.adder.leak_power + self.multiplier.leak_power,
373
+ )
374
+
375
+ @actionDynamicEnergy
376
+ def mac(self) -> float:
377
+ """
378
+ Returns the energy for one multiply-accumulate operation in Joules.
379
+
380
+ Returns
381
+ -------
382
+ float
383
+ The energy for one multiply-accumulate operation in Joules.
384
+ """
385
+ return self.adder.add() + self.multiplier.multiply()
386
+
387
+ @actionDynamicEnergy
388
+ def read(self) -> float:
389
+ """
390
+ Returns the energy for one multiply-accumulate operation in Joules.
391
+
392
+ Returns
393
+ -------
394
+ float
395
+ The energy for one multiply-accumulate operation in Joules.
396
+ """
397
+ return self.mac()
398
+
399
+ @actionDynamicEnergy
400
+ def compute(self) -> float:
401
+ """
402
+ Returns the energy for one multiply-accumulate operation in Joules.
403
+
404
+ Returns
405
+ -------
406
+ float
407
+ The energy for one multiply-accumulate operation in Joules.
408
+ """
409
+ return self.mac()