def __repr__(self):
r = "FIS_DATA\n"
r += FIS.__repr__(self)
+ for data in self.packet[1:]:
+ r += "%08x\n" %data
return r
class FIS_PIO_SETUP_D2H(FIS):
elif fis_type == fis_types["DMA_ACTIVATE_D2H"]:
fis = FIS_DMA_ACTIVATE_D2H(packet)
elif fis_type == fis_types["DMA_SETUP"]:
- fis = FIS_SETUP(packet)
+ fis = FIS_DMA_SETUP(packet)
elif fis_type == fis_types["DATA"]:
fis = FIS_DATA(packet)
elif fis_type == fis_types["PIO_SETUP_D2H"]:
class TB(Module):
def __init__(self):
self.submodules.bfm = BFM(phy_debug=False,
- link_random_level=50, transport_debug=True, transport_loopback=True)
+ link_random_level=0, transport_debug=True, transport_loopback=True)
self.submodules.link = SATALinkLayer(self.bfm.phy)
self.submodules.transport = SATATransportLayer(self.link)
- self.comb += [
- self.transport.tx.cmd.stb.eq(1),
- self.transport.tx.cmd.type.eq(fis_types["REG_H2D"]),
- self.transport.tx.cmd.lba.eq(0x12345678)
- ]
+ def gen_simulation(self, selfp):
+ for i in range(100):
+ yield
+ selfp.transport.tx.cmd.stb = 1
+ selfp.transport.tx.cmd.type = fis_types["REG_H2D"]
+ selfp.transport.tx.cmd.lba = 0x0123456789
+ yield
+ while selfp.transport.tx.cmd.ack == 0:
+ yield
+ selfp.transport.tx.cmd.stb = 1
+ selfp.transport.tx.cmd.type = fis_types["DMA_SETUP"]
+ selfp.transport.tx.cmd.dma_buffer_id = 0x0123456789ABCDEF
+ yield
+ while selfp.transport.tx.cmd.ack == 0:
+ yield
+ selfp.transport.tx.cmd.stb = 1
+ selfp.transport.tx.cmd.type = fis_types["DATA"]
+ yield
+ for i in range(32):
+ selfp.transport.tx.data.stb = 1
+ #selfp.transport.tx.data.sop = (i==0)
+ selfp.transport.tx.data.eop = (i==31)
+ selfp.transport.tx.data.d = i
+ if selfp.transport.tx.data.ack == 1:
+ yield
+ else:
+ while selfp.transport.tx.data.ack == 0:
+ yield
+ selfp.transport.tx.cmd.stb = 0
if __name__ == "__main__":
- run_simulation(TB(), ncycles=256, vcd_name="my.vcd", keep_files=True)
+ run_simulation(TB(), ncycles=512, vcd_name="my.vcd", keep_files=True)