Skip to content

build, vendor: use dir="-" in create_missing_domain. #1443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions amaranth/build/plat.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,22 @@ def create_missing_domain(self, name):
# Many device families provide advanced primitives for tackling reset. If these exist,
# they should be used instead.
if name == "sync" and self.default_clk is not None:
clk_i = self.request(self.default_clk).i
m = Module()

clk_io = self.request(self.default_clk, dir="-")
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)

if self.default_rst is not None:
rst_i = self.request(self.default_rst).i
rst_io = self.request(self.default_rst, dir="-")
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
rst_i = rst_buf.i
else:
rst_i = Const(0)

m = Module()
m.domains += ClockDomain("sync")
m.d.comb += ClockSignal("sync").eq(clk_i)
m.d.comb += ClockSignal("sync").eq(clk_buf.i)
m.submodules.reset_sync = ResetSynchronizer(rst_i, domain="sync")

return m

def prepare(self, elaboratable, name="top", **kwargs):
Expand Down
8 changes: 6 additions & 2 deletions amaranth/vendor/_gowin.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,14 @@ def create_missing_domain(self, name):
o_OSCOUT=clk_i)

else:
clk_i = self.request(self.default_clk).i
clk_io = self.request(self.default_clk, dir="-")
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
clk_i = clk_buf.i

if self.default_rst is not None:
rst_i = self.request(self.default_rst).i
rst_io = self.request(self.default_rst, dir="-")
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
rst_i = rst_buf.i
else:
rst_i = Const(0)

Expand Down
9 changes: 7 additions & 2 deletions amaranth/vendor/_lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,9 +956,14 @@ def create_missing_domain(self, name):
o_HFCLKOUT=clk_i,
)
else:
clk_i = self.request(self.default_clk).i
clk_io = self.request(self.default_clk, dir="-")
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
clk_i = clk_buf.i

if self.default_rst is not None:
rst_i = self.request(self.default_rst).i
rst_io = self.request(self.default_rst, dir="-")
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
rst_i = rst_buf.i
else:
rst_i = Const(0)

Expand Down
9 changes: 7 additions & 2 deletions amaranth/vendor/_quicklogic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from abc import abstractmethod

from ..hdl import *
from ..lib import io
from ..lib.cdc import ResetSynchronizer
from ..build import *

Expand Down Expand Up @@ -172,10 +173,14 @@ def create_missing_domain(self, name):
o_A=sys_clk0,
o_Z=clk_i)
else:
clk_i = self.request(self.default_clk).i
clk_io = self.request(self.default_clk, dir="-")
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
clk_i = clk_buf.i

if self.default_rst is not None:
rst_i = self.request(self.default_rst).i
rst_io = self.request(self.default_rst, dir="-")
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
rst_i = rst_buf.i
else:
rst_i = Const(0)

Expand Down
8 changes: 6 additions & 2 deletions amaranth/vendor/_siliconblue.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,15 @@ def create_missing_domain(self, name):
delay = int(100e-6 * self.default_clk_frequency)
# User-defined clock signal.
else:
clk_i = self.request(self.default_clk).i
clk_io = self.request(self.default_clk, dir="-")
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
clk_i = clk_buf.i
delay = int(15e-6 * self.default_clk_frequency)

if self.default_rst is not None:
rst_i = self.request(self.default_rst).i
rst_io = self.request(self.default_rst, dir="-")
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
rst_i = rst_buf.i
else:
rst_i = Const(0)

Expand Down
11 changes: 8 additions & 3 deletions amaranth/vendor/_xilinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,11 +1144,16 @@ def create_missing_domain(self, name):
return super().create_missing_domain(name)

if name == "sync" and self.default_clk is not None:
clk_i = self.request(self.default_clk).i
m = Module()

clk_io = self.request(self.default_clk, dir="-")
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
clk_i = clk_buf.i
if self.default_rst is not None:
rst_i = self.request(self.default_rst).i
rst_io = self.request(self.default_rst, dir="-")
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
rst_i = rst_buf.i

m = Module()
ready = Signal()
m.submodules += Instance(STARTUP_PRIMITIVE[self.family], o_EOS=ready)
m.domains += ClockDomain("sync", reset_less=self.default_rst is None)
Expand Down