llvm / llvm/circt

[ImportVerilog] String casts to packed byte arrays fail

Open
#11,133 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

`circt-verilog --import-only` rejects a string cast to a multidimensional packed integral type, including inside an uncalled function:

```systemverilog
module top;
typedef bit [255:0][7:0] bytes_t;
function automatic bytes_t convert(string value);
return bytes_t'(value);
endfunction
endmodule
```

Run `circt-verilog --import-only --top=top string_cast.sv -o /dev/null`.

The importer reports:

```text
error: unsupported conversion from '!moore.string' to '!moore.array<256 x i8>'
```

This legal cast should import with the usual string packing, zero-padding, and truncation semantics. Both two-state and four-state packed arrays should be supported.

Assisted-by: Codex:GPT-6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with circt-verilog --import-only using the shown string_cast.sv example and trace the importer’s unsupported conversion diagnostic. Done means the legal string cast imports successfully with string packing, zero-padding, and truncation for both two-state and four-state packed arrays.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.