def __init__(self, udp_port=50000, dw=32): self.sink = sink = Endpoint(K2MMPacket.packet_user_description(dw)) self.source = source = Endpoint(eth_udp_user_description(dw)) self.submodules.packetizer = packetizer = Packetizer( K2MMPacket.packet_description(dw), source.description, K2MMPacket.get_header(dw)) self.comb += [ sink.connect(packetizer.sink, omit={"src_port", "dst_port", "ip_address", "length"}), packetizer.sink.version.eq(K2MMPacket.version), packetizer.sink.magic.eq(K2MMPacket.magic), packetizer.sink.addr_size.eq(64), packetizer.sink.port_size.eq(dw // 8) ] self.submodules.fsm = fsm = FSM(reset_state="IDLE") fsm.act("IDLE", If(packetizer.source.valid, NextState("SEND"))) fsm.act( "SEND", packetizer.source.connect(source), source.src_port.eq(udp_port), source.dst_port.eq(udp_port), source.ip_address.eq(sink.ip_address), source.length.eq(sink.length + K2MMPacket.get_header(dw).length), If(source.valid & source.last & source.ready, NextState("IDLE")))
def __init__(self, dw=8): Packetizer.__init__(self, eth_udp_description(dw), eth_ipv4_user_description(dw), udp_header)
def __init__(self, dw=8): Packetizer.__init__(self, eth_ipv4_description(dw), eth_mac_description(dw), ipv4_header)
def __init__(self, dw): Packetizer.__init__(self, eth_mac_description(dw), eth_phy_description(dw), mac_header)
def __init__(self, dw=8): Packetizer.__init__(self, udp_fragmenter_description(dw), eth_udp_user_description(dw), fragmenter_header)
def __init__(self, dw=8): Packetizer.__init__(self, eth_arp_description(dw), eth_mac_description(dw), arp_header)