5
5
from migen .fhdl .std import *
6
6
from mibuild .generic_platform import ConstraintError
7
7
8
- from misoclib .others import mxcrg
9
8
from misoclib .mem .sdram .module import MT46V32M16
10
9
from misoclib .mem .sdram .phy import s6ddrphy
11
10
from misoclib .mem .sdram .core .lasmicon import LASMIconSettings
18
17
from misoclib .com .liteeth .core .mac import LiteEthMAC
19
18
20
19
20
+ class _MXCRG (Module ):
21
+ def __init__ (self , pads , outfreq1x ):
22
+ self .clock_domains .cd_sys = ClockDomain ()
23
+ self .clock_domains .cd_sdram_half = ClockDomain ()
24
+ self .clock_domains .cd_sdram_full_wr = ClockDomain ()
25
+ self .clock_domains .cd_sdram_full_rd = ClockDomain ()
26
+ self .clock_domains .cd_base50 = ClockDomain (reset_less = True )
27
+
28
+ self .clk4x_wr_strb = Signal ()
29
+ self .clk4x_rd_strb = Signal ()
30
+
31
+ ###
32
+
33
+ infreq = 50 * 1000000
34
+ ratio = Fraction (outfreq1x )/ Fraction (infreq )
35
+ in_period = float (Fraction (1000000000 )/ Fraction (infreq ))
36
+
37
+ self .specials += Instance ("mxcrg" ,
38
+ Instance .Parameter ("in_period" , in_period ),
39
+ Instance .Parameter ("f_mult" , ratio .numerator ),
40
+ Instance .Parameter ("f_div" , ratio .denominator ),
41
+ Instance .Input ("clk50_pad" , pads .clk50 ),
42
+ Instance .Input ("trigger_reset" , pads .trigger_reset ),
43
+
44
+ Instance .Output ("sys_clk" , self .cd_sys .clk ),
45
+ Instance .Output ("sys_rst" , self .cd_sys .rst ),
46
+ Instance .Output ("clk2x_270" , self .cd_sdram_half .clk ),
47
+ Instance .Output ("clk4x_wr" , self .cd_sdram_full_wr .clk ),
48
+ Instance .Output ("clk4x_rd" , self .cd_sdram_full_rd .clk ),
49
+ Instance .Output ("base50_clk" , self .cd_base50 .clk ),
50
+
51
+ Instance .Output ("clk4x_wr_strb" , self .clk4x_wr_strb ),
52
+ Instance .Output ("clk4x_rd_strb" , self .clk4x_rd_strb ),
53
+ Instance .Output ("norflash_rst_n" , pads .norflash_rst_n ),
54
+ Instance .Output ("ddr_clk_pad_p" , pads .ddr_clk_p ),
55
+ Instance .Output ("ddr_clk_pad_n" , pads .ddr_clk_n ))
56
+
57
+
21
58
class _MXClockPads :
22
59
def __init__ (self , platform ):
23
60
self .clk50 = platform .request ("clk50" )
@@ -42,7 +79,7 @@ def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwa
42
79
sdram_controller_settings = sdram_controller_settings ,
43
80
** kwargs )
44
81
45
- self .submodules .crg = mxcrg . MXCRG (_MXClockPads (platform ), self .clk_freq )
82
+ self .submodules .crg = _MXCRG (_MXClockPads (platform ), self .clk_freq )
46
83
47
84
if not self .integrated_main_ram_size :
48
85
self .submodules .ddrphy = s6ddrphy .S6DDRPHY (platform .request ("ddram" ),
@@ -67,7 +104,7 @@ def __init__(self, platform, sdram_controller_settings=LASMIconSettings(), **kwa
67
104
INST "mxcrg/wr_bufpll" LOC = "BUFPLL_X0Y2";
68
105
INST "mxcrg/rd_bufpll" LOC = "BUFPLL_X0Y3";
69
106
""" )
70
- platform .add_source_dir (os .path .join ("misoclib" , "others " ))
107
+ platform .add_source (os .path .join ("misoclib" , "mxcrg.v " ))
71
108
72
109
73
110
class MiniSoC (BaseSoC ):
0 commit comments