From fa509b3365e4e91d6151f783d157afe06d6b7168 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 23 Sep 2014 23:03:32 +0200 Subject: [PATCH] rearrange code and remove datapath for now --- lib/sata/k7sataphy.py | 74 -------- lib/sata/k7sataphy/__init__.py | 15 ++ lib/sata/k7sataphy/clocking.py | 151 ++++++++++++++++ lib/sata/{k7satagtx.py => k7sataphy/gtx.py} | 181 +------------------- lib/sata/k7sataphy/std.py | 19 ++ 5 files changed, 190 insertions(+), 250 deletions(-) delete mode 100644 lib/sata/k7sataphy.py create mode 100644 lib/sata/k7sataphy/__init__.py create mode 100644 lib/sata/k7sataphy/clocking.py rename lib/sata/{k7satagtx.py => k7sataphy/gtx.py} (81%) create mode 100644 lib/sata/k7sataphy/std.py diff --git a/lib/sata/k7sataphy.py b/lib/sata/k7sataphy.py deleted file mode 100644 index 9a8f94f9..00000000 --- a/lib/sata/k7sataphy.py +++ /dev/null @@ -1,74 +0,0 @@ -from migen.fhdl.std import * -from lib.sata.k7satagtx import SATAGTX - -K28_5 = Signal(8, reset=0xBC) - -class K7SATAPHY(Module): - def __init__(self, pads, dw=16): - self.sata_gtx = SATAGTX(pads) - - self.sink = Sink([("d", dw)], True) - self.source = Source([("d", dw)], True) - - rx_chariscomma = self.sata_gtx.channel.rxchariscomma - rx_chariscomma_d = Signal(dw//8) - rx_data = self.sata_gtx.channel.rxdata - - tx_charisk = self.sata_gtx.channel.txcharisk - tx_data = self.sata_gtx.channel.txdata - - # link ready (same chariscomma for N times) #FIXME see how to do it for SATA - self.link_ready = Signal() - link_ready_cnt = Signal(8, reset=16-1) - self.sync.sata_rx += [ - If(rx_chariscomma != 0, - If(rx_chariscomma == rx_chariscomma_d, - If(~link_ready, link_ready_cnt.eq(link_ready_cnt-1)) - ).Else( - link_ready_cnt.eq(8-1) - ), - rx_chariscomma_d.eq(rx_chariscomma) - ) - ] - self.comb += self.link_ready.eq(link_ready_cnt==0) - - # Send K28_5 on start of frame #FIXME see how to do it for SATA - self.comb += [ - If(self.sink.sop, - tx_charisk.eq(1), - tx_data.eq(Cat(K28_5, self.sink.dat[8:])) - ).Else( - tx_charisk.eq(0), - tx_data.eq(self.sink.dat) - ), - self.sink.ack.eq(1) - ] - - # Realign rx data and drive source #FIXME see how to do it for SATA - rx_data_r = Signal(dw) - rx_chariscomma_r = Signal(dw//8) - rx_data_realigned = Signal(dw) - rx_chariscomma_realigned = Signal(dw) - - self.sync += [ - rx_data_r.eq(rx_data), - rx_chariscomma_r.eq(rx_chariscomma) - ] - - cases = {} - cases[1<<0] = [ - rx_data_realigned.eq(rx_data_r[0:dw]), - rx_chariscomma_realigned.eq(rx_chariscomma_r[0:dw//8]) - ] - for i in range(1, dw//8): - cases[1<