From 3c8b5fe54ec19f997d92b68b9920c95debe8a67b Mon Sep 17 00:00:00 2001 From: lekcyjna123 <34948061+lekcyjna123@users.noreply.github.com> Date: Sun, 4 Feb 2024 17:11:48 +0100 Subject: [PATCH] Move `tests/common` to `transactron` (#569) --- test/cache/test_icache.py | 2 +- test/frontend/test_decode_stage.py | 2 +- test/frontend/test_fetch.py | 2 +- test/frontend/test_instr_decoder.py | 2 +- test/frontend/test_rvc.py | 2 +- test/fu/functional_common.py | 2 +- test/fu/test_fu_decoder.py | 2 +- test/fu/test_unsigned_mul_unit.py | 2 +- test/lsu/test_dummylsu.py | 2 +- test/lsu/test_pma.py | 2 +- test/peripherals/test_axi_lite.py | 2 +- test/peripherals/test_wishbone.py | 2 +- test/regression/pysim.py | 2 +- test/scheduler/test_rs_selection.py | 2 +- test/scheduler/test_scheduler.py | 2 +- test/scheduler/test_wakeup_select.py | 2 +- test/stages/test_backend.py | 2 +- test/stages/test_retirement.py | 2 +- test/structs_common/test_csr.py | 2 +- test/structs_common/test_exception.py | 2 +- test/structs_common/test_rat.py | 2 +- test/structs_common/test_reorder_buffer.py | 2 +- test/structs_common/test_rs.py | 2 +- test/test_core.py | 2 +- test/transactions/test_adapter.py | 2 +- test/transactions/test_branches.py | 2 +- test/transactions/test_methods.py | 2 +- test/transactions/test_simultaneous.py | 2 +- test/transactions/test_transaction_lib.py | 2 +- test/transactions/test_transactions.py | 2 +- test/{common/_test => transactron/testing}/__init__.py | 0 .../_test => transactron/testing}/test_infrastructure.py | 2 +- test/utils/test_fifo.py | 2 +- test/utils/test_onehotswitch.py | 2 +- test/utils/test_utils.py | 2 +- {test/common => transactron/testing}/__init__.py | 0 {test/common => transactron/testing}/functions.py | 0 {test => transactron/testing}/gtkw_extension.py | 0 {test/common => transactron/testing}/infrastructure.py | 2 +- {test/common => transactron/testing}/profiler.py | 0 {test/common => transactron/testing}/sugar.py | 0 {test/common => transactron/testing}/testbenchio.py | 0 42 files changed, 35 insertions(+), 35 deletions(-) rename test/{common/_test => transactron/testing}/__init__.py (100%) rename test/{common/_test => transactron/testing}/test_infrastructure.py (95%) rename {test/common => transactron/testing}/__init__.py (100%) rename {test/common => transactron/testing}/functions.py (100%) rename {test => transactron/testing}/gtkw_extension.py (100%) rename {test/common => transactron/testing}/infrastructure.py (99%) rename {test/common => transactron/testing}/profiler.py (100%) rename {test/common => transactron/testing}/sugar.py (100%) rename {test/common => transactron/testing}/testbenchio.py (100%) diff --git a/test/cache/test_icache.py b/test/cache/test_icache.py index 846bb3751..8ff52f092 100644 --- a/test/cache/test_icache.py +++ b/test/cache/test_icache.py @@ -14,7 +14,7 @@ from coreblocks.params.configurations import test_core_config from coreblocks.cache.refiller import SimpleCommonBusCacheRefiller -from ..common import TestCaseWithSimulator, TestbenchIO, def_method_mock, RecordIntDictRet +from transactron.testing import TestCaseWithSimulator, TestbenchIO, def_method_mock, RecordIntDictRet from ..peripherals.test_wishbone import WishboneInterfaceWrapper diff --git a/test/frontend/test_decode_stage.py b/test/frontend/test_decode_stage.py index 1638d9e83..c9c80251a 100644 --- a/test/frontend/test_decode_stage.py +++ b/test/frontend/test_decode_stage.py @@ -1,6 +1,6 @@ from transactron.lib import AdapterTrans, FIFO -from ..common import TestCaseWithSimulator, TestbenchIO, SimpleTestCircuit, ModuleConnector +from transactron.testing import TestCaseWithSimulator, TestbenchIO, SimpleTestCircuit, ModuleConnector from coreblocks.frontend.decode_stage import DecodeStage from coreblocks.params import GenParams, FetchLayouts, DecodeLayouts, OpType, Funct3, Funct7 diff --git a/test/frontend/test_fetch.py b/test/frontend/test_fetch.py index 40e3c56c4..e57392485 100644 --- a/test/frontend/test_fetch.py +++ b/test/frontend/test_fetch.py @@ -12,7 +12,7 @@ from coreblocks.params import * from coreblocks.params.configurations import test_core_config from transactron.utils import ModuleConnector -from ..common import TestCaseWithSimulator, TestbenchIO, def_method_mock, SimpleTestCircuit +from transactron.testing import TestCaseWithSimulator, TestbenchIO, def_method_mock, SimpleTestCircuit class MockedICache(Elaboratable, CacheInterface): diff --git a/test/frontend/test_instr_decoder.py b/test/frontend/test_instr_decoder.py index abd3183cc..18b11bf3c 100644 --- a/test/frontend/test_instr_decoder.py +++ b/test/frontend/test_instr_decoder.py @@ -1,6 +1,6 @@ from amaranth.sim import * -from ..common import TestCaseWithSimulator +from transactron.testing import TestCaseWithSimulator from coreblocks.params import * from coreblocks.params.configurations import test_core_config diff --git a/test/frontend/test_rvc.py b/test/frontend/test_rvc.py index 668ead899..d31d21e63 100644 --- a/test/frontend/test_rvc.py +++ b/test/frontend/test_rvc.py @@ -8,7 +8,7 @@ from coreblocks.params.configurations import test_core_config from transactron.utils import ValueLike -from ..common import TestCaseWithSimulator +from transactron.testing import TestCaseWithSimulator COMMON_TESTS = [ # Illegal instruction diff --git a/test/fu/functional_common.py b/test/fu/functional_common.py index d6c7f41bf..7d21682cb 100644 --- a/test/fu/functional_common.py +++ b/test/fu/functional_common.py @@ -16,7 +16,7 @@ from coreblocks.params.layouts import ExceptionRegisterLayouts from coreblocks.params.optypes import OpType from transactron.lib import Adapter -from test.common import RecordIntDict, RecordIntDictRet, TestbenchIO, TestCaseWithSimulator, SimpleTestCircuit +from transactron.testing import RecordIntDict, RecordIntDictRet, TestbenchIO, TestCaseWithSimulator, SimpleTestCircuit from transactron.utils import ModuleConnector diff --git a/test/fu/test_fu_decoder.py b/test/fu/test_fu_decoder.py index 7e6ba7d98..965e07e40 100644 --- a/test/fu/test_fu_decoder.py +++ b/test/fu/test_fu_decoder.py @@ -3,7 +3,7 @@ from amaranth import * from amaranth.sim import * -from ..common import SimpleTestCircuit, TestCaseWithSimulator +from transactron.testing import SimpleTestCircuit, TestCaseWithSimulator from coreblocks.fu.fu_decoder import DecoderManager, Decoder from coreblocks.params import OpType, Funct3, Funct7, GenParams diff --git a/test/fu/test_unsigned_mul_unit.py b/test/fu/test_unsigned_mul_unit.py index 901f95bd7..56b3657e6 100644 --- a/test/fu/test_unsigned_mul_unit.py +++ b/test/fu/test_unsigned_mul_unit.py @@ -10,7 +10,7 @@ from coreblocks.fu.unsigned_multiplication.sequence import SequentialUnsignedMul from coreblocks.fu.unsigned_multiplication.shift import ShiftUnsignedMul -from test.common import TestCaseWithSimulator, SimpleTestCircuit +from transactron.testing import TestCaseWithSimulator, SimpleTestCircuit from coreblocks.params import GenParams from coreblocks.params.configurations import test_core_config diff --git a/test/lsu/test_dummylsu.py b/test/lsu/test_dummylsu.py index 68154b292..61e9a3f29 100644 --- a/test/lsu/test_dummylsu.py +++ b/test/lsu/test_dummylsu.py @@ -14,8 +14,8 @@ from transactron.utils.dependencies import DependencyManager from coreblocks.params.layouts import ExceptionRegisterLayouts from coreblocks.peripherals.wishbone import * +from transactron.testing import TestbenchIO, TestCaseWithSimulator, def_method_mock from coreblocks.peripherals.bus_adapter import WishboneMasterAdapter -from test.common import TestbenchIO, TestCaseWithSimulator, def_method_mock from test.peripherals.test_wishbone import WishboneInterfaceWrapper diff --git a/test/lsu/test_pma.py b/test/lsu/test_pma.py index 464807505..07c36652d 100644 --- a/test/lsu/test_pma.py +++ b/test/lsu/test_pma.py @@ -10,8 +10,8 @@ from transactron.utils.dependencies import DependencyManager from coreblocks.params.layouts import ExceptionRegisterLayouts from coreblocks.peripherals.wishbone import * +from transactron.testing import TestbenchIO, TestCaseWithSimulator, def_method_mock from coreblocks.peripherals.bus_adapter import WishboneMasterAdapter -from test.common import TestbenchIO, TestCaseWithSimulator, def_method_mock from test.peripherals.test_wishbone import WishboneInterfaceWrapper diff --git a/test/peripherals/test_axi_lite.py b/test/peripherals/test_axi_lite.py index 9d887ce9f..e1d52c107 100644 --- a/test/peripherals/test_axi_lite.py +++ b/test/peripherals/test_axi_lite.py @@ -2,7 +2,7 @@ from transactron import Method, def_method, TModule from transactron.lib import AdapterTrans -from ..common import * +from transactron.testing import * class AXILiteInterfaceWrapper: diff --git a/test/peripherals/test_wishbone.py b/test/peripherals/test_wishbone.py index ad0b2c4d5..a8332f62b 100644 --- a/test/peripherals/test_wishbone.py +++ b/test/peripherals/test_wishbone.py @@ -5,7 +5,7 @@ from transactron.lib import AdapterTrans -from ..common import * +from transactron.testing import * class WishboneInterfaceWrapper: diff --git a/test/regression/pysim.py b/test/regression/pysim.py index 99c57e5d9..9028fced4 100644 --- a/test/regression/pysim.py +++ b/test/regression/pysim.py @@ -4,7 +4,7 @@ from .memory import * from .common import SimulationBackend, SimulationExecutionResult -from ..common import SimpleTestCircuit, PysimSimulator +from transactron.testing import SimpleTestCircuit, PysimSimulator from ..peripherals.test_wishbone import WishboneInterfaceWrapper from coreblocks.core import Core diff --git a/test/scheduler/test_rs_selection.py b/test/scheduler/test_rs_selection.py index 31b84b7bc..322323fb2 100644 --- a/test/scheduler/test_rs_selection.py +++ b/test/scheduler/test_rs_selection.py @@ -8,7 +8,7 @@ from coreblocks.params.configurations import test_core_config from coreblocks.scheduler.scheduler import RSSelection from transactron.lib import FIFO, Adapter, AdapterTrans -from test.common import TestCaseWithSimulator, TestbenchIO +from transactron.testing import TestCaseWithSimulator, TestbenchIO _rs1_optypes = {OpType.ARITHMETIC, OpType.COMPARE} _rs2_optypes = {OpType.LOGIC, OpType.COMPARE} diff --git a/test/scheduler/test_scheduler.py b/test/scheduler/test_scheduler.py index a8ee99f2a..a25979c49 100644 --- a/test/scheduler/test_scheduler.py +++ b/test/scheduler/test_scheduler.py @@ -19,7 +19,7 @@ from coreblocks.params.configurations import test_core_config from coreblocks.structs_common.rob import ReorderBuffer from coreblocks.utils.protocols import FuncBlock -from ..common import RecordIntDict, TestCaseWithSimulator, TestGen, TestbenchIO, def_method_mock +from transactron.testing import RecordIntDict, TestCaseWithSimulator, TestGen, TestbenchIO, def_method_mock class SchedulerTestCircuit(Elaboratable): diff --git a/test/scheduler/test_wakeup_select.py b/test/scheduler/test_wakeup_select.py index 6e0ff320b..ec0cb158c 100644 --- a/test/scheduler/test_wakeup_select.py +++ b/test/scheduler/test_wakeup_select.py @@ -15,7 +15,7 @@ from transactron.lib import Adapter from coreblocks.scheduler.wakeup_select import * -from ..common import RecordIntDict, TestCaseWithSimulator, TestbenchIO +from transactron.testing import RecordIntDict, TestCaseWithSimulator, TestbenchIO class WakeupTestCircuit(Elaboratable): diff --git a/test/stages/test_backend.py b/test/stages/test_backend.py index d7bdb27fa..2dc1695f8 100644 --- a/test/stages/test_backend.py +++ b/test/stages/test_backend.py @@ -8,7 +8,7 @@ from coreblocks.params.layouts import * from coreblocks.params import GenParams from coreblocks.params.configurations import test_core_config -from ..common import TestCaseWithSimulator, TestbenchIO +from transactron.testing import TestCaseWithSimulator, TestbenchIO class BackendTestCircuit(Elaboratable): diff --git a/test/stages/test_retirement.py b/test/stages/test_retirement.py index 8f87e8327..1502eb0b9 100644 --- a/test/stages/test_retirement.py +++ b/test/stages/test_retirement.py @@ -7,7 +7,7 @@ from coreblocks.params import ROBLayouts, RFLayouts, GenParams, LSULayouts, SchedulerLayouts from coreblocks.params.configurations import test_core_config -from ..common import * +from transactron.testing import * from collections import deque import random diff --git a/test/structs_common/test_csr.py b/test/structs_common/test_csr.py index 1c5d173be..4df317ba8 100644 --- a/test/structs_common/test_csr.py +++ b/test/structs_common/test_csr.py @@ -10,7 +10,7 @@ from transactron.utils.dependencies import DependencyManager from coreblocks.params.optypes import OpType -from ..common import * +from transactron.testing import * import random diff --git a/test/structs_common/test_exception.py b/test/structs_common/test_exception.py index 850c3f662..1988f5ad3 100644 --- a/test/structs_common/test_exception.py +++ b/test/structs_common/test_exception.py @@ -8,7 +8,7 @@ from transactron.lib import Adapter from transactron.utils import ModuleConnector -from ..common import * +from transactron.testing import * import random diff --git a/test/structs_common/test_rat.py b/test/structs_common/test_rat.py index 39ca2b100..6fb281761 100644 --- a/test/structs_common/test_rat.py +++ b/test/structs_common/test_rat.py @@ -1,4 +1,4 @@ -from ..common import TestCaseWithSimulator, SimpleTestCircuit +from transactron.testing import TestCaseWithSimulator, SimpleTestCircuit from coreblocks.structs_common.rat import FRAT, RRAT from coreblocks.params import GenParams diff --git a/test/structs_common/test_reorder_buffer.py b/test/structs_common/test_reorder_buffer.py index 51abf2d4a..26731e635 100644 --- a/test/structs_common/test_reorder_buffer.py +++ b/test/structs_common/test_reorder_buffer.py @@ -1,6 +1,6 @@ from amaranth.sim import Passive, Settle -from ..common import TestCaseWithSimulator, SimpleTestCircuit +from transactron.testing import TestCaseWithSimulator, SimpleTestCircuit from coreblocks.structs_common.rob import ReorderBuffer from coreblocks.params import GenParams diff --git a/test/structs_common/test_rs.py b/test/structs_common/test_rs.py index 64403c1a0..d5b9b4741 100644 --- a/test/structs_common/test_rs.py +++ b/test/structs_common/test_rs.py @@ -1,6 +1,6 @@ from amaranth.sim import Settle -from ..common import TestCaseWithSimulator, get_outputs, SimpleTestCircuit +from transactron.testing import TestCaseWithSimulator, get_outputs, SimpleTestCircuit from coreblocks.structs_common.rs import RS from coreblocks.params import * diff --git a/test/test_core.py b/test/test_core.py index bf33cb7c6..1522fa3a6 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -3,7 +3,7 @@ from transactron.lib import AdapterTrans from transactron.utils import align_to_power_of_two, signed_to_int -from .common import TestCaseWithSimulator, TestbenchIO +from transactron.testing import TestCaseWithSimulator, TestbenchIO from coreblocks.core import Core from coreblocks.params import GenParams diff --git a/test/transactions/test_adapter.py b/test/transactions/test_adapter.py index 48728cb02..7c4849657 100644 --- a/test/transactions/test_adapter.py +++ b/test/transactions/test_adapter.py @@ -3,7 +3,7 @@ from transactron import Method, def_method, TModule -from ..common import TestCaseWithSimulator, data_layout, SimpleTestCircuit, ModuleConnector +from transactron.testing import TestCaseWithSimulator, data_layout, SimpleTestCircuit, ModuleConnector class Echo(Elaboratable): diff --git a/test/transactions/test_branches.py b/test/transactions/test_branches.py index ba2a4545a..1f93eb80f 100644 --- a/test/transactions/test_branches.py +++ b/test/transactions/test_branches.py @@ -11,7 +11,7 @@ def_method, ) from unittest import TestCase -from ..common import TestCaseWithSimulator +from transactron.testing import TestCaseWithSimulator class TestExclusivePath(TestCase): diff --git a/test/transactions/test_methods.py b/test/transactions/test_methods.py index 6298dfabe..6cf8699e2 100644 --- a/test/transactions/test_methods.py +++ b/test/transactions/test_methods.py @@ -2,7 +2,7 @@ from amaranth import * from amaranth.sim import * -from ..common import TestCaseWithSimulator, TestbenchIO, data_layout +from transactron.testing import TestCaseWithSimulator, TestbenchIO, data_layout from transactron import * from transactron.utils import MethodStruct diff --git a/test/transactions/test_simultaneous.py b/test/transactions/test_simultaneous.py index 6b5d2d0b9..71fe3e9eb 100644 --- a/test/transactions/test_simultaneous.py +++ b/test/transactions/test_simultaneous.py @@ -5,7 +5,7 @@ from transactron.utils import ModuleConnector -from ..common import SimpleTestCircuit, TestCaseWithSimulator, TestbenchIO, def_method_mock +from transactron.testing import SimpleTestCircuit, TestCaseWithSimulator, TestbenchIO, def_method_mock from transactron import * from transactron.lib import Adapter, Connect, ConnectTrans diff --git a/test/transactions/test_transaction_lib.py b/test/transactions/test_transaction_lib.py index d37d3ad1f..058557f22 100644 --- a/test/transactions/test_transaction_lib.py +++ b/test/transactions/test_transaction_lib.py @@ -15,7 +15,7 @@ from coreblocks.utils import * from transactron.utils._typing import ModuleLike, MethodStruct from transactron.utils import ModuleConnector -from ..common import ( +from transactron.testing import ( SimpleTestCircuit, TestCaseWithSimulator, TestbenchIO, diff --git a/test/transactions/test_transactions.py b/test/transactions/test_transactions.py index ee131868e..9c7680e26 100644 --- a/test/transactions/test_transactions.py +++ b/test/transactions/test_transactions.py @@ -9,7 +9,7 @@ from typing import Iterable, Callable from parameterized import parameterized, parameterized_class -from ..common import TestCaseWithSimulator, TestbenchIO, data_layout +from transactron.testing import TestCaseWithSimulator, TestbenchIO, data_layout from transactron import * from transactron.lib import Adapter, AdapterTrans diff --git a/test/common/_test/__init__.py b/test/transactron/testing/__init__.py similarity index 100% rename from test/common/_test/__init__.py rename to test/transactron/testing/__init__.py diff --git a/test/common/_test/test_infrastructure.py b/test/transactron/testing/test_infrastructure.py similarity index 95% rename from test/common/_test/test_infrastructure.py rename to test/transactron/testing/test_infrastructure.py index ecf1c84d9..4e219bca9 100644 --- a/test/common/_test/test_infrastructure.py +++ b/test/transactron/testing/test_infrastructure.py @@ -1,5 +1,5 @@ from amaranth import * -from test.common import * +from transactron.testing import * class EmptyCircuit(Elaboratable): diff --git a/test/utils/test_fifo.py b/test/utils/test_fifo.py index 934a58475..30ca10c1c 100644 --- a/test/utils/test_fifo.py +++ b/test/utils/test_fifo.py @@ -3,7 +3,7 @@ from transactron.lib import AdapterTrans, BasicFifo -from test.common import TestCaseWithSimulator, TestbenchIO, data_layout +from transactron.testing import TestCaseWithSimulator, TestbenchIO, data_layout from collections import deque from parameterized import parameterized_class import random diff --git a/test/utils/test_onehotswitch.py b/test/utils/test_onehotswitch.py index 12d8373b9..4097b76d1 100644 --- a/test/utils/test_onehotswitch.py +++ b/test/utils/test_onehotswitch.py @@ -3,7 +3,7 @@ from transactron.utils import OneHotSwitch -from test.common import TestCaseWithSimulator +from transactron.testing import TestCaseWithSimulator from parameterized import parameterized diff --git a/test/utils/test_utils.py b/test/utils/test_utils.py index a26567003..09f3d710c 100644 --- a/test/utils/test_utils.py +++ b/test/utils/test_utils.py @@ -2,7 +2,7 @@ import random from amaranth import * -from test.common import * +from transactron.testing import * from transactron.utils import ( align_to_power_of_two, align_down_to_power_of_two, diff --git a/test/common/__init__.py b/transactron/testing/__init__.py similarity index 100% rename from test/common/__init__.py rename to transactron/testing/__init__.py diff --git a/test/common/functions.py b/transactron/testing/functions.py similarity index 100% rename from test/common/functions.py rename to transactron/testing/functions.py diff --git a/test/gtkw_extension.py b/transactron/testing/gtkw_extension.py similarity index 100% rename from test/gtkw_extension.py rename to transactron/testing/gtkw_extension.py diff --git a/test/common/infrastructure.py b/transactron/testing/infrastructure.py similarity index 99% rename from test/common/infrastructure.py rename to transactron/testing/infrastructure.py index 51dd3e8ce..761bd7859 100644 --- a/test/common/infrastructure.py +++ b/transactron/testing/infrastructure.py @@ -11,7 +11,7 @@ from .testbenchio import TestbenchIO from .profiler import profiler_process, Profile from .functions import TestGen -from ..gtkw_extension import write_vcd_ext +from .gtkw_extension import write_vcd_ext from transactron import Method from transactron.lib import AdapterTrans from transactron.core import TransactionModule diff --git a/test/common/profiler.py b/transactron/testing/profiler.py similarity index 100% rename from test/common/profiler.py rename to transactron/testing/profiler.py diff --git a/test/common/sugar.py b/transactron/testing/sugar.py similarity index 100% rename from test/common/sugar.py rename to transactron/testing/sugar.py diff --git a/test/common/testbenchio.py b/transactron/testing/testbenchio.py similarity index 100% rename from test/common/testbenchio.py rename to transactron/testing/testbenchio.py