2014-09-23 17:03:32 -04:00
|
|
|
from migen.fhdl.std import *
|
|
|
|
|
|
|
|
from lib.sata.k7sataphy.std import *
|
2014-09-27 09:34:28 -04:00
|
|
|
from lib.sata.k7sataphy.gtx import K7SATAPHYGTX
|
|
|
|
from lib.sata.k7sataphy.crg import K7SATAPHYCRG
|
2014-09-24 08:28:52 -04:00
|
|
|
from lib.sata.k7sataphy.ctrl import K7SATAPHYHostCtrl, K7SATAPHYDeviceCtrl
|
2014-09-29 12:25:24 -04:00
|
|
|
from lib.sata.k7sataphy.datapath import K7SATAPHYDatapath
|
2014-09-23 17:03:32 -04:00
|
|
|
|
|
|
|
class K7SATAPHY(Module):
|
2014-09-29 12:25:24 -04:00
|
|
|
def __init__(self, pads, clk_freq, host=True, default_speed="SATA1"):
|
2014-09-27 10:10:39 -04:00
|
|
|
# GTX
|
2014-09-29 12:25:24 -04:00
|
|
|
self.submodules.gtx = K7SATAPHYGTX(pads, default_speed)
|
2014-09-27 10:10:39 -04:00
|
|
|
|
|
|
|
# CRG / CTRL
|
2014-09-29 12:25:24 -04:00
|
|
|
self.submodules.crg = K7SATAPHYCRG(pads, self.gtx, clk_freq, default_speed)
|
2014-09-27 10:10:39 -04:00
|
|
|
if host:
|
2014-09-29 12:25:24 -04:00
|
|
|
self.submodules.ctrl = K7SATAPHYHostCtrl(self.gtx, self.crg, clk_freq)
|
2014-09-27 10:10:39 -04:00
|
|
|
else:
|
2014-09-29 12:25:24 -04:00
|
|
|
self.submodules.ctrl = K7SATAPHYDeviceCtrl(self.gtx, self.crg, clk_freq)
|
2014-09-27 10:10:39 -04:00
|
|
|
|
|
|
|
# DATAPATH
|
2014-09-29 12:25:24 -04:00
|
|
|
self.submodules.datapath = K7SATAPHYDatapath(self.gtx, self.ctrl)
|
|
|
|
self.sink, self.source = self.datapath.sink, self.datapath.source
|