self.o = self.mod.ospec()
self.a0mod = FPAddStage0Mod(width)
- self.a0_out_z = FPNumBase(width, False)
- self.out_tot = Signal(self.a0_out_z.m_width + 4, reset_less=True)
- self.a0_out_z = FPNumBase(width, False)
+ self.a0o = self.a0mod.ospec()
self.a1mod = FPAddStage1Mod(width)
- self.out_z = FPNumBase(width, False)
- self.out_of = Overflow()
+ self.a1o = self.a1mod.ospec()
def setup(self, m, in_a, in_b, in_mid):
""" links module to inputs and outputs
m.d.comb += self.o.eq(self.mod.o)
self.a0mod.setup(m, self.o.a, self.o.b)
- m.d.comb += self.a0_out_z.eq(self.a0mod.o.z)
- m.d.comb += self.out_tot.eq(self.a0mod.o.tot)
+ m.d.comb += self.a0o.eq(self.a0mod.o)
- self.a1mod.setup(m, self.out_tot, self.a0_out_z)
+ self.a1mod.setup(m, self.a0o.tot, self.a0o.z)
if self.in_mid is not None:
m.d.comb += self.in_mid.eq(in_mid)
def action(self, m):
self.idsync(m)
- m.d.sync += self.out_of.eq(self.a1mod.o.of)
- m.d.sync += self.out_z.eq(self.a1mod.o.z)
+ m.d.sync += self.a1o.eq(self.a1mod.o)
m.next = "normalise_1"
def __init__(self, width):
self.width = width
- self.in_z = FPNumBase(width, False)
- self.out_z = FPNumBase(width, False)
+ self.in_z = self.ispec()
+ self.out_z = self.ospec()
+
+ def ispec(self):
+ return FPNumBase(self.width, False)
+
+ def ospec(self):
+ return FPNumBase(self.width, False)
def setup(self, m, in_z, out_z, modname):
""" links module to inputs and outputs
# initialise out from in (overridden below)
m.d.comb += self.out_z.eq(in_z)
m.d.comb += self.out_of.eq(in_of)
- # normalisation increase/decrease conditions
+ # normalisation decrease condition
decrease = Signal(reset_less=True)
m.d.comb += decrease.eq(in_z.m_msbzero)
# decrease exponent
def __init__(self, width, single_cycle=True):
self.width = width
self.in_select = Signal(reset_less=True)
- self.out_norm = Signal(reset_less=True)
self.in_z = FPNumBase(width, False)
self.in_of = Overflow()
self.temp_z = FPNumBase(width, False)
alm.setup(m, sc.o.a, sc.o.b, sc.in_mid)
n1 = self.add_state(FPNormToPack(self.width, self.id_wid))
- n1.setup(m, alm.out_z, alm.out_of, alm.in_mid)
+ n1.setup(m, alm.a1o.z, alm.a1o.of, alm.in_mid)
ppz = self.add_state(FPPutZ("pack_put_z", n1.out_z, self.out_z,
n1.in_mid, self.out_mid))