+import random
+
from migen.fhdl.std import *
from migen.genlib.fsm import *
from migen.actorlib.fifo import *
)
self.comb += self.done.eq(cnt == cnt_max)
+
#
# TB
#
-import random
-
-
def randn(max_n):
return random.randint(0, max_n-1)
source.eop.eq(eop),
source.d.eq(sink.d),
sink.ack.eq(source.ack),
- If((eop & sink.stb & source.ack) | self.timeout.done, NextState("WAIT_SOP"))
+ If((eop & sink.stb & source.ack) | self.timeout.done,
+ NextState("WAIT_SOP")
+ )
)
self.sync += \
#
src_data = [
0x5A, 0xA5, 0x5A, 0xA5, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03,
- 0x5A, 0xA5, 0x5A, 0xA5, 0x12, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x5A, 0xA5, 0x5A, 0xA5, 0x12, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07,
]*4
read_time_en, max_read_time = anti_starvation(read_time)
write_time_en, max_write_time = anti_starvation(write_time)
- data_w_accepted = Signal(reset=1)
+ data_w_accepted = Signal(reset=1)
fsm = FSM()
self.submodules += RenameClockDomains(fsm, {"sys": "ftdi"})
# Read / Write Actions
#
- data_w = Signal(dw)
- data_r = Signal(dw)
+ data_w = Signal(dw)
+ data_r = Signal(dw)
data_oe = Signal()
if hasattr(pads, "oe_n"):
LENGTH = 512
model_rd_data = [i%256 for i in range(LENGTH)][::-1]
-user_wr_data = [i%256 for i in range(LENGTH)]
+user_wr_data = [i%256 for i in range(LENGTH)]
class TB(Module):