MSCDIR = ../misoc
-CURDIR = ../k7sataphy
+CURDIR = ../sata_controller
PYTHON = python3
TOOLCHAIN = vivado
PLATFORM = kc705
# graph
self.comb += [
- If(fsm.ongoing("H2D_COPY" & (rx_det == 0),
+ If(fsm.ongoing("H2D_COPY") & (rx_det == 0),
descrambler.sink.stb.eq(phy.source.stb & (phy.charisk == 0)),
descrambler.sink.d.eq(phy.source.d),
- )
+ ),
Record.connect(descrambler.source, crc_checker.sink),
Record.connect(crc_checker.source, self.source)
]
)
fsm.act("H2D_WTRM",
tx_insert.eq(primitives["WTRM"]),
- If(rx_det == primitives["R_OK"]),
+ If(rx_det == primitives["R_OK"],
NextState("IDLE")
).Elif(rx_det == primitives["R_ERR"],
NextState("IDLE")
)
fsm.act("D2H_WTRM",
tx_insert.eq(primitives["R_OK"]),
- If(rx_det == primitives["SYNC"]),
+ If(rx_det == primitives["SYNC"],
NextState("IDLE")
)
)
class TB(Module):
def __init__(self, length):
- self.submodules.scrambler = SATAScrambler()
+ self.submodules.scrambler = Scrambler()
self.length = length
def gen_simulation(self, selfp):
from migen.fhdl.std import *
-from lib.sata.k7sataphy.std import *
-from lib.sata.k7sataphy.gtx import K7SATAPHYGTX
-from lib.sata.k7sataphy.crg import K7SATAPHYCRG
-from lib.sata.k7sataphy.ctrl import K7SATAPHYHostCtrl, K7SATAPHYDeviceCtrl
-from lib.sata.k7sataphy.datapath import K7SATAPHYDatapath
+from lib.sata.std import *
+from lib.sata.phy.k7sataphy.gtx import K7SATAPHYGTX
+from lib.sata.phy.k7sataphy.crg import K7SATAPHYCRG
+from lib.sata.phy.k7sataphy.ctrl import K7SATAPHYHostCtrl, K7SATAPHYDeviceCtrl
+from lib.sata.phy.k7sataphy.datapath import K7SATAPHYDatapath
class K7SATAPHY(Module):
def __init__(self, pads, clk_freq, host=True, default_speed="SATA1"):
from migen.genlib.fsm import FSM, NextState
from lib.sata.std import *
-from lib.sata.k7sataphy.gtx import GTXE2_COMMON
+from lib.sata.phy.k7sataphy.gtx import GTXE2_COMMON
class K7SATAPHYCRG(Module):
def __init__(self, pads, gtx, clk_freq, default_speed):
self.sync += \
If(~ctrl.ready,
align_cnt.eq(0)
- ).Elsif(tx.sink.stb & tx.sink.ack,
+ ).Elif(tx.sink.stb & tx.sink.ack,
align_cnt.eq(align_cnt+1)
)
send_align = (align_cnt < 2)
tx.sink.data.eq(self.sink.data),
tx.sink.charisk.eq(self.sink.charisk),
self.sink.ack.eq(tx.sink.ack)
- )
-
+ ),
self.source.stb.eq(rx.source.stb),
self.source.data.eq(rx.source.data),
self.source.charisk.eq(rx.source.charisk),
from miscope.uart2wishbone import UART2Wishbone
from misoclib import identifier
-from lib.sata.phy.k7sataphy.std import *
+from lib.sata.std import *
from lib.sata.phy.k7sataphy import K7SATAPHY
from migen.genlib.cdc import *
self.submodules.sataphy_host = K7SATAPHY(platform.request("sata_host"), clk_freq, host=True)
self.comb += [
self.sataphy_host.sink.stb.eq(1),
- self.sataphy_host.sink.data.eq(SYNC_VAL),
+ self.sataphy_host.sink.data.eq(primitives["SYNC"]),
self.sataphy_host.sink.charisk.eq(0b0001)
]
self.submodules.sataphy_device = K7SATAPHY(platform.request("sata_device"), clk_freq, host=False)
self.comb += [
self.sataphy_device.sink.stb.eq(1),
- self.sataphy_device.sink.data.eq(SYNC_VAL),
+ self.sataphy_device.sink.data.eq(primitives["SYNC"]),
self.sataphy_device.sink.charisk.eq(0b0001)
]
self.submodules.sataphy_host = K7SATAPHY(platform.request("sata_host"), clk_freq, host=True, default_speed="SATA2")
self.comb += [
self.sataphy_host.sink.stb.eq(1),
- self.sataphy_host.sink.data.eq(SYNC_VAL),
+ self.sataphy_host.sink.data.eq(primitives["SYNC"]),
self.sataphy_host.sink.charisk.eq(0b0001)
]