Skip to content

Commit 0532e08

Browse files
committed
fix uts
1 parent ebb60c5 commit 0532e08

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/test_dsp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def test_compute_dynamic_power(enable, clock, VCC_CORE, DSP_MULT_CAP, DSP_MULT_C
6060

6161
def test_dsp_submodule_initialization():
6262
mock_resources = Mock()
63+
mock_resources.get_num_DSP_BLOCKs.return_value = 10
6364
dsps = [DSP(enable=True, name="DSP 1"), DSP(enable=False, name="DSP 2")]
6465
dsp_submodule = DSP_SubModule(mock_resources, dsps)
6566

@@ -79,6 +80,7 @@ def test_get_dsp_resources():
7980

8081
def test_add_and_get_dsp():
8182
mock_resources = Mock()
83+
mock_resources.get_num_DSP_BLOCKs.return_value = 10
8284
dsp_submodule = DSP_SubModule(mock_resources, [])
8385

8486
new_dsp_data = {
@@ -95,6 +97,7 @@ def test_add_and_get_dsp():
9597

9698
def test_dsp_submodule_compute_output_power():
9799
mock_resources = Mock()
100+
mock_resources.get_num_DSP_BLOCKs.return_value = 10
98101

99102
# Assume some coefficients are returned by the mock
100103
mock_resources.get_VCC_CORE.return_value = 1.2

tests/test_rs_device_resources.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import pytest
66
from unittest.mock import MagicMock, patch
7+
from device.device_resource import ResourceAttributes
78
from submodule.rs_power_config import ElementType
89
from submodule.rs_device_resources import (
910
RsDeviceResources,
@@ -23,6 +24,11 @@ def mock_device():
2324
device.package = 'TestPackage'
2425
device.speedgrade = 'Speed1'
2526
device.filepath = 'device.xml'
27+
device.resources = {
28+
"dsp": ResourceAttributes(type='dsp', num=176, label='DSP'),
29+
"bram": ResourceAttributes(type='bram', num=176, label='BRAM'),
30+
"lut": ResourceAttributes(type='lut', num=45408, label='LUTs')
31+
}
2632
return device
2733

2834
@pytest.fixture

0 commit comments

Comments
 (0)