Skip to content

Commit 0ab3a33

Browse files
Power data config file development - part 1 (#141)
* power config class and python package dependency * update device xml parser class to store device.xml full file path * add power_data element in device.xml * add power config json file for mpw1 device * remove hardcoded coeffs in code and retrieve from json power cfg file via powercfg api * remove hardcoded static power coeffs for IO, Aux IO and gearbox IO and moved the coeffs to json file * change to lf * remove hardcoded io coeff and move the values into power config file * improve power config class exception handling * power config class and python package dependency * update device xml parser class to store device.xml full file path * add power_data element in device.xml * add power config json file for mpw1 device * remove hardcoded coeffs in code and retrieve from json power cfg file via powercfg api * remove hardcoded static power coeffs for IO, Aux IO and gearbox IO and moved the coeffs to json file * change to lf * remove hardcoded io coeff and move the values into power config file * improve power config class exception handling * fix test_io unit test errors * fix test_peripherals unit test error * fix device_resources class unit test error * add power_config class unit tests * fix pytest warning --------- Co-authored-by: Ravikiran Chollangi <[email protected]>
1 parent ff6c21d commit 0ab3a33

26 files changed

+1639
-254
lines changed

backend/api/device.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class DeviceStaticSchema(Schema):
7474
class DeviceComplexSchema(Schema):
7575
dynamic = fields.Nested(DeviceDynamicSchema)
7676
static = fields.Nested(DeviceStaticSchema)
77-
total_power = fields.Number(default=0.0)
78-
total_percentage = fields.Number(default=0.0)
77+
total_power = fields.Number()
78+
total_percentage = fields.Number()
7979

8080
class DeviceConsumptionSchema(Schema):
8181
total_power_temperature = fields.Nested(DeviceTotalPowerTemperatureSchema, many=True)

backend/device/device_resource.py

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Device:
2727
pin_count: str
2828
speedgrade: str
2929
core_voltage: str
30+
filepath: str
3031
resources: Dict[str, ResourceAttributes]
3132
internals: Dict[str, InternalAttributes]
3233

backend/device/device_xml_parser.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def parse_device_xml(file_path: str) -> DeviceList:
1818

1919
device = Device(
2020
**device_elem.attrib,
21+
filepath=file_path,
2122
resources=resources,
2223
internals=internals
2324
)

backend/etc/device.xml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<internal type="sim_settings" file="devices/mpw1/fixed_sim_openfpga.xml"/>
2525
<internal type="repack_settings" file="devices/mpw1/repack_design_constraint.xml"/>
2626
<internal type="pinmap_xml" file="devices/mpw1/pinmap_qlf_k6n10_tsmc22.xml"/>
27+
<internal type="power_data" file="devices/mpw1/power_data.json"/>
2728
<internal type="pinmap_csv" file=""/>
2829
<internal type="plugin_lib" name="synth-rs"/>
2930
<internal type="plugin_func" name="synth_rs"/>

backend/etc/devices/mpw1/bram.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "bram",
3+
"coeffs": [
4+
{ "name": "BRAM_INT_CAP" , "value": 0.00000035 },
5+
{ "name": "BRAM_WRITE_CAP", "value": 0.000002 },
6+
{ "name": "BRAM_READ_CAP" , "value": 0.0000025 },
7+
{ "name": "BRAM_FIFO_CAP" , "value": 0.0000007 }
8+
]
9+
}
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "clocking",
3+
"coeffs": [
4+
{ "name": "CLK_CAP" , "value": 0.00001 },
5+
{ "name": "CLK_INT_CAP", "value": 0.00000003 },
6+
{ "name": "PLL_INT" , "value": 0.0009 },
7+
{ "name": "PLL_AUX" , "value": 0.01 }
8+
]
9+
}

backend/etc/devices/mpw1/dsp.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"type": "dsp",
3+
"coeffs": [
4+
{ "name": "DSP_MULT_CAP" , "value": 0.0000015 },
5+
{ "name": "DSP_MULT_CAP2", "value": 0.00000007 },
6+
{ "name": "DSP_INT_CAP" , "value": 0.0000001 }
7+
]
8+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"type": "fabric_le",
3+
"coeffs": [
4+
{ "name": "LUT_CAP" , "value": 0.0000003 },
5+
{ "name": "FF_CAP" , "value": 0.00000035 },
6+
{ "name": "FF_CLK_CAP" , "value": 2.91375291375291E-09 },
7+
{ "name": "LUT_INT_CAP", "value": 0.00000002 },
8+
{ "name": "FF_INT_CAP" , "value": 0.00000004 }
9+
]
10+
}

backend/etc/devices/mpw1/io.json

+349
Large diffs are not rendered by default.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"static": {
3+
"$ref": "static_power_data.json"
4+
},
5+
"components": [
6+
{ "$ref": "clocking.json" },
7+
{ "$ref": "dsp.json" },
8+
{ "$ref": "fabric_le.json" },
9+
{ "$ref": "bram.json" },
10+
{ "$ref": "io.json" }
11+
]
12+
}

0 commit comments

Comments
 (0)