|
12 | 12 |
|
13 | 13 | from amaranth import * |
14 | 14 |
|
| 15 | +from . import StepBase, _wire_up_ports |
15 | 16 | from .. import ChipFlowError, _ensure_chipflow_root |
16 | | -from . import StepBase |
17 | 17 | from ..platforms import SimPlatform, top_interfaces |
18 | 18 | from ..platforms.utils import IOSignature |
19 | 19 | from ..platforms.sim import VARIABLES, TASKS, DOIT_CONFIG |
@@ -93,22 +93,7 @@ def build(self): |
93 | 93 | top, interfaces = top_interfaces(self._config) |
94 | 94 | logger.debug(f"SiliconTop top = {top}, interfaces={interfaces}") |
95 | 95 |
|
96 | | - for n, t in top.items(): |
97 | | - setattr(m.submodules, n, t) |
98 | | - |
99 | | - for component, iface in self._platform._pinlock.port_map.items(): |
100 | | - for iface_name, member, in iface.items(): |
101 | | - for name, port in member.items(): |
102 | | - iface = getattr(top[component], iface_name) |
103 | | - wire = (iface if isinstance(iface.signature, IOSignature) |
104 | | - else getattr(iface, name)) |
105 | | - port = self._platform._ports[port.port_name] |
106 | | - if hasattr(wire, 'i'): |
107 | | - m.d.comb += wire.i.eq(port.i) |
108 | | - for d in ['o', 'oe']: |
109 | | - if hasattr(wire, d): |
110 | | - m.d.comb += getattr(port, d).eq(getattr(wire, d)) |
111 | | - |
| 96 | + _wire_up_ports(m, top, self._platform) |
112 | 97 |
|
113 | 98 | #FIXME: common source for build dir |
114 | 99 | self._platform.build(m) |
|
0 commit comments