From 41c8b50ba531308ae3651e3c9706ecced02128fb Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 15 Oct 2024 09:26:34 +0200 Subject: [PATCH] phy/pcs_1000basex: Cleanup sgmii timer reload. --- liteeth/phy/pcs_1000basex.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/liteeth/phy/pcs_1000basex.py b/liteeth/phy/pcs_1000basex.py index d750d95..6aff0ab 100644 --- a/liteeth/phy/pcs_1000basex.py +++ b/liteeth/phy/pcs_1000basex.py @@ -49,13 +49,11 @@ class PCSTX(LiteXModule): timer_en = Signal() self.sync += [ If(~timer_en | (timer == 0), - If(self.sgmii_speed == 0b00, - timer.eq(99) - ).Elif(self.sgmii_speed == 0b01, - timer.eq(9) - ).Elif(self.sgmii_speed == 0b10, - timer.eq(0) - ) + Case(self.sgmii_speed, { + 0b00: timer.eq(99), + 0b01: timer.eq( 9), + 0b10: timer.eq( 0), + }) ).Elif(timer_en, timer.eq(timer - 1) ) @@ -185,13 +183,11 @@ class PCSRX(LiteXModule): timer_en = Signal() self.sync += [ If(~timer_en | (timer == 0), - If(self.sgmii_speed == 0b00, - timer.eq(99) - ).Elif(self.sgmii_speed == 0b01, - timer.eq(9) - ).Elif(self.sgmii_speed == 0b10, - timer.eq(0) - ) + Case(self.sgmii_speed, { + 0b00: timer.eq(99), + 0b01: timer.eq( 9), + 0b10: timer.eq( 0), + }) ).Elif(timer_en, timer.eq(timer - 1) )