How to update signals list
Harnice defines a signals list to be a table that keeps track of every single signal going into and out of a device, which connector or channel it's part of, which signal names it has, which connector contact number or part number it has.
To generate build.py from a pinout, ICD, datasheet, or spreadsheet, paste the Device signals list prompt on Building with AI. Put the source file in the device revision folder (next to build.py) or give the agent that path.
- If your device is very simple (has only a small number of signals), you are free to edit
fileio.path("signals list")manually. If you choose to do this, deletefileio.path("build instructions")before clicking Build again, because the script will overwrite the signals list. However, it is recommended that you edit the Python build instructions instead to produce a validated, reproduceable, and portable result. - To edit the build instructions Python file, this quick-start guide should give you an idea of how the default script is set up, and how you might be able to change it to suit your needs. The goal of this file is to make a signals list. Do not be concerned with writing this efficiently, as it will only be ran while building the device.
- List, utility, and channel-type modules (
signals_list,chtype, and the rest) are already available in the script — you do not need to import them from harnice. - Copy your channel_type touples in from earlier notepad step. Again, these are relevant only to the device you're trying to make. The dictionary is used to store these here so that you can reference the touples in a human-readable format in this script only.
ch_type_ids = {"in": (1, "https://github.com/harnice/harnice-general-library"),"out": (4, "https://github.com/harnice/harnice-general-library"),"chassis": (5, "https://github.com/harnice/harnice-general-library")} -
Define your pinouts. Default convention is this dictionary, where if you reference something like
xlr_pinout.pos, this dictionary should return the cavity name. A channel type is electrical information only and must not specify a connector type, a pinout, or a part number. Put the cavity map and the connector part number on the device. The same electrical channel on two connectors still uses one channel type. If you use the same pinout across multiple devices, you may consider importing that definition from a python library elsewhere.xlr_pinout = {"pos": 2,"neg": 3,"chassis": 1}-
Define your connector part numbers. Default convention is this dictionary, where you can resolve the part number by finding the connector name.
mpn_for_connector(connector_name)will search your definition dictionary for a connector name and return its part number.connector_mpns = {"XLR3F": ["in1", "in2"],"XLR3M": ["out1", "out2"]} -
signals_list.new()will overwrite the existing signals list with a blank one, which will be repopulated while the rest of this script is executed. - Bespoke logic should be written in python for the remainder of this script, making use of patterns and naming conventions of this specific device.
- I'd recommend you use a python editor on your screen at the same time as a csv editor that automatically refreshes (vscode, easycsveditor on the mac store) so that you can update your python, run builds frequently, and watch the updates in realtime on your csv
-
- List, utility, and channel-type modules (