From 40e905c57312fca88e0c1c875de567fe0a3479da Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 3 Nov 2022 00:48:39 -0700 Subject: [PATCH] fix tied input-output equivalence checking --- src/bigint_presentation_code/compiler_ir2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bigint_presentation_code/compiler_ir2.py b/src/bigint_presentation_code/compiler_ir2.py index 05dc6f4..7bdd40b 100644 --- a/src/bigint_presentation_code/compiler_ir2.py +++ b/src/bigint_presentation_code/compiler_ir2.py @@ -1,4 +1,3 @@ -from collections import defaultdict import enum from abc import ABCMeta, abstractmethod from enum import Enum, unique @@ -941,7 +940,9 @@ class GenericOpProperties: if out.tied_input_index >= len(self.inputs): raise ValueError(f"tied_input_index out of range: {out}") tied_inp = self.inputs[out.tied_input_index] - if tied_inp.tied_to_input(out.tied_input_index) != out: + expected_out = tied_inp.tied_to_input(out.tied_input_index) \ + .with_write_stage(out.write_stage) + if expected_out != out: raise ValueError(f"output can't be tied to non-equivalent " f"input: {out} tied to {tied_inp}") if out.fixed_loc is not None: -- 2.30.2