Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 1 file changed
  • 0 comments
  • 1 contributor

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

  1. 17  migen/fhdl/edif.py
17  migen/fhdl/edif.py
@@ -113,6 +113,8 @@ def _generate_cells(f):
113 113
 					port_list.append(_Port(port.name, "INPUT"))
114 114
 				elif isinstance(port, Instance.Output):
115 115
 					port_list.append(_Port(port.name, "OUTPUT"))
  116
+				elif isinstance(port, Instance.InOut):
  117
+					port_list.append(_Port(port.name, "INOUT"))
116 118
 				elif isinstance(port, Instance.Parameter):
117 119
 					pass
118 120
 				else:
@@ -136,6 +138,8 @@ def _generate_instances(f,ns):
136 138
 					pass
137 139
 				elif isinstance(prop, Instance.Output):
138 140
 					pass
  141
+				elif isinstance(prop, Instance.InOut):
  142
+					pass
139 143
 				elif isinstance(prop, Instance.Parameter):
140 144
 					props.append(_Property(name=prop.name, value=prop.value))
141 145
 				else:
@@ -147,9 +151,10 @@ def _generate_instances(f,ns):
147 151
 
148 152
 def _generate_ios(f, ios, ns):
149 153
 	outs = list_special_ios(f, False, True, False)
  154
+	inouts = list_special_ios(f, False, False, True)
150 155
 	r = []
151 156
 	for io in ios:
152  
-		direction = "OUTPUT" if io in outs else "INPUT"
  157
+		direction = "OUTPUT" if io in outs else "INOUT" if io in inouts else "INPUT"
153 158
 		r.append(_Port(name=ns.get_name(io), direction=direction))
154 159
 	return r
155 160
 
@@ -159,7 +164,7 @@ def _generate_connections(f, ios, ns):
159 164
 		if isinstance(special, Instance):
160 165
 			instname = ns.get_name(special)
161 166
 			for port in special.items:
162  
-				if isinstance(port, Instance.Input) or isinstance(port, Instance.Output):
  167
+				if isinstance(port, Instance._IO):
163 168
 					s = ns.get_name(port.expr)
164 169
 					if s not in r:
165 170
 						r[s] = []
@@ -177,7 +182,7 @@ def _generate_connections(f, ios, ns):
177 182
 		r[io].append(_NetBranch(portname=io, instancename=""))
178 183
 	return r
179 184
 
180  
-def convert(f, ios, name, cell_library, part, vendor):
  185
+def convert(f, ios, cell_library, vendor, device, name="top", return_ns=False):
181 186
 	if not isinstance(f, _Fragment):
182 187
 		f = f.get_fragment()
183 188
 	if f.comb != [] or f.sync != {}:
@@ -189,4 +194,8 @@ def convert(f, ios, name, cell_library, part, vendor):
189 194
 	instances = _generate_instances(f, ns)
190 195
 	inouts = _generate_ios(f, ios, ns)
191 196
 	connections = _generate_connections(f, ios, ns)
192  
-	return _write_edif(cells, inouts, instances, connections, cell_library, name, part, vendor)
  197
+	r =  _write_edif(cells, inouts, instances, connections, cell_library, name, device, vendor)
  198
+	if return_ns:
  199
+		return r, ns
  200
+	else:
  201
+		return r

No commit comments for this range

Something went wrong with that request. Please try again.