Skip to content

Commit 9df6792

Browse files
trabucayremaass-hamburg
authored andcommitted
build/altera/common,platform: added ddrinput/ddrout primitives
1 parent ba8830e commit 9df6792

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

litex/build/altera/common.py

+70-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def __init__(self, i1, i2, o, clk):
9999
o_dataout = o,
100100
)
101101

102-
103102
class AlteraDDROutput:
104103
@staticmethod
105104
def lower(dr):
@@ -147,3 +146,73 @@ def lower(dr):
147146
SDROutput: AlteraSDROutput,
148147
SDRInput: AlteraSDRInput,
149148
}
149+
150+
# Agilex5 DDROutput --------------------------------------------------------------------------------
151+
152+
class Agilex5DDROutputImpl(Module):
153+
def __init__(self, i1, i2, o, clk):
154+
self.specials += Instance("tennm_ph2_ddio_out",
155+
p_mode = "MODE_DDR",
156+
p_asclr_ena = "ASCLR_ENA_NONE",
157+
p_sclr_ena = "SCLR_ENA_NONE",
158+
o_dataout = o,
159+
i_datainlo = i2,
160+
i_datainhi = i1,
161+
i_clk = clk,
162+
i_ena = Constant(1, 1),
163+
i_areset = Constant(1, 1),
164+
i_sreset = Constant(1, 1),
165+
)
166+
167+
class Agilex5DDROutput:
168+
@staticmethod
169+
def lower(dr):
170+
return Agilex5DDROutputImpl(dr.i1, dr.i2, dr.o, dr.clk)
171+
172+
# Agilex5 DDRInput ---------------------------------------------------------------------------------
173+
174+
class Agilex5DDRInputImpl(Module):
175+
def __init__(self, i, o1, o2, clk):
176+
self.specials += Instance("tennm_ph2_ddio_in",
177+
p_mode = "MODE_DDR",
178+
p_asclr_ena = "ASCLR_ENA_NONE",
179+
p_sclr_ena = "SCLR_ENA_NONE",
180+
i_clk = clk,
181+
i_datain = i,
182+
o_regouthi = o1,
183+
o_regoutlo = o2,
184+
i_ena = Constant(1, 1),
185+
i_areset = Constant(1, 1),
186+
i_sreset = Constant(1, 1),
187+
)
188+
189+
class Agilex5DDRInput:
190+
@staticmethod
191+
def lower(dr):
192+
return Agilex5DDRInputImpl(dr.i, dr.o1, dr.o2, dr.clk)
193+
194+
# Agilex5 SDROutput --------------------------------------------------------------------------------
195+
196+
class Agilex5SDROutput:
197+
@staticmethod
198+
def lower(dr):
199+
return Agilex5DDROutputImpl(dr.i, dr.i, dr.o, dr.clk)
200+
201+
# Agilex5 SDRInput ---------------------------------------------------------------------------------
202+
203+
class Agilex5SDRInput:
204+
@staticmethod
205+
def lower(dr):
206+
return Agilex5DDRInputImpl(dr.i, dr.o, Signal(), dr.clk)
207+
208+
# Agilex5 Special Overrides ------------------------------------------------------------------------
209+
210+
agilex5_special_overrides = {
211+
AsyncResetSynchronizer: AlteraAsyncResetSynchronizer,
212+
DifferentialInput: AlteraDifferentialInput,
213+
DifferentialOutput: AlteraDifferentialOutput,
214+
DDROutput: Agilex5DDROutput,
215+
DDRInput: Agilex5DDRInput,
216+
SDROutput: Agilex5SDROutput,
217+
SDRInput: Agilex5SDRInput,
218+
}

litex/build/altera/platform.py

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def add_ip(self, filename):
3434

3535
def get_verilog(self, *args, special_overrides=dict(), **kwargs):
3636
so = dict(common.altera_special_overrides)
37+
if self.device[:3] == "A5E":
38+
so.update(common.agilex5_special_overrides)
3739
so.update(special_overrides)
3840
return GenericPlatform.get_verilog(self, *args,
3941
special_overrides = so,

0 commit comments

Comments
 (0)