2014-12-18 12:02:35 -05:00
|
|
|
from lib.sata.common import *
|
|
|
|
from lib.sata.phy.ctrl import SATAPHYHostCtrl, SATAPHYDeviceCtrl
|
|
|
|
from lib.sata.phy.datapath import SATAPHYDatapath
|
|
|
|
|
|
|
|
class SATAPHY(Module):
|
|
|
|
def __init__(self, pads, clk_freq, host=True, device_family="k7", speed="SATA1"):
|
|
|
|
# Transceiver / Clocks
|
|
|
|
if device_family == "k7":
|
|
|
|
from lib.sata.phy.k7.trx import K7SATAPHYTRX
|
|
|
|
from lib.sata.phy.k7.crg import K7SATAPHYCRG
|
2014-12-18 19:35:18 -05:00
|
|
|
self.trx = K7SATAPHYTRX(pads, speed)
|
|
|
|
self.crg = K7SATAPHYCRG(pads, self.trx, clk_freq, speed)
|
2014-12-18 12:02:35 -05:00
|
|
|
else:
|
|
|
|
raise NotImplementedError(device_family + "device family not implemented")
|
|
|
|
|
|
|
|
# Control
|
|
|
|
if host:
|
2014-12-18 19:35:18 -05:00
|
|
|
self.ctrl = SATAPHYHostCtrl(self.trx, self.crg, clk_freq)
|
2014-12-18 12:02:35 -05:00
|
|
|
else:
|
2014-12-18 19:35:18 -05:00
|
|
|
self.ctrl = SATAPHYDeviceCtrl(self.trx, self.crg, clk_freq)
|
2014-12-18 12:02:35 -05:00
|
|
|
|
|
|
|
# Datapath
|
2014-12-18 19:35:18 -05:00
|
|
|
self.datapath = SATAPHYDatapath(self.trx, self.ctrl)
|
2014-12-18 12:02:35 -05:00
|
|
|
self.sink, self.source = self.datapath.sink, self.datapath.source
|