Record.connect(wishbone.wr_source, record.sender.wr_sink),
Record.connect(wishbone.rd_source, record.sender.rd_sink)
]
-
source.pr.eq(depacketizer.source.pr),
source.nr.eq(depacketizer.source.nr),
+ source.data.eq(depacketizer.source.data),
+
source.src_port.eq(sink.src_port),
source.dst_port.eq(sink.dst_port),
source.ip_address.eq(sink.ip_address),
If(sink.stb & sink.sop,
base_addr.ce.eq(1),
If(sink.wcount,
- NextState("RECEIVE_READS")
+ NextState("RECEIVE_WRITES")
).Elif(sink.rcount,
NextState("RECEIVE_READS")
)
self.submodules.receiver = receiver = LiteEthEtherboneRecordReceiver()
self.comb += [
Record.connect(sink, depacketizer.sink),
- Record.connect(depacketizer.source, receiver.sink)
+ Record.connect(depacketizer.source, receiver.sink),
+ receiver.sink.data.eq(reverse_bytes(depacketizer.source.data)) # clarify this
]
self.submodules.sender = sender = LiteEthEtherboneRecordSender()
self.submodules.packetizer = packetizer = LiteEthEtherboneRecordPacketizer()
self.comb += [
Record.connect(sender.source, packetizer.sink),
- Record.connect(packetizer.source, source)
+ packetizer.sink.data.eq(reverse_bytes(sender.source.data)), # clarify this
+ Record.connect(packetizer.source, source),
]
self.submodules.core = LiteEthUDPIPCore(self.phy_model, mac_address, ip_address, 100000)
self.submodules.etherbone = LiteEthEtherbone(self.core.udp, 20000)
+ self.submodules.sram = wishbone.SRAM(1024)
+ self.submodules.interconnect = wishbone.InterconnectPointToPoint(self.etherbone.wishbone.bus, self.sram.bus)
+
+
+
# use sys_clk for each clock_domain
self.clock_domains.cd_eth_rx = ClockDomain()
self.clock_domains.cd_eth_tx = ClockDomain()
yield
# test probe
+ #packet = etherbone.EtherbonePacket()
+ #packet.pf = 1
+ #self.etherbone_model.send(packet)
+
+ # test writes
+ writes = etherbone.EtherboneWrites(base_addr=0x1000)
+ for i in range(16):
+ writes.add(etherbone.EtherboneWrite(i))
+ record = etherbone.EtherboneRecord()
+ record.writes = writes
+ record.reads = None
+ record.bca = 0
+ record.rca = 0
+ record.rff = 0
+ record.cyc = 0
+ record.wca = 0
+ record.wff = 0
+ record.byte_enable = 0
+ record.wcount = 16
+ record.rcount = 0
+
packet = etherbone.EtherbonePacket()
- packet.pf = 1
+ packet.records = [record]
+ print(packet)
+
self.etherbone_model.send(packet)
+
+
if __name__ == "__main__":
run_simulation(TB(), ncycles=1024, vcd_name="my.vcd", keep_files=True)
\ No newline at end of file
def encode(self):
if self.encoded:
raise ValueError
- self.set_writes(self.writes)
- self.set_reads(self.reads)
+ if self.writes is not None:
+ self.set_writes(self.writes)
+ if self.reads is not None:
+ self.set_reads(self.reads)
header = 0
for k, v in sorted(etherbone_record_header.items()):
value = merge_bytes(split_bytes(getattr(self, k), math.ceil(v.width/8)), "little")