2013-05-22 11:10:13 -04:00
|
|
|
from migen.fhdl.std import *
|
2012-02-17 05:04:44 -05:00
|
|
|
from migen.bus import dfi
|
|
|
|
|
2013-03-10 14:32:38 -04:00
|
|
|
class S6DDRPHY(Module):
|
2013-03-26 12:57:17 -04:00
|
|
|
def __init__(self, pads):
|
2013-05-22 11:10:13 -04:00
|
|
|
self.dfi = dfi.Interface(flen(pads.a), flen(pads.ba), 2*flen(pads.dq), 2)
|
2013-03-26 12:57:17 -04:00
|
|
|
self.clk4x_wr_strb = Signal()
|
|
|
|
self.clk4x_rd_strb = Signal()
|
|
|
|
|
|
|
|
###
|
|
|
|
|
2012-09-10 17:47:06 -04:00
|
|
|
inst_items = [
|
2013-05-22 11:10:13 -04:00
|
|
|
Instance.Parameter("NUM_AD", flen(pads.a)),
|
|
|
|
Instance.Parameter("NUM_BA", flen(pads.ba)),
|
|
|
|
Instance.Parameter("NUM_D", 2*flen(pads.dq)),
|
2013-03-26 12:57:17 -04:00
|
|
|
|
2013-03-18 12:44:01 -04:00
|
|
|
Instance.Input("sys_clk", ClockSignal()),
|
|
|
|
Instance.Input("clk2x_270", ClockSignal("sys2x_270")),
|
|
|
|
Instance.Input("clk4x_wr", ClockSignal("sys4x_wr")),
|
2013-03-26 12:57:17 -04:00
|
|
|
Instance.Input("clk4x_rd", ClockSignal("sys4x_rd")),
|
|
|
|
|
|
|
|
Instance.Input("clk4x_wr_strb", self.clk4x_wr_strb),
|
|
|
|
Instance.Input("clk4x_rd_strb", self.clk4x_rd_strb),
|
|
|
|
|
|
|
|
Instance.Output("sd_a", pads.a),
|
|
|
|
Instance.Output("sd_ba", pads.ba),
|
|
|
|
Instance.Output("sd_cs_n", pads.cs_n),
|
|
|
|
Instance.Output("sd_cke", pads.cke),
|
|
|
|
Instance.Output("sd_ras_n", pads.ras_n),
|
|
|
|
Instance.Output("sd_cas_n", pads.cas_n),
|
|
|
|
Instance.Output("sd_we_n", pads.we_n),
|
|
|
|
Instance.InOut("sd_dq", pads.dq),
|
|
|
|
Instance.Output("sd_dm", pads.dm),
|
|
|
|
Instance.InOut("sd_dqs", pads.dqs)
|
2012-09-10 17:47:06 -04:00
|
|
|
]
|
|
|
|
inst_items += [Instance.Input(name, signal)
|
|
|
|
for name, signal in self.dfi.get_standard_names(True, False)]
|
|
|
|
inst_items += [Instance.Output(name, signal)
|
|
|
|
for name, signal in self.dfi.get_standard_names(False, True)]
|
2013-03-10 14:32:38 -04:00
|
|
|
self.specials += Instance("s6ddrphy", *inst_items)
|