Skip to content

Commit e270eb9

Browse files
committed
wip
1 parent cda02c0 commit e270eb9

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

chipflow_lib/platforms/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from enum import Enum, IntEnum, StrEnum, auto
1414
from math import ceil, floor
1515
from typing import (
16-
Any, Annotated, NamedTuple, Self, Iterator, Type,
16+
Any, Annotated, NamedTuple, Self, Type,
1717
TYPE_CHECKING
1818
)
1919
from typing_extensions import (

chipflow_lib/platforms/sim.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__(self, config):
2626
self.sim_boxes = dict()
2727
self._ports = {}
2828
self._config = config
29+
self._top_sim = {}
2930

3031
def add_file(self, filename, content):
3132
if not isinstance(content, (str, bytes)):
@@ -67,6 +68,10 @@ def build(self, e):
6768
print("read_rtlil sim_soc.il", file=yosys_file)
6869
print("hierarchy -top sim_top", file=yosys_file)
6970
print("write_cxxrtl -header sim_soc.cc", file=yosys_file)
71+
main = Path(self.build_dir) / "main.cc"
72+
with open(main, "w") as main_file:
73+
for p in self._ports:
74+
print(p, file=main_file)
7075

7176
def instantiate_ports(self, m: Module):
7277
if hasattr(self, "_pinlock"):
@@ -76,10 +81,9 @@ def instantiate_ports(self, m: Module):
7681
for component, iface in pinlock.port_map.ports.items():
7782
for k, v in iface.items():
7883
for name, port_desc in v.items():
79-
logger.debug(f"Instantiating port {port_desc.port_name}: {port_desc}")
80-
invert = port_desc.invert if port_desc.invert else False
81-
self._ports[port_desc.port_name] = io.SimulationPort(port_desc.direction, port_desc.width, invert=invert, name=port_desc.port_name)
82-
84+
logger.debug(f"Instantiating port {port_desc.port_name}: {port_desc}")
85+
invert = port_desc.invert if port_desc.invert else False
86+
self._ports[port_desc.port_name] = io.SimulationPort(port_desc.direction, port_desc.width, invert=invert, name=port_desc.port_name)
8387
for clock in pinlock.port_map.get_clocks():
8488
assert 'clock_domain' in clock.iomodel
8589
domain = clock.iomodel['clock_domain']

0 commit comments

Comments
 (0)