hwcomponents-library 0.1__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.
- hwcomponents_library-0.1/PKG-INFO +52 -0
- hwcomponents_library-0.1/README.md +39 -0
- hwcomponents_library-0.1/hwcomponents_library/__init__.py +12 -0
- hwcomponents_library-0.1/hwcomponents_library/base.py +12 -0
- hwcomponents_library-0.1/hwcomponents_library/library/__init__.py +0 -0
- hwcomponents_library-0.1/hwcomponents_library/library/aladdin.py +409 -0
- hwcomponents_library-0.1/hwcomponents_library/library/atomlayer.py +204 -0
- hwcomponents_library-0.1/hwcomponents_library/library/brahms.py +85 -0
- hwcomponents_library-0.1/hwcomponents_library/library/dummy.py +172 -0
- hwcomponents_library-0.1/hwcomponents_library/library/forms.py +80 -0
- hwcomponents_library-0.1/hwcomponents_library/library/isaac.py +602 -0
- hwcomponents_library-0.1/hwcomponents_library/library/jia.py +232 -0
- hwcomponents_library-0.1/hwcomponents_library/library/misc.py +199 -0
- hwcomponents_library-0.1/hwcomponents_library/library/newton.py +127 -0
- hwcomponents_library-0.1/hwcomponents_library/library/raella.py +89 -0
- hwcomponents_library-0.1/hwcomponents_library/library/timely.py +437 -0
- hwcomponents_library-0.1/hwcomponents_library/library/wan.py +288 -0
- hwcomponents_library-0.1/hwcomponents_library.egg-info/PKG-INFO +52 -0
- hwcomponents_library-0.1/hwcomponents_library.egg-info/SOURCES.txt +21 -0
- hwcomponents_library-0.1/hwcomponents_library.egg-info/dependency_links.txt +1 -0
- hwcomponents_library-0.1/hwcomponents_library.egg-info/top_level.txt +1 -0
- hwcomponents_library-0.1/pyproject.toml +24 -0
- hwcomponents_library-0.1/setup.cfg +4 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hwcomponents_library
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: A library of hardware components for energy estimation.
|
|
5
|
+
Author-email: Tanner Andrulis <Andrulis@Mit.edu>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: hardware,components,energy,estimation
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# HWComponents-Library
|
|
15
|
+
HWComponents-Library contains a library of components from published works. It is
|
|
16
|
+
intended to be used to rapidly model prior works and to provide a common set of
|
|
17
|
+
components for comparison.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
Clone the repository and install with pip:
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/Accelergy-Project/hwcomponents-library.git
|
|
23
|
+
cd hwcomponents-library
|
|
24
|
+
pip3 install .
|
|
25
|
+
|
|
26
|
+
# Check that the installation is successful
|
|
27
|
+
hwc --list | grep adder
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Contributing: Adding or Updating Numbers from Your Work
|
|
31
|
+
We would be happy to update these models given a pull request. Please see
|
|
32
|
+
"Creating Library Entries" and format your entries to match the existing
|
|
33
|
+
entries. If you have any questions, we would be happy to help.
|
|
34
|
+
|
|
35
|
+
Note that we will only accept entries that are published or backed by public
|
|
36
|
+
data. Citations are required for all entries.
|
|
37
|
+
|
|
38
|
+
## Citation
|
|
39
|
+
|
|
40
|
+
If you use this library in your work, please cite the following:
|
|
41
|
+
|
|
42
|
+
```bibtex
|
|
43
|
+
@misc{andrulis2024modelinganalogdigitalconverterenergyarea,
|
|
44
|
+
title={Modeling Analog-Digital-Converter Energy and Area for Compute-In-Memory Accelerator Design},
|
|
45
|
+
author={Tanner Andrulis and Ruicong Chen and Hae-Seung Lee and Joel S. Emer and Vivienne Sze},
|
|
46
|
+
year={2024},
|
|
47
|
+
eprint={2404.06553},
|
|
48
|
+
archivePrefix={arXiv},
|
|
49
|
+
primaryClass={cs.AR},
|
|
50
|
+
url={https://arxiv.org/abs/2404.06553},
|
|
51
|
+
}
|
|
52
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# HWComponents-Library
|
|
2
|
+
HWComponents-Library contains a library of components from published works. It is
|
|
3
|
+
intended to be used to rapidly model prior works and to provide a common set of
|
|
4
|
+
components for comparison.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
Clone the repository and install with pip:
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/Accelergy-Project/hwcomponents-library.git
|
|
10
|
+
cd hwcomponents-library
|
|
11
|
+
pip3 install .
|
|
12
|
+
|
|
13
|
+
# Check that the installation is successful
|
|
14
|
+
hwc --list | grep adder
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Contributing: Adding or Updating Numbers from Your Work
|
|
18
|
+
We would be happy to update these models given a pull request. Please see
|
|
19
|
+
"Creating Library Entries" and format your entries to match the existing
|
|
20
|
+
entries. If you have any questions, we would be happy to help.
|
|
21
|
+
|
|
22
|
+
Note that we will only accept entries that are published or backed by public
|
|
23
|
+
data. Citations are required for all entries.
|
|
24
|
+
|
|
25
|
+
## Citation
|
|
26
|
+
|
|
27
|
+
If you use this library in your work, please cite the following:
|
|
28
|
+
|
|
29
|
+
```bibtex
|
|
30
|
+
@misc{andrulis2024modelinganalogdigitalconverterenergyarea,
|
|
31
|
+
title={Modeling Analog-Digital-Converter Energy and Area for Compute-In-Memory Accelerator Design},
|
|
32
|
+
author={Tanner Andrulis and Ruicong Chen and Hae-Seung Lee and Joel S. Emer and Vivienne Sze},
|
|
33
|
+
year={2024},
|
|
34
|
+
eprint={2404.06553},
|
|
35
|
+
archivePrefix={arXiv},
|
|
36
|
+
primaryClass={cs.AR},
|
|
37
|
+
url={https://arxiv.org/abs/2404.06553},
|
|
38
|
+
}
|
|
39
|
+
```
|
|
@@ -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,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()
|