Remove uses of pads, new constraints system
[litex.git] / milkymist / s6ddrphy / __init__.py
1 from migen.fhdl.structure import *
2 from migen.bus import dfi
3
4 class S6DDRPHY:
5 def __init__(self, a, ba, d):
6 ins = []
7 outs = []
8 inouts = []
9
10 for name, width, l in [
11 ("clk2x_270", 1, ins),
12 ("clk4x_wr", 1, ins),
13 ("clk4x_wr_strb", 1, ins),
14 ("clk4x_rd", 1, ins),
15 ("clk4x_rd_strb", 1, ins),
16
17 ("sd_clk_out_p", 1, outs),
18 ("sd_clk_out_n", 1, outs),
19 ("sd_a", a, outs),
20 ("sd_ba", ba, outs),
21 ("sd_cs_n", 1, outs),
22 ("sd_cke", 1, outs),
23 ("sd_ras_n", 1, outs),
24 ("sd_cas_n", 1, outs),
25 ("sd_we_n", 1, outs),
26 ("sd_dq", d//2, inouts),
27 ("sd_dm", d//16, outs),
28 ("sd_dqs", d//16, inouts)
29
30 ]:
31 s = Signal(BV(width), name=name)
32 setattr(self, name, s)
33 l.append((name, s))
34
35 self.dfi = dfi.Interface(a, ba, d, 2)
36 ins += self.dfi.get_standard_names(True, False)
37 outs += self.dfi.get_standard_names(False, True)
38
39 self._inst = Instance("s6ddrphy",
40 outs,
41 ins,
42 inouts,
43 [
44 ("NUM_AD", a),
45 ("NUM_BA", ba),
46 ("NUM_D", d)
47 ],
48 clkport="sys_clk")
49
50 def get_fragment(self):
51 return Fragment(instances=[self._inst])