Skip to content

Commit 0b01563

Browse files
committed
Fully updated to pyfixtures and added new testcase for paged address block RAL generation
1 parent 3d0233c commit 0b01563

15 files changed

Lines changed: 797 additions & 269 deletions

src/rtlpy/_uvm_templates/uvm_reg_block_paged.jinja

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
{# You should have received a copy of the GNU General Public License #}
1616
{# along with this program. If not, see <https://www.gnu.org/licenses/>. #}
1717
{##########################################################################}
18-
{% extends "uvm_reg_block.jinja" %}
19-
2018
/** {{block.name}} - UVM register model
2119
* Registers:
2220
{% for offset, reg in block.registers|dictsort %}

src/rtlpy/uvm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def addrblock_to_ral(ablock: _AddressBlockBase,
5353
elif isinstance(ablock, PagedAddressBlock):
5454
if ablock.page_reg is None:
5555
raise TypeError(f"addrblock_to_ral has ablock which is {type(ablock)}" +
56-
"has a page_reg which is not sent")
56+
"has a page_reg which is not set")
5757

5858
ral_str += reg_to_ral(ablock.page_reg, ablock.data_size) + "\n\n"
5959
template = env.get_template("uvm_reg_block_paged.jinja")

tests/_definitions/__init__.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/_definitions/design_test_definitions.py

Lines changed: 0 additions & 53 deletions
This file was deleted.

tests/conftest.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
##########################################################################
2+
# Python library to help with the automatic creation of RTL #
3+
# Copyright (C) 2024, RISCY-Lib Contributors #
4+
# #
5+
# This program is free software: you can redistribute it and/or modify #
6+
# it under the terms of the GNU General Public License as published by #
7+
# the Free Software Foundation, either version 3 of the License, or #
8+
# (at your option) any later version. #
9+
# #
10+
# This program is distributed in the hope that it will be useful, #
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
13+
# GNU General Public License for more details. #
14+
# #
15+
# You should have received a copy of the GNU General Public License #
16+
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
17+
##########################################################################
18+
19+
import pytest
20+
import json
21+
22+
23+
@pytest.fixture(scope="module")
24+
def minimum_field_definition():
25+
return {
26+
"name": "test_name"
27+
}
28+
29+
30+
@pytest.fixture(scope="module")
31+
def full_field_definition():
32+
return {
33+
"name": "abacadabra",
34+
"size": 4,
35+
"access": "WC",
36+
"volatile": True,
37+
"reset": 10,
38+
"randomizable": False,
39+
}
40+
41+
42+
@pytest.fixture(scope="module")
43+
def reserved_field_definition():
44+
return {
45+
"name": "part_id",
46+
"size": 8,
47+
"access": "RO",
48+
"reset": 0xFA,
49+
"randomizable": False,
50+
"reserved": True
51+
}
52+
53+
54+
@pytest.fixture(scope="module")
55+
def minimum_register_definition():
56+
return {
57+
"name": "test_reg"
58+
}
59+
60+
61+
@pytest.fixture(scope="module")
62+
def full_register_definition(minimum_field_definition, full_field_definition):
63+
return {
64+
"name": "full_reg",
65+
"coverage": "UVM_FULL_COVERAGE",
66+
"dimension": 4,
67+
"fields": [
68+
minimum_field_definition,
69+
full_field_definition
70+
]
71+
}
72+
73+
74+
@pytest.fixture(scope="module")
75+
def traffic_light_full_def():
76+
with open("tests/data/traffic_light.json", "r") as f:
77+
return json.load(f)
78+
79+
80+
@pytest.fixture(scope="module")
81+
def traffic_light_ral():
82+
with open("tests/data/traffic_light.svh", "r") as f:
83+
return f.read()
84+
85+
86+
@pytest.fixture(scope="module")
87+
def paged_block_ral():
88+
with open("tests/data/paged_block_ral.svh", "r") as f:
89+
return f.read()

0 commit comments

Comments
 (0)