```python
from amaranth.back import verilog

foo = YourTopLevel()
ports = [foo.bar, foo.quux]

with open("output.v", "w") as f:
    f.write(verilog.convert(foo, ports=ports))
```
or so