Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 13 additions and 4 deletions.
  1. +13 −4 migen/fhdl/edif.py
View
17 migen/fhdl/edif.py
@@ -113,6 +113,8 @@ def _generate_cells(f):
port_list.append(_Port(port.name, "INPUT"))
elif isinstance(port, Instance.Output):
port_list.append(_Port(port.name, "OUTPUT"))
+ elif isinstance(port, Instance.InOut):
+ port_list.append(_Port(port.name, "INOUT"))
elif isinstance(port, Instance.Parameter):
pass
else:
@@ -136,6 +138,8 @@ def _generate_instances(f,ns):
pass
elif isinstance(prop, Instance.Output):
pass
+ elif isinstance(prop, Instance.InOut):
+ pass
elif isinstance(prop, Instance.Parameter):
props.append(_Property(name=prop.name, value=prop.value))
else:
@@ -147,9 +151,10 @@ def _generate_instances(f,ns):
def _generate_ios(f, ios, ns):
outs = list_special_ios(f, False, True, False)
+ inouts = list_special_ios(f, False, False, True)
r = []
for io in ios:
- direction = "OUTPUT" if io in outs else "INPUT"
+ direction = "OUTPUT" if io in outs else "INOUT" if io in inouts else "INPUT"
r.append(_Port(name=ns.get_name(io), direction=direction))
return r
@@ -159,7 +164,7 @@ def _generate_connections(f, ios, ns):
if isinstance(special, Instance):
instname = ns.get_name(special)
for port in special.items:
- if isinstance(port, Instance.Input) or isinstance(port, Instance.Output):
+ if isinstance(port, Instance._IO):
s = ns.get_name(port.expr)
if s not in r:
r[s] = []
@@ -177,7 +182,7 @@ def _generate_connections(f, ios, ns):
r[io].append(_NetBranch(portname=io, instancename=""))
return r
-def convert(f, ios, name, cell_library, part, vendor):
+def convert(f, ios, cell_library, vendor, device, name="top", return_ns=False):
if not isinstance(f, _Fragment):
f = f.get_fragment()
if f.comb != [] or f.sync != {}:
@@ -189,4 +194,8 @@ def convert(f, ios, name, cell_library, part, vendor):
instances = _generate_instances(f, ns)
inouts = _generate_ios(f, ios, ns)
connections = _generate_connections(f, ios, ns)
- return _write_edif(cells, inouts, instances, connections, cell_library, name, part, vendor)
+ r = _write_edif(cells, inouts, instances, connections, cell_library, name, device, vendor)
+ if return_ns:
+ return r, ns
+ else:
+ return r

No commit comments for this range

Something went wrong with that request. Please try again.