Skip to content

Commit 1c47251

Browse files
committed
Reertig changes in he_prep
1 parent 77505c2 commit 1c47251

File tree

2 files changed

+1
-50
lines changed

2 files changed

+1
-50
lines changed

assembler_tools/hec-assembler-tools/he_prep.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ def main(args):
7474
- interchange
7575
"""
7676

77-
strategy = getattr(args, "strategy", "largest_first")
78-
interchange = getattr(args, "interchange", False)
79-
8077
GlobalConfig.debugVerbose = args.verbose
8178

8279
# used for timings
@@ -100,11 +97,7 @@ def main(args):
10097
if args.verbose > 0:
10198
print("Assigning register banks to variables...")
10299
preprocessor.assign_register_banks_to_vars(
103-
hec_mem_model,
104-
insts_listing,
105-
use_bank0=False,
106-
strategy=strategy,
107-
interchange=interchange,
100+
hec_mem_model, insts_listing, use_bank0=False, strategy=args.strategy, interchange=args.interchange
108101
)
109102

110103
# Determine output file name

assembler_tools/hec-assembler-tools/tests/unit_tests/test_he_prep.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -359,48 +359,6 @@ def test_main_verbose_output(monkeypatch, tmp_path, capsys):
359359
assert "Generation time:" in captured.out
360360

361361

362-
def test_main_defaults_strategy_and_interchange(monkeypatch, tmp_path):
363-
"""
364-
@brief Test that main uses default values for strategy and interchange when not provided.
365-
"""
366-
input_file = tmp_path / "kernel.pisa"
367-
input_file.write_text("dummy")
368-
output_file = tmp_path / "output.pisa"
369-
370-
dummy_model = object()
371-
dummy_insts = [mock.Mock(to_pisa_format=mock.Mock(return_value="inst"))]
372-
373-
monkeypatch.setattr(he_prep, "MemoryModel", mock.Mock(return_value=dummy_model))
374-
monkeypatch.setattr(
375-
he_prep.preprocessor,
376-
"preprocess_pisa_kernel_listing",
377-
mock.Mock(return_value=dummy_insts),
378-
)
379-
assign_mock = mock.Mock()
380-
monkeypatch.setattr(he_prep.preprocessor, "assign_register_banks_to_vars", assign_mock)
381-
382-
# Create args without strategy/interchange using argparse.Namespace
383-
# This properly raises AttributeError for missing attributes
384-
args = type(
385-
"Args",
386-
(),
387-
{
388-
"input_file_name": str(input_file),
389-
"output_file_name": str(output_file),
390-
"mem_file": "",
391-
"verbose": 0,
392-
"split_on": False,
393-
},
394-
)()
395-
396-
he_prep.main(args)
397-
398-
assign_mock.assert_called_once()
399-
_, kwargs = assign_mock.call_args
400-
assert kwargs["strategy"] == "largest_first" # Default
401-
assert kwargs["interchange"] is False # Default
402-
403-
404362
def test_parse_args_defaults():
405363
"""
406364
@brief Test that parse_args sets correct defaults when optional args not provided.

0 commit comments

Comments
 (0)