Skip to content

Commit eefca83

Browse files
wanda-phiwhitequark
authored andcommitted
build, vendor: use dir="-" in create_missing_domain.
Fixes #1402.
1 parent 9686da2 commit eefca83

File tree

6 files changed

+44
-15
lines changed

6 files changed

+44
-15
lines changed

amaranth/build/plat.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,22 @@ def create_missing_domain(self, name):
120120
# Many device families provide advanced primitives for tackling reset. If these exist,
121121
# they should be used instead.
122122
if name == "sync" and self.default_clk is not None:
123-
clk_i = self.request(self.default_clk).i
123+
m = Module()
124+
125+
clk_io = self.request(self.default_clk, dir="-")
126+
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
127+
124128
if self.default_rst is not None:
125-
rst_i = self.request(self.default_rst).i
129+
rst_io = self.request(self.default_rst, dir="-")
130+
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
131+
rst_i = rst_buf.i
126132
else:
127133
rst_i = Const(0)
128134

129-
m = Module()
130135
m.domains += ClockDomain("sync")
131-
m.d.comb += ClockSignal("sync").eq(clk_i)
136+
m.d.comb += ClockSignal("sync").eq(clk_buf.i)
132137
m.submodules.reset_sync = ResetSynchronizer(rst_i, domain="sync")
138+
133139
return m
134140

135141
def prepare(self, elaboratable, name="top", **kwargs):

amaranth/vendor/_gowin.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,14 @@ def create_missing_domain(self, name):
532532
o_OSCOUT=clk_i)
533533

534534
else:
535-
clk_i = self.request(self.default_clk).i
535+
clk_io = self.request(self.default_clk, dir="-")
536+
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
537+
clk_i = clk_buf.i
536538

537539
if self.default_rst is not None:
538-
rst_i = self.request(self.default_rst).i
540+
rst_io = self.request(self.default_rst, dir="-")
541+
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
542+
rst_i = rst_buf.i
539543
else:
540544
rst_i = Const(0)
541545

amaranth/vendor/_lattice.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -956,9 +956,14 @@ def create_missing_domain(self, name):
956956
o_HFCLKOUT=clk_i,
957957
)
958958
else:
959-
clk_i = self.request(self.default_clk).i
959+
clk_io = self.request(self.default_clk, dir="-")
960+
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
961+
clk_i = clk_buf.i
962+
960963
if self.default_rst is not None:
961-
rst_i = self.request(self.default_rst).i
964+
rst_io = self.request(self.default_rst, dir="-")
965+
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
966+
rst_i = rst_buf.i
962967
else:
963968
rst_i = Const(0)
964969

amaranth/vendor/_quicklogic.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from abc import abstractmethod
22

33
from ..hdl import *
4+
from ..lib import io
45
from ..lib.cdc import ResetSynchronizer
56
from ..build import *
67

@@ -172,10 +173,14 @@ def create_missing_domain(self, name):
172173
o_A=sys_clk0,
173174
o_Z=clk_i)
174175
else:
175-
clk_i = self.request(self.default_clk).i
176+
clk_io = self.request(self.default_clk, dir="-")
177+
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
178+
clk_i = clk_buf.i
176179

177180
if self.default_rst is not None:
178-
rst_i = self.request(self.default_rst).i
181+
rst_io = self.request(self.default_rst, dir="-")
182+
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
183+
rst_i = rst_buf.i
179184
else:
180185
rst_i = Const(0)
181186

amaranth/vendor/_siliconblue.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,15 @@ def create_missing_domain(self, name):
393393
delay = int(100e-6 * self.default_clk_frequency)
394394
# User-defined clock signal.
395395
else:
396-
clk_i = self.request(self.default_clk).i
396+
clk_io = self.request(self.default_clk, dir="-")
397+
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
398+
clk_i = clk_buf.i
397399
delay = int(15e-6 * self.default_clk_frequency)
398400

399401
if self.default_rst is not None:
400-
rst_i = self.request(self.default_rst).i
402+
rst_io = self.request(self.default_rst, dir="-")
403+
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
404+
rst_i = rst_buf.i
401405
else:
402406
rst_i = Const(0)
403407

amaranth/vendor/_xilinx.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1144,11 +1144,16 @@ def create_missing_domain(self, name):
11441144
return super().create_missing_domain(name)
11451145

11461146
if name == "sync" and self.default_clk is not None:
1147-
clk_i = self.request(self.default_clk).i
1147+
m = Module()
1148+
1149+
clk_io = self.request(self.default_clk, dir="-")
1150+
m.submodules.clk_buf = clk_buf = io.Buffer("i", clk_io)
1151+
clk_i = clk_buf.i
11481152
if self.default_rst is not None:
1149-
rst_i = self.request(self.default_rst).i
1153+
rst_io = self.request(self.default_rst, dir="-")
1154+
m.submodules.rst_buf = rst_buf = io.Buffer("i", rst_io)
1155+
rst_i = rst_buf.i
11501156

1151-
m = Module()
11521157
ready = Signal()
11531158
m.submodules += Instance(STARTUP_PRIMITIVE[self.family], o_EOS=ready)
11541159
m.domains += ClockDomain("sync", reset_less=self.default_rst is None)

0 commit comments

Comments
 (0)