Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/nmigen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 52f36025a918
Choose a base ref
...
head repository: m-labs/nmigen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 905920aa76b1
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Sep 30, 2019

  1. rpc: add public Records as module ports.

    Jean-François Nguyen authored and whitequark committed Sep 30, 2019
    Copy the full SHA
    905920a View commit details
Showing with 7 additions and 8 deletions.
  1. +7 −8 nmigen/rpc.py
15 changes: 7 additions & 8 deletions nmigen/rpc.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
import argparse
import importlib

from .hdl import Signal, Elaboratable
from .hdl import Signal, Record, Elaboratable
from .back import rtlil


@@ -68,13 +68,12 @@ def _serve_yosys(modules):

try:
elaboratable = modules[module_name](*args, **kwargs)
def has_port(elaboratable, port_name):
# By convention, any public attribute that is a Signal is considered a port.
return (not port_name.startswith("_") and
isinstance(getattr(elaboratable, port_name), Signal))
ports = [getattr(elaboratable, port_name)
for port_name in dir(elaboratable)
if has_port(elaboratable, port_name)]
ports = []
# By convention, any public attribute that is a Signal or a Record is
# considered a port.
for port_name, port in vars(elaboratable).items():
if not port_name.startswith("_") and isinstance(port, (Signal, Record)):
ports += port._lhs_signals()
rtlil_text = rtlil.convert(elaboratable, name=module_name, ports=ports)
response = {"frontend": "ilang", "source": rtlil_text}
except Exception as error: