[enhancement] Add `include_bytes!()` and/or `include_bits!()` macro for importing data from external files
- 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)
DSLX currently has no way to include data directly from external files. This creates extra complexity when working with large portions of data for test cases. In the future, it could also be useful for initializing RAM memory. Rust's `include_bytes!()` macro allows binary data to be imported as a byte array. DSLX could introduce a similar `include_bytes!()` macro, but going further, it could implement a more general `include_bits!()` macro.
### Current best alternative workaround (limit 100 words)
The current workaround is to define binary data in a separate file (e.g. as an array), and then import that file into the main module. This works, but it requires converting binary data into DSLX syntax manually or with external tools, which adds complexity and can introduce errors.
### Your view of the "best case XLS enhancement" (limit 100 words)
Introducing a `include_bytes!()` and/or parameterized `include_bits!()` in DSLX would allow convenient importing of binary files as arrays. This would reduce the complexity of analyzing code and eliminate the need for manual data conversion.
Possible syntax:
```rust
const TEST_DATA:u8[100] = include_bits!("data.bin");
```
Contributor guide
Assessment
This issue has not been assessed yet.