litex/misoclib/com/liteusb/core/com.py

27 lines
842 B
Python
Raw Normal View History

from migen.fhdl.std import *
from migen.flow.actor import *
2015-03-22 05:56:29 -04:00
from misoclib.com.liteusb.common import *
from misoclib.com.liteusb.frontend.crossbar import LiteUSBCrossbar
from misoclib.com.liteusb.core.packetizer import LiteUSBPacketizer
from misoclib.com.liteusb.core.depacketizer import LiteUSBDepacketizer
class LiteUSBCom(Module):
def __init__(self, phy, *ports):
# crossbar
self.submodules.crossbar = LiteUSBCrossbar(list(ports))
# packetizer / depacketizer
self.submodules.packetizer = LiteUSBPacketizer()
self.submodules.depacketizer = LiteUSBDepacketizer()
self.comb += [
self.crossbar.slave.source.connect(self.packetizer.sink),
self.depacketizer.source.connect(self.crossbar.slave.sink)
]
# phy
self.comb += [
self.packetizer.source.connect(phy.sink),
phy.source.connect(self.depacketizer.sink)
]