google / google/xls

Index-based accessors in generated cc_xls_ir_jit_wrapper API for arrayed channels

Open
#1,985 0 comments 0 reactions 0 assignees View on GitHub
enhancement ux 🧦 sox
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

### What's hard to do? (limit 100 words)

If you have channel arrays in DSLX (#704), they are unrolled into totally distinct channels in the XLS IR. cc_xls_ir_jit_wrapper for both proc and block wrapper types will then generate accessors (send/receive, set/get) where the index is embedded in the function name.

If the size of the array is large, this becomes quite tedious since you can't loop over the channel/port in C++.

### Current best alternative workaround (limit 100 words)

There may be some preprocessor tricks like BOOST_PP_REPEAT that could help. Or you can type out a few calls manually and hope your IDE code completion kicks in.

### Your view of the "best case XLS enhancement" (limit 100 words)

@allight had the following comments:

> Yeah to be more specific ir_converter_main generates a [xls/ir/xls_ir_interface.proto](https://github.com/google/xls/blob/9e20eb22061e9120ad3985d52afe450e7664320f/xls/ir/xls_ir_interface.proto) proto which contains some metadata about the package. It could be augmented to note somewhere that some collection of channels are actually all in an array and in a particular order. If you further augmented codegen_main to do something similar for ports you could then extend the aot generator to make accessors for the port/channel using array index.
>
> This would be a rather tedious (though not espcially difficult) project.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.