From: Luke Kenneth Casson Leighton Date: Sat, 2 Mar 2019 10:46:29 +0000 (+0000) Subject: reorganise normalisation init: move setup function from mod to class X-Git-Tag: ls180-24jan2020~1777 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cabe068ee5b0e4990af8906c54a9b42b251eb712;p=ieee754fpu.git reorganise normalisation init: move setup function from mod to class --- diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 78f9e52f..cc027d19 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -543,20 +543,6 @@ class FPNorm1Mod: self.out_z = FPNumBase(width, False) self.out_of = Overflow() - def setup(self, m, in_select, in_z, temp_z, out_z, - in_of, temp_of, out_of, - out_norm): - """ links module to inputs and outputs - """ - m.d.comb += self.in_select.eq(in_select) - m.d.comb += self.in_z.copy(in_z) - m.d.comb += self.in_of.copy(in_of) - m.d.comb += self.temp_z.copy(temp_z) - m.d.comb += self.temp_of.copy(temp_of) - m.d.comb += out_z.copy(self.out_z) - m.d.comb += out_of.copy(self.out_of) - m.d.comb += out_norm.eq(self.out_norm) - def elaborate(self, platform): m = Module() m.submodules.norm1_out_z = self.out_z @@ -623,6 +609,25 @@ class FPNorm1(FPState): self.out_z = FPNumBase(width) self.out_of = Overflow() + def setup(self, m, in_z, in_of, norm_stb): + """ links module to inputs and outputs + """ + m.submodules.normalise_1 = self.mod + + m.d.comb += self.mod.in_z.copy(in_z) + m.d.comb += self.mod.in_of.copy(in_of) + + m.d.comb += self.mod.in_select.eq(self.in_accept) + m.d.comb += self.mod.temp_z.copy(self.temp_z) + m.d.comb += self.mod.temp_of.copy(self.temp_of) + + m.d.comb += self.out_z.copy(self.mod.out_z) + m.d.comb += self.out_of.copy(self.mod.out_of) + m.d.comb += self.out_norm.eq(self.mod.out_norm) + + m.d.comb += self.stb.eq(norm_stb) + m.d.sync += self.ack.eq(0) # sets to zero when not in normalise_1 state + def action(self, m): m.d.comb += self.in_accept.eq((~self.ack) & (self.stb)) m.d.sync += self.of.copy(self.out_of) @@ -840,13 +845,7 @@ class FPADD: n1 = self.add_state(FPNorm1(self.width)) n1.set_inputs({"z": az, "of": add1.out_of}) # XXX Z as output n1.set_outputs({"z": az}) # XXX Z as output - n1.mod.setup(m, n1.in_accept, - az, n1.temp_z, n1.out_z, - add1.out_of, n1.temp_of, n1.out_of, - n1.out_norm) - m.submodules.normalise_1 = n1.mod - m.d.comb += n1.stb.eq(add1.norm_stb) - m.d.sync += n1.ack.eq(0) # sets to zero when not in normalise_1 state + n1.setup(m, az, add1.out_of, add1.norm_stb) rnz = FPNumOut(self.width, False) m.submodules.fpnum_rnz = rnz