@@ -6,22 +6,21 @@ This document follows the ``2_making_models.ipynb`` tutorial.
66Basic Components
77----------------
88
9- Models can be created by subclassing the :py:class: `~hwcomponents.model.EnergyAreaModel `
9+ Models can be created by subclassing the :py:class: `~hwcomponents.model.ComponentModel `
1010class. Models estimate the energy, area, and leakage power of a component. Each model
1111requires the following:
1212
1313- ``component_name ``: The name of the component. This may also be a list of components if
1414 multiple aliases are used.
15- - ``priority_0_to_100 ``: The percent accuracy of the model. This is used to
16- break ties if multiple models support a given query.
15+ - ``priority ``: This is used to break ties if multiple models support a given query.
1716- A call to ``super().__init__(area, leak_power, subcomponents) ``. This is used to
1817 initialize the model and set the area and leakage power.
1918
20- Models can also have actions. Actions are functions that return an energy of a specific
21- action. For the TernaryMAC model, we have an action called `` mac `` that returns the
22- energy of a ternary MAC operation. The
23- :py:func: `~hwcomponents.model.actionDynamicEnergy ` decorator makes this function visible
24- as an action. The function should return an energy in Joules .
19+ Models can also have actions. Actions are functions that return a tuple of `` (energy,
20+ latency) `` for a specific action. For the TernaryMAC model, we have an action called
21+ `` mac `` that returns the energy and latency of a ternary MAC operation. The
22+ :py:func: `~hwcomponents.model.action ` decorator makes this function visible as an
23+ action. The function should return `` (energy_in_Joules, latency_in_seconds) `` .
2524
2625Models can also be scaled to support a range of different parameters. For example,
2726the TernaryMAC model can be scaled to support a range of different technology nodes.
@@ -35,9 +34,14 @@ model. The ``self.scale`` function takes the following arguments:
3534 scaling should be done.
3635- ``energy_scaling_function ``: The scaling function to use for dynamic energy. Use
3736 ``None `` if no scaling should be done.
37+ - ``latency_scaling_function ``: The scaling function to use for latency. Use ``None `` if
38+ no scaling should be done.
3839- ``leak_scaling_function ``: The scaling function to use for leakage power. Use ``None ``
3940 if no scaling should be done.
4041
42+ **Note: Area, Energy, Latency, and Leak Power are always in alphabetical order in the
43+ function arguments. **
44+
4145Many different scaling functions are defined and available in
4246:py:mod: `hwcomponents.scaling `.
4347
@@ -49,12 +53,12 @@ Scaling by Number of Bits
4953-------------------------
5054
5155Some actions may depend on the number of bits being accessesed. For example, you may
52- want to charge for the energy per bit of a DRAM read. To do this, you can use the
53- ``bits_per_action `` argument of the :py:func: `~hwcomponents.model.actionDynamicEnergy `
56+ want to charge for the energy and latency per bit of a DRAM read. To do this, you can
57+ use the ``bits_per_action `` argument of the :py:func: `~hwcomponents.model.action `
5458decorator. This decorator takes a string that is the name of the parameter to scale by.
55- For example, we can scale the energy of a DRAM read by the number of bits being read. In
56- this example, the DRAM yields ``width `` bits per read, so energy is scaled by
57- ``bits_per_action / width ``.
59+ For example, we can scale the energy and latency of a DRAM read by the number of bits
60+ being read. In this example, the DRAM yields ``width `` bits per read, so energy and
61+ latency are scaled by ``bits_per_action / width ``.
5862
5963.. include-notebook :: ../../notebooks/2_making_models.ipynb
6064 :name: scaling_by_number_of_bits
@@ -75,18 +79,24 @@ We'll use the following components:
7579- An adder that adds the increment value to the current address
7680
7781One new functionality is used here. The ``subcomponents `` argument to the
78- :py:class: `~hwcomponents.model.EnergyAreaModel ` constructor is used to register
82+ :py:class: `~hwcomponents.model.ComponentModel ` constructor is used to register
7983subcomponents.
8084
81- The area, energy, and leak power of subcomponents will NOT be scaled by the component's
82- `` energy_scale ``, ``area_scale ``, or ``leak_scale ``; if you want to scale the
83- subcomponents, multiply their `` energy_scale ``, ``area_scale ``, or `` leak_scale `` by the
84- desired scale factor.
85+ The area, energy, latency, and leak power of subcomponents will NOT be scaled by the
86+ component's `` area_scale ``, `` energy_scale ``, ``latency_scale ``, and ``leak_scale ``; if
87+ you want to scale the subcomponents, multiply the subcomponents' ``area_scale ``,
88+ `` energy_scale ``, `` latency_scale ``, and `` leak_scale `` by the desired scale factor.
8589
8690.. include-notebook :: ../../notebooks/2_making_models.ipynb
8791 :name: smartbuffer_sram
8892 :language: python
8993
94+ The latency of subcomponents is generally summed. However, if the subcomponents are
95+ pipelined for a given action, then the ``pipelined_subcomponents `` argument to the
96+ :py:func: `~hwcomponents.model.action ` decorator should be set to True. This will cause
97+ the latency of the action to be the max of the latency returned and all subcomponent
98+ latencies.
99+
90100Installing Models and Making them Globally Visible
91101--------------------------------------------------
92102
0 commit comments