phy/sim: generate sop/eop
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 25 Feb 2015 16:47:44 +0000 (17:47 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 25 Feb 2015 16:47:44 +0000 (17:47 +0100)
liteeth/phy/sim.py

index 3d9174cbddfdf40f529314dbcb8a7fe864f05990..f7069dd97a3c85fc2997c4458e091bbbe5f20087 100644 (file)
@@ -26,11 +26,18 @@ class LiteEthPHYSim(Module, AutoCSR):
                self.submodules.crg = LiteEthPHYSimCRG()
                self.sink = sink = Sink(eth_phy_description(8))
                self.source = source = Source(eth_phy_description(8))
+
                self.comb += [
                        pads.source_stb.eq(self.sink.stb),
                        pads.source_data.eq(self.sink.data),
-                       self.sink.ack.eq(1),
+                       self.sink.ack.eq(1)
+               ]
 
+               self.sync += [
                        self.source.stb.eq(pads.sink_stb),
-                       self.source.data.eq(pads.sink_data)
+                       self.source.sop.eq(pads.sink_stb & ~self.source.stb),
+                       self.source.data.eq(pads.sink_data),
+               ]
+               self.comb += [
+                       self.source.eop.eq(~pads.sink_stb & self.source.stb),
                ]