mibuild/platforms: use add_period_constraint
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 19 May 2014 10:03:26 +0000 (12:03 +0200)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Wed, 21 May 2014 19:02:06 +0000 (21:02 +0200)
mibuild/platforms/de0nano.py
mibuild/platforms/lx9_microboard.py
mibuild/platforms/m1.py
mibuild/platforms/mixxeo.py
mibuild/platforms/papilio_pro.py
mibuild/platforms/zedboard.py
mibuild/platforms/ztex_115d.py

index 6cd199f44ffc9f243157dcf91cc65299361ca0c7..b0906528de587c9bd2410caeac508abb0ba7f608 100644 (file)
@@ -92,4 +92,10 @@ _io = [
 class Platform(AlteraQuartusPlatform):
        def __init__(self):
                AlteraQuartusPlatform.__init__(self, "EP4CE22F17C6", _io,
-                       lambda p: CRG_SE(p, "clk50", "key", 20.0, True))
+                       lambda p: CRG_SE(p, "clk50", None))
+
+       def do_finalize(self, fragment):
+               try:
+                       self.add_period_constraint(self.lookup_request("clk50"), 20)
+               except ConstraintError:
+                       pass
index 84ee5ae262635c1f61b2b107113abf4f5db0d63f..70072a06f8792099c7145c9dc17ec37fa33b7043 100644 (file)
@@ -115,22 +115,17 @@ CONFIG VCCAUX = "3.3";
 
        def do_finalize(self, fragment):
                try:
-                       self.add_platform_command("""
-NET "{clk_y3}" TNM_NET = "GRPclky3";
-TIMESPEC "TSclky3" = PERIOD "GRPclky3" 10 ns HIGH 50%;
-""", clk_y3=self.lookup_request("clk_y3"))
+                       self.add_period_constraint(self.lookup_request("clk_y3"), 10)
                except ConstraintError:
                        pass
 
                try:
                        eth_clocks = self.lookup_request("eth_clocks")
+                       self.add_period_constraint(eth_clocks.rx, 40)
+                       self.add_period_constraint(eth_clocks.tx, 40)
                        self.add_platform_command("""
-NET "{phy_rx_clk}" TNM_NET = "GRPphy_rx_clk";
-NET "{phy_tx_clk}" TNM_NET = "GRPphy_tx_clk";
-TIMESPEC "TSphy_rx_clk" = PERIOD "GRPphy_rx_clk" 40 ns HIGH 50%;
-TIMESPEC "TSphy_tx_clk" = PERIOD "GRPphy_tx_clk" 40 ns HIGH 50%;
-TIMESPEC "TSphy_tx_clk_io" = FROM "GRPphy_tx_clk" TO "PADS" 10 ns;
-TIMESPEC "TSphy_rx_clk_io" = FROM "PADS" TO "GRPphy_rx_clk" 10 ns;
+TIMESPEC "TS{phy_tx_clk}_io" = FROM "GRP{phy_tx_clk}" TO "PADS" 10 ns;
+TIMESPEC "TS{phy_rx_clk}_io" = FROM "PADS" TO "GRP{phy_rx_clk}" 10 ns;
 """, phy_rx_clk=eth_clocks.rx, phy_tx_clk=eth_clocks.tx)
                except ContraintError:
                        pass
index ef89b4ed0048a18e82f1fa247d0f795f73a20b90..094659a13baac8540aa24bbbd438080b2ae065a2 100644 (file)
@@ -123,22 +123,17 @@ class Platform(XilinxISEPlatform):
 
        def do_finalize(self, fragment):
                try:
-                       self.add_platform_command("""
-NET "{clk50}" TNM_NET = "GRPclk50";
-TIMESPEC "TSclk50" = PERIOD "GRPclk50" 20 ns HIGH 50%;
-""", clk50=self.lookup_request("clk50"))
+                       self.add_period_constraint(self.lookup_request("clk50"), 20)
                except ConstraintError:
                        pass
 
                try:
                        eth_clocks = self.lookup_request("eth_clocks")
+                       self.add_period_constraint(eth_clocks.rx, 40)
+                       self.add_period_constraint(eth_clocks.tx, 40)
                        self.add_platform_command("""
-NET "{phy_rx_clk}" TNM_NET = "GRPphy_rx_clk";
-NET "{phy_tx_clk}" TNM_NET = "GRPphy_tx_clk";
-TIMESPEC "TSphy_rx_clk" = PERIOD "GRPphy_rx_clk" 40 ns HIGH 50%;
-TIMESPEC "TSphy_tx_clk" = PERIOD "GRPphy_tx_clk" 40 ns HIGH 50%;
-TIMESPEC "TSphy_tx_clk_io" = FROM "GRPphy_tx_clk" TO "PADS" 10 ns;
-TIMESPEC "TSphy_rx_clk_io" = FROM "PADS" TO "GRPphy_rx_clk" 10 ns;
+TIMESPEC "TS{phy_tx_clk}_io" = FROM "GRP{phy_tx_clk}" TO "PADS" 10 ns;
+TIMESPEC "TS{phy_rx_clk}_io" = FROM "PADS" TO "GRP{phy_rx_clk}" 10 ns;
 """, phy_rx_clk=eth_clocks.rx, phy_tx_clk=eth_clocks.tx)
                except ConstraintError:
                        pass
@@ -146,10 +141,6 @@ TIMESPEC "TSphy_rx_clk_io" = FROM "PADS" TO "GRPphy_rx_clk" 10 ns;
                for i in range(2):
                        si = "dviclk"+str(i)
                        try:
-                               self.add_platform_command("""
-NET "{dviclk}" TNM_NET = "GRP"""+si+"""";
-NET "{dviclk}" CLOCK_DEDICATED_ROUTE = FALSE;
-TIMESPEC "TS"""+si+"""" = PERIOD "GRP"""+si+"""" 26.7 ns HIGH 50%;
-""", dviclk=self.lookup_request("dvi_in", i).clk)
+                               self.add_period_constraint(self.lookup_request("dvi_in", i).clk, 26.7)
                        except ConstraintError:
                                pass
index 12b242fb806960786647534fadbc7105c132af92..bdc80698a342cdd3dca4f7d0921ef0ca117a5aa7 100644 (file)
@@ -160,32 +160,23 @@ class Platform(XilinxISEPlatform):
 
        def do_finalize(self, fragment):
                try:
-                       self.add_platform_command("""
-NET "{clk50}" TNM_NET = "GRPclk50";
-TIMESPEC "TSclk50" = PERIOD "GRPclk50" 20 ns HIGH 50%;
-""", clk50=self.lookup_request("clk50"))
+                       self.add_period_constraint(self.lookup_request("clk50"), 20)
                except ConstraintError:
                        pass
 
                try:
                        eth_clocks = self.lookup_request("eth_clocks")
+                       self.add_period_constraint(eth_clocks.rx, 40)
+                       self.add_period_constraint(eth_clocks.tx, 40)
                        self.add_platform_command("""
-NET "{phy_rx_clk}" TNM_NET = "GRPphy_rx_clk";
-NET "{phy_tx_clk}" TNM_NET = "GRPphy_tx_clk";
-TIMESPEC "TSphy_rx_clk" = PERIOD "GRPphy_rx_clk" 40 ns HIGH 50%;
-TIMESPEC "TSphy_tx_clk" = PERIOD "GRPphy_tx_clk" 40 ns HIGH 50%;
-TIMESPEC "TSphy_tx_clk_io" = FROM "GRPphy_tx_clk" TO "PADS" 10 ns;
-TIMESPEC "TSphy_rx_clk_io" = FROM "PADS" TO "GRPphy_rx_clk" 10 ns;
+TIMESPEC "TS{phy_tx_clk}_io" = FROM "GRP{phy_tx_clk}" TO "PADS" 10 ns;
+TIMESPEC "TS{phy_rx_clk}_io" = FROM "PADS" TO "GRP{phy_rx_clk}" 10 ns;
 """, phy_rx_clk=eth_clocks.rx, phy_tx_clk=eth_clocks.tx)
                except ConstraintError:
                        pass
 
                for i in range(4):
-                       si = "dviclk"+str(i)
                        try:
-                               self.add_platform_command("""
-NET "{dviclk}" TNM_NET = "GRP"""+si+"""";
-TIMESPEC "TS"""+si+"""" = PERIOD "GRP"""+si+"""" 12.00 ns HIGH 50%;
-""", dviclk=self.lookup_request("dvi_in", i).clk_p)
+                               self.add_period_constraint(self.lookup_request("dvi_in", i).clk_p, 12)
                        except ConstraintError:
                                pass
index 876e995b64a836e13e795956d7a8ac2b45e0df29..9b20530bd3900a6796c6d132d2a6c4bf986cbb17 100644 (file)
@@ -54,9 +54,6 @@ class Platform(XilinxISEPlatform):
 
        def do_finalize(self, fragment):
                try:
-                       self.add_platform_command("""
-NET "{clk32}" TNM_NET = "GRPclk32";
-TIMESPEC "TSclk32" = PERIOD "GRPclk32" 31.25 ns HIGH 50%;
-""", clk32=self.lookup_request("clk32"))
+                       self.add_period_constraint(self.lookup_request("clk32"), 31.25)
                except ConstraintError:
                        pass
index 2d99fd0b61803f096e028198238d0378afa016b2..8d6d7f3d573e1760b882cbc021c4647619edb197 100644 (file)
@@ -143,9 +143,6 @@ class Platform(XilinxISEPlatform):
 
        def do_finalize(self, fragment):
                try:
-                       self.add_platform_command("""
-NET "{clk100}" TNM_NET = "GRPclk100";
-TIMESPEC "TSclk100" = PERIOD "GRPclk100" 10 ns HIGH 50%;
-""", clk100=self.lookup_request("clk100"))
+                       self.add_period_constraint(self.lookup_request("clk100"), 10)
                except ConstraintError:
                        pass
index 8889b1d5abddd45616a3df60c4ff4de0bd40cc12..ae488f8b0d9fad15f62ef57b439c0bf3286b4eb5 100644 (file)
@@ -90,10 +90,7 @@ CONFIG VCCAUX = "2.5";
 
        def do_finalize(self, fragment):
                try:
-                       self.add_platform_command("""
-NET "{clk_if}" TNM_NET = "GRPclkif";
-TIMESPEC "TSclkif" = PERIOD "GRPclkif" 20 ns HIGH 50%;
-""", clk_if=self.lookup_request("clk_if"))
+                       self.add_period_constraint(self.lookup_request("clk_if"), 20)
                except ConstraintError:
                        pass