""" Create a ``DivPipeCoreOutputData`` instance. """
self.core_config = core_config
bw = core_config.bit_width
+ if core_config.supported == [DP.UDivRem]:
+ self.compare_len = bw * 2
+ else:
+ self.compare_len = bw * 3
self.quotient_root = Signal(bw, reset_less=reset_less)
- self.remainder = Signal(bw * 3, reset_less=reset_less)
+ self.remainder = Signal(self.compare_len, reset_less=reset_less)
def __iter__(self):
""" Get member signals. """
self.divisor_radicand = Signal(bw, reset_less=True)
self.quotient_root = Signal(bw, reset_less=True)
self.root_times_radicand = Signal(bw * 2, reset_less=True)
- self.compare_rhs = Signal(bw * 3, reset_less=True)
+ self.compare_rhs = Signal(self.compare_len, reset_less=True)
self.trial_compare_rhs = Signal(self.compare_len, reset_less=True)
self.operation = DP.create_signal(reset_less=True)
""" Create a ``DivPipeCoreSetupStage`` instance. """
assert stage_index in range(core_config.n_stages)
self.core_config = core_config
+ bw = core_config.bit_width
+ if core_config.supported == [DP.UDivRem]:
+ self.compare_len = bw * 2
+ else:
+ self.compare_len = bw * 3
self.stage_index = stage_index
self.i = self.ispec()
self.o = self.ospec()
# Array on such massively long numbers is insanely gate-hungry
crhs = []
tcrh = trial_compare_rhs_values
- bw = self.core_config.bit_width
for i in range(radix):
nbe = Signal(reset_less=True)
comb += nbe.eq(next_bits == i)
- crhs.append(Repl(nbe, bw*3) & tcrh[i])
+ crhs.append(Repl(nbe, self.compare_len) & tcrh[i])
comb += self.o.compare_rhs.eq(treereduce(crhs, operator.or_,
lambda x:x))