google / google/xls

[XLScc] [__builtin_memcpy] a question about the reassignment of struct with array

Open
#919 1 comment 0 reactions 0 assignees View on GitHub
xlscc
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

When the member of the struct includes an array, the reassignment of this struct type data will get some errors when generating ir. There is an example:
```
#include "/xls_builtin.h"

struct array{
int a[3];
};

#pragma hls_top
array xls_f_4test_arraymul(array xls_v_a) {
array xls_v_r = {};
xls_v_r = xls_v_a;
return xls_v_r;
}

```
Below is error message:
```
root@applejar:/home/apple/xls# ./bazel-bin/xls/contrib/xlscc/xlscc ./example/test.c
Parsing file './example/test.c' with clang...
Generating IR...
NOT_FOUND: Function __builtin_memcpy used but has no body
--> ././example/test.c:3:8
|
3 | struct array{
| ^

```
If I change the top function to below, it can generate ir successfully.
```
array xls_f_4test_arraymul(array xls_v_a) {
array xls_v_r = xls_v_a;
return xls_v_r;
}
```
Maybe this is because array type is not assignable? And is there any other way to reassign arrays?

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.