|
| 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