s, l, e = check(write_data, read_data)
print("shift "+ str(s) + " / length " + str(l) + " / errors " + str(e))
+ identify_packet = CommandTXPacket(identify=1)
+ yield from self.streamer.send(identify_packet)
+
if __name__ == "__main__":
run_simulation(TB(), ncycles=2048, vcd_name="my.vcd", keep_files=True)
return r
def get_field_data(field, packet):
- return (_little2big(packet[field.dword]) >> field.offset) & (2**field.width-1)
+ return (packet[field.dword] >> field.offset) & (2**field.width-1)
class FIS:
def __init__(self, packet, description, direction="H2D"):
def encode(self):
for k, v in self.description.items():
- self.packet[v.dword] |= _big2little((getattr(self, k) << v.offset))
+ self.packet[v.dword] |= (getattr(self, k) << v.offset)
def __repr__(self):
if self.direction == "H2D":
print_transport(fis)
def callback(self, packet):
- fis_type = _little2big(packet[0]) & 0xff
+ fis_type = packet[0] & 0xff
if fis_type == fis_types["REG_H2D"]:
fis = FIS_REG_H2D(packet)
elif fis_type == fis_types["REG_D2H"]:
packet.insert(0, 0)
return [FIS_DATA(packet, direction="D2H"), FIS_REG_D2H()]
- def identify_dma_callback(self, fis):
+ def identify_device_dma_callback(self, fis):
+ print_hdd("Identify device request")
packet = [i for i in range(256)]
packet.insert(0, 0)
return [FIS_DATA(packet, direction="D2H"), FIS_REG_D2H()]
cmd_cases = {}
for i in range(cmd_ndwords):
- cmd_cases[i] = [link.sink.d.eq(_big2little(encoded_cmd[32*i:32*(i+1)]))]
+ cmd_cases[i] = [link.sink.d.eq(encoded_cmd[32*i:32*(i+1)])]
self.comb += \
If(cmd_send,
data_done = Signal()
def test_type(name):
- return link.source.d[24:] == fis_types[name]
+ return link.source.d[:8] == fis_types[name]
self.fsm = fsm = FSM(reset_state="IDLE")
cmd_cases = {}
for i in range(cmd_ndwords):
- cmd_cases[i] = [encoded_cmd[32*i:32*(i+1)].eq(_little2big(link.source.d))]
+ cmd_cases[i] = [encoded_cmd[32*i:32*(i+1)].eq(link.source.d)]
self.comb += \
If(cmd_receive & link.source.stb,