Skip to content

Commit

Permalink
build/gowin/gowin: workaround Ethernet clock port name
Browse files Browse the repository at this point in the history
LiteETH will rename clock port names, which makes Gowin tools unhappy
(because the name specified is no longer a "port" but a "net").

Add a hack to workaround this.

This is tested by applying Etherbone on Tang Primer 20K.

Signed-off-by: Icenowy Zheng <[email protected]>
  • Loading branch information
Icenowy committed Aug 11, 2023
1 parent aff33be commit 4e7939c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion litex/build/gowin/gowin.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ def build_io_constraints(self):
def build_timing_constraints(self, vns):
sdc = []
for clk, period in sorted(self.clocks.items(), key=lambda x: x[0].duid):
sdc.append(f"create_clock -name {vns.get_name(clk)} -period {str(period)} [get_ports {{{vns.get_name(clk)}}}]")
clk_name = vns.get_name(clk)
# FIXME: Hack for Ethernet requesting a net name instead of port name
if clk_name == "eth_rx_clk":
clk_name = "eth_clocks_rx"
if clk_name == "eth_tx_clk":
clk_name = "eth_clocks_tx"
sdc.append(f"create_clock -name {clk_name} -period {str(period)} [get_ports {{{clk_name}}}]")
tools.write_to_file(f"{self._build_name}.sdc", "\n".join(sdc))
return (f"{self._build_name}.sdc", "SDC")

Expand Down

0 comments on commit 4e7939c

Please sign in to comment.