Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

cif.py: use format instead of % in get_sdram_phy_header

  • Loading branch information...
commit d3bbbded0fc0baf93d7c5583fe0a179644c3a796 1 parent a7a7cc0
EnjoyDigital authored July 11, 2013 sbourdeauducq committed July 11, 2013

Showing 1 changed file with 14 additions and 14 deletions. Show diff stats Hide diff stats

  1. 28  milkymist/cif.py
28  milkymist/cif.py
@@ -113,14 +113,14 @@ def get_sdram_phy_header(sdram_phy):
113 113
 		}
114 114
 
115 115
 		def gen_cmd(comment, a, ba, cmd, delay):	
116  
-			r = "\t/* %s */\n" %comment
117  
-			r += "\tdfii_pi0_address_write(0x%04X);\n" %a
118  
-			r += "\tdfii_pi0_baddress_write(%d);\n" %ba
  116
+			r = "\t/* {0} */\n".format(comment)
  117
+			r += "\tdfii_pi0_address_write({0:#x});\n".format(a)
  118
+			r += "\tdfii_pi0_baddress_write({0:d});\n".format(ba)
119 119
 			if "CKE" in cmd:
120  
-				r += "\tdfii_control_write(%s);\n" %cmd
  120
+				r += "\tdfii_control_write({0});\n".format(cmd)
121 121
 			else:
122  
-				r += "\tcommand_p0(%s);\n" %cmd
123  
-			r += "\tcdelay(%d);\n" %delay
  122
+				r += "\tcommand_p0({0});\n".format(cmd)
  123
+			r += "\tcdelay({0:d});\n".format(delay)
124 124
 			r += "\n"
125 125
 			return r
126 126
 
@@ -137,10 +137,10 @@ def gen_cmd(comment, a, ba, cmd, delay):
137 137
 			init_sequence = [
138 138
 				("Bring CKE high", 0x0000, 0, cmds["CKE"], 2000),
139 139
 				("Precharge All",  0x0400, 0, cmds["PRECHARGE_ALL"], 0),
140  
-				("Load Mode Register / Reset DLL, CL=%d, BL=%d" %(cl, bl), mr + reset_dll, 0, cmds["MODE_REGISTER"], 200),
  140
+				("Load Mode Register / Reset DLL, CL={0:d}, BL={1:d}".format(cl, bl), mr + reset_dll, 0, cmds["MODE_REGISTER"], 200),
141 141
 				("Precharge All", 0x0400, 0, cmds["PRECHARGE_ALL"], 0),
142 142
 				("Auto Refresh", 0x0, 0, cmds["AUTO_REFRESH"], 4),
143  
-				("Load Mode Register / CL=%d, BL=%d" %(cl, bl), mr, 0, cmds["MODE_REGISTER"], 200)
  143
+				("Load Mode Register / CL={0:d}, BL={1:d}".format(cl, bl), mr, 0, cmds["MODE_REGISTER"], 200)
144 144
 			]
145 145
 
146 146
 		elif sdram_phy.phy_settings.type == "DDR":
@@ -153,10 +153,10 @@ def gen_cmd(comment, a, ba, cmd, delay):
153 153
 				("Bring CKE high", 0x0000, 0, cmds["CKE"], 2000),
154 154
 				("Precharge All",  0x0400, 0, cmds["PRECHARGE_ALL"], 0),
155 155
 				("Load Extended Mode Register", emr, 1, cmds["MODE_REGISTER"], 0),
156  
-				("Load Mode Register / Reset DLL, CL=%d, BL=%d" %(cl, bl), mr + reset_dll, 0, cmds["MODE_REGISTER"], 200),
  156
+				("Load Mode Register / Reset DLL, CL={0:d}, BL={1:d}".format(cl, bl), mr + reset_dll, 0, cmds["MODE_REGISTER"], 200),
157 157
 				("Precharge All", 0x0400, 0, cmds["PRECHARGE_ALL"], 0),
158 158
 				("Auto Refresh", 0x0, 0, cmds["AUTO_REFRESH"], 4),
159  
-				("Load Mode Register / CL=%d, BL=%d" %(cl, bl), mr, 0, cmds["MODE_REGISTER"], 200)
  159
+				("Load Mode Register / CL={0:d}, BL={1:d}".format(cl, bl), mr, 0, cmds["MODE_REGISTER"], 200)
160 160
 			]
161 161
 
162 162
 		elif sdram_phy.phy_settings.type == "LPDDR":
@@ -169,10 +169,10 @@ def gen_cmd(comment, a, ba, cmd, delay):
169 169
 				("Bring CKE high", 0x0000, 0, cmds["CKE"], 2000),
170 170
 				("Precharge All",  0x0400, 0, cmds["PRECHARGE_ALL"], 0),
171 171
 				("Load Extended Mode Register", emr, 2, cmds["MODE_REGISTER"], 0),
172  
-				("Load Mode Register / Reset DLL, CL=%d, BL=%d" %(cl, bl), mr + reset_dll, 0, cmds["MODE_REGISTER"], 200),
  172
+				("Load Mode Register / Reset DLL, CL={0:d}, BL={1:d}".format(cl, bl), mr + reset_dll, 0, cmds["MODE_REGISTER"], 200),
173 173
 				("Precharge All", 0x0400, 0, cmds["PRECHARGE_ALL"], 0),
174 174
 				("Auto Refresh", 0x0, 0, cmds["AUTO_REFRESH"], 4),
175  
-				("Load Mode Register / CL=%d, BL=%d" %(cl, bl), mr, 0, cmds["MODE_REGISTER"], 200)
  175
+				("Load Mode Register / CL={0:d}, BL={1:d}".format(cl, bl), mr, 0, cmds["MODE_REGISTER"], 200)
176 176
 			]
177 177
 
178 178
 		elif sdram_phy.phy_settings.type == "DDR2":
@@ -185,10 +185,10 @@ def gen_cmd(comment, a, ba, cmd, delay):
185 185
 				("Bring CKE high", 0x0000, 0, cmds["CKE"], 2000),
186 186
 				("Precharge All",  0x0400, 0, cmds["PRECHARGE_ALL"], 0),
187 187
 				("Load Extended Mode Register", emr, 1, cmds["MODE_REGISTER"], 0),
188  
-				("Load Mode Register / Reset DLL, CL=%d, BL=%d" %(cl, bl), mr + reset_dll, 0, cmds["MODE_REGISTER"], 200),
  188
+				("Load Mode Register / Reset DLL, CL={0:d}, BL={1:d}".format(cl, bl), mr + reset_dll, 0, cmds["MODE_REGISTER"], 200),
189 189
 				("Precharge All", 0x0400, 0, cmds["PRECHARGE_ALL"], 0),
190 190
 				("Auto Refresh", 0x0, 0, cmds["AUTO_REFRESH"], 4),
191  
-				("Load Mode Register / CL=%d, BL=%d" %(cl, bl), mr, 0, cmds["MODE_REGISTER"], 200)
  191
+				("Load Mode Register / CL={0:d}, BL={1:d}".format(cl, bl), mr, 0, cmds["MODE_REGISTER"], 200)
192 192
 			]
193 193
 
194 194
 		for comment, a, ba, cmd, delay in init_sequence:

0 notes on commit d3bbbde

Please sign in to comment.
Something went wrong with that request. Please try again.