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