google / google/xls

cc_xls_ir_jit_wrapper block wrapper fails compilation if input is named "v"

Open
#2,462 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

**Describe the bug**
The jit wrapper creates struct member functions that have a fixed `v` input arg for the `xls::Value` to set on the port. If the block input port is itself named `v`, the wrapper fails compilation with:

```
error: no viable overloaded '='
23 | v = v;
| ~ ^ ~
./xls/ir/value.h:66:7: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const xls::Value', but method is not marked const
66 | class Value {
| ^
```

**To Reproduce**
Steps to reproduce the behavior:
Create a block wrapper for the following function:

https://github.com/google/xls/blob/3cd43faff52970f5ba899c930a1b16ebf416cc49/xls/dslx/tests/trace_fmt_issue_651/test_target.x#L24

Associated build targets:

```
xls_dslx_opt_ir(
name = "trace_u16_opt_ir",
dslx_top = "trace_u16",
library = ":test_target_library",
)

xls_ir_verilog(
name = "trace_u16_verilog",
src = ":trace_u16_opt_ir",
codegen_args = {
"module_name": "trace_u16",
"generator": "combinational",
},
verilog_file = "trace_u16.sv",
)

cc_xls_ir_jit_wrapper(
name = "trace_u16_block_ir_wrapper",
src = ":trace_u16.block.ir",
jit_wrapper_args = {
"class_name": "Trace_u16",
"namespace": "xls::wrapped",
},
top = "trace_u16",
wrapper_type = BLOCK_WRAPPER_TYPE,
)
```

**Expected behavior**
The arg should not collide with the struct member.

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.