return m
+def make_partitions(step, mwidth):
+ """Make equally spaced partition points
+
+ :param step: smallest partition width
+ :param mwidth: maximum number of partitions
+ :returns: partition points, and corresponding gates"""
+ gates = Signal(mwidth - 1)
+ points = PartitionPoints()
+ for i in range(mwidth-1):
+ points[(i + 1) * step] = gates[i]
+ return points, gates
+
+
# This defines a module to drive the device under test and assert
# properties about its outputs
class Driver(Elaboratable):
width = 64
mwidth = 8
# Setup partition points and gates
- points = PartitionPoints()
- gates = Signal(mwidth-1)
step = int(width/mwidth)
- for i in range(mwidth-1):
- points[(i+1)*step] = gates[i]
+ points, gates = make_partitions(step, mwidth)
# Instantiate the partitioned pattern producer
m.submodules.dut = dut = PartitionedPattern(width, points)
# Directly check some cases
width = 64
mwidth = 8
# Setup partition points and gates
- points = PartitionPoints()
- gates = Signal(mwidth-1)
step = int(width/mwidth)
- for i in range(mwidth-1):
- points[(i+1)*step] = gates[i]
+ points, gates = make_partitions(step, mwidth)
# Instantiate the partitioned pattern producer and the DUT
m.submodules.dut = dut = PartitionedPattern(width, points)
m.submodules.gen = gen = GateGenerator(mwidth)
return m
-def make_partitions(step, mwidth):
- gates = Signal(mwidth - 1)
- points = PartitionPoints()
- for i in range(mwidth-1):
- points[(i + 1) * step] = gates[i]
- return points, gates
-
-
class ComparisonOpDriver(Elaboratable):
"""Checks comparison operations on partitioned signals"""
def __init__(self, op, width, mwidth):
from nmutil.gtkw import write_gtkw
from nmutil.ripple import RippleLSB
-from ieee754.part_mul_add.partpoints import PartitionPoints
-from ieee754.part.formal.proof_partition import GateGenerator
+from ieee754.part.formal.proof_partition import GateGenerator, make_partitions
from ieee754.part_cmp.experiments.equal_ortree import PartitionedEq
width = 64
mwidth = 8
# Setup partition points and gates
- points = PartitionPoints()
- gates = Signal(mwidth-1)
step = int(width/mwidth)
- for i in range(mwidth-1):
- points[(i+1)*step] = gates[i]
+ points, gates = make_partitions(step, mwidth)
# instantiate the DUT
m.submodules.dut = dut = PartitionedEq(width, points)
# post-process the output to ripple the LSB
from nmutil.gtkw import write_gtkw
from nmutil.ripple import RippleLSB
-from ieee754.part_mul_add.partpoints import PartitionPoints
-from ieee754.part.formal.proof_partition import GateGenerator
+from ieee754.part.formal.proof_partition import GateGenerator, make_partitions
from ieee754.part_cmp.eq_gt_ge import PartitionedEqGtGe
width = 64
mwidth = 8
# Setup partition points and gates
- points = PartitionPoints()
- gates = Signal(mwidth-1)
step = int(width/mwidth)
- for i in range(mwidth-1):
- points[(i+1)*step] = gates[i]
+ points, gates = make_partitions(step, mwidth)
# instantiate the DUT
m.submodules.dut = dut = PartitionedEqGtGe(width, points)
# post-process the output to ripple the LSB