diff --git a/c_utils.py b/c_utils.py index 0ebc6c2d..4454d504 100644 --- a/c_utils.py +++ b/c_utils.py @@ -2,7 +2,8 @@ import os import pprint -from shared_utils import * +from constants import causes, csrs, csrs32 +from shared_utils import InstrDict, arg_lut pp = pprint.PrettyPrinter(indent=2) logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s") diff --git a/chisel_utils.py b/chisel_utils.py index 9916b76c..fbe6806c 100644 --- a/chisel_utils.py +++ b/chisel_utils.py @@ -1,10 +1,8 @@ import logging import pprint -from constants import * - -# from shared_utils import overlaps, overlap_allowed, extension_overlap_allowed, instruction_overlap_allowed, process_enc_line, same_base_isa, add_segmented_vls_insn, expand_nf_field -from shared_utils import * +from constants import causes, csrs, csrs32 +from shared_utils import InstrDict, instr_dict_2_extensions pp = pprint.PrettyPrinter(indent=2) logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s") diff --git a/go_utils.py b/go_utils.py index 88cb34b0..9bdc64db 100644 --- a/go_utils.py +++ b/go_utils.py @@ -2,7 +2,7 @@ import pprint import sys -from shared_utils import * +from shared_utils import InstrDict, signed pp = pprint.PrettyPrinter(indent=2) logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s") diff --git a/latex_utils.py b/latex_utils.py index f1bf5321..3d9a0098 100644 --- a/latex_utils.py +++ b/latex_utils.py @@ -2,8 +2,8 @@ import pprint from typing import TextIO -from constants import * -from shared_utils import * +from constants import latex_fixed_fields, latex_inst_type, latex_mapping +from shared_utils import InstrDict, arg_lut, create_inst_dict pp = pprint.PrettyPrinter(indent=2) logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s") diff --git a/rust_utils.py b/rust_utils.py index ad160e8a..d2df1537 100644 --- a/rust_utils.py +++ b/rust_utils.py @@ -1,10 +1,8 @@ import logging import pprint -from constants import * - -# from shared_utils import overlaps, overlap_allowed, extension_overlap_allowed, instruction_overlap_allowed, process_enc_line, same_base_isa, add_segmented_vls_insn, expand_nf_field -from shared_utils import * +from constants import causes, csrs, csrs32 +from shared_utils import InstrDict pp = pprint.PrettyPrinter(indent=2) logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s") diff --git a/shared_utils.py b/shared_utils.py index 34482b1b..9e66e729 100644 --- a/shared_utils.py +++ b/shared_utils.py @@ -8,7 +8,15 @@ from itertools import chain from typing import Dict, TypedDict -from constants import * +from constants import ( + arg_lut, + fixed_ranges, + imported_regex, + overlapping_extensions, + overlapping_instructions, + pseudo_regex, + single_fixed, +) LOG_FORMAT = "%(levelname)s:: %(message)s" LOG_LEVEL = logging.INFO diff --git a/sverilog_utils.py b/sverilog_utils.py index a3b75712..e32ad71c 100644 --- a/sverilog_utils.py +++ b/sverilog_utils.py @@ -1,7 +1,8 @@ import logging import pprint -from shared_utils import * +from constants import csrs, csrs32 +from shared_utils import InstrDict pp = pprint.PrettyPrinter(indent=2) logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s") diff --git a/test.py b/test.py index aa091b72..e8579b9f 100644 --- a/test.py +++ b/test.py @@ -4,7 +4,25 @@ import unittest from unittest.mock import Mock, patch -from shared_utils import * +from shared_utils import ( + InstrDict, + check_arg_lut, + check_overlapping_bits, + extract_isa_type, + find_extension_file, + handle_arg_lut_mapping, + initialize_encoding, + is_rv_variant, + overlaps, + pad_to_equal_length, + parse_instruction_line, + process_enc_line, + process_fixed_ranges, + process_standard_instructions, + same_base_isa, + update_encoding_for_fixed_range, + validate_bit_range, +) class EncodingUtilsTest(unittest.TestCase):