return random.randint(0, max_n-1)
-class RandRun:
- def __init__(self, level=0):
- self.run = True
- self.level = level
-
- def do_simulation(self, selfp):
- self.run = True
- n = randn(100)
- if n < self.level:
- self.run = False
-
-
class Packet(list):
def __init__(self, init=[]):
self.ongoing = False
while not packet.done:
yield
+ @passive
def generator(self):
while True:
if len(self.packets) and self.packet.done:
while not self.packet.done:
yield
+ @passive
def generator(self):
while True:
yield self.sink.ready.eq(1)
yield
-class AckRandomizer(Module):
+class Randomizer(Module):
def __init__(self, description, level=0):
self.level = level
self.comb += \
If(self.ce,
- Record.connect(self.sink, self.source)
+ self.sink.connect(self.source)
).Else(
self.source.valid.eq(0),
self.sink.ready.eq(0),
)
+ @passive
def generator(self):
while True:
n = randn(100)