2015-03-01 10:52:50 -05:00
|
|
|
from migen.fhdl.std import *
|
|
|
|
from migen.flow.actor import Sink, Source
|
|
|
|
|
|
|
|
class UARTPHYSim(Module):
|
2015-03-06 06:08:10 -05:00
|
|
|
def __init__(self, pads, *args, **kwargs):
|
2015-03-01 10:56:48 -05:00
|
|
|
self.sink = Sink([("data", 8)])
|
|
|
|
self.source = Source([("data", 8)])
|
2015-03-01 10:52:50 -05:00
|
|
|
|
|
|
|
self.comb += [
|
|
|
|
pads.source_stb.eq(self.sink.stb),
|
2015-03-01 10:56:48 -05:00
|
|
|
pads.source_data.eq(self.sink.data),
|
2015-03-01 10:52:50 -05:00
|
|
|
self.sink.ack.eq(pads.source_ack),
|
|
|
|
|
|
|
|
self.source.stb.eq(pads.sink_stb),
|
2015-03-03 18:57:37 -05:00
|
|
|
self.source.data.eq(pads.sink_data),
|
|
|
|
pads.sink_ack.eq(self.source.ack)
|
2015-03-01 10:52:50 -05:00
|
|
|
]
|