Fetching contributors…
Cannot retrieve contributors at this time
50 lines (38 sloc) 1.72 KB
from migen.fhdl.std import *
from migen.genlib.cdc import NoRetiming, MultiReg
from import DataFlowGraph, CompositeActor
from import Source
from migen.bus.csr import Interconnect
from import BankArray
from ovhw.ftdi_bus import FTDI_sync245
from ovhw.bus_interleave import BusDecode, BusEncode, BusInterleave
from ovhw.csr_master import CSR_Master
# CmdProc (perhaps misnamed) handles command parsing on the ftdi interface
# inserting cmd responses, and multiplexing the cmd responses with the streaming data
class CmdProc(Module):
def __init__(self, ftdi_sync, streaming_sources):
# CSR Command Decoding
bdec = BusDecode()
self.comb += [
# Bus master
busmaster = CSR_Master(has_completion=True)
self.master = busmaster.master
# Encode output for response
benc = BusEncode()
# Connect decoder to busmaster to encoder
g = DataFlowGraph()
g.add_connection(bdec, busmaster)
g.add_connection(busmaster, benc)
self.submodules.fg = CompositeActor(g)
# Bus interleaver to merge streaming and response packets
bilv = BusInterleave([benc] + streaming_sources)
self.submodules += bilv
self.comb += [