llvm / llvm/circt

[FIRRTL] Make Grand Central YAML Output use Block Scalar Output

Open
#2,846 0 comments 0 reactions 0 assignees View on GitHub
FIRRTL good first issue
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Currently, Grand Central will output multiline YAML description strings as one line, e.g., `"foo\nbar\baz"`. However, the LLVM YAML library has support for instead emitting this in "block scala" format: https://llvm.org/docs/YamlIO.html#block-scalars. Change FIRRTL's Grand Central pass to do block scalar output of description strings for better readability of the output YAML.

Once implemented, this will change [this test](https://github.com/llvm/circt/blob/69f8394fb59d88ce976754352df020ecdeac743f/test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir#L363) from:

```yaml
- name: sub_vecOfBundle
description: "a vector of a bundle in the submodule with a\nmultiline comment"
dimensions: [ 2 ]
```

To something like:

```yaml
- name: sub_vecOfBundle
description: |-
a vector of a bundle in the submodule with a
multiline comment
dimensions: [ 2 ]
```

This should be implemented using LLVM's YAML library support for block scalars, i.e., this likely requires implementing `BlockScalarTraits` for all `X` that have a description that should have multiline output.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the FIRRTL Grand Central pass and the linked Wire.fir test, especially the YAML output around line 363. Read LLVM's YAML block scalar documentation and inspect the description-bearing types that the pass serializes. Done means multiline descriptions use block scalar output and the test expectation matches the new readable YAML form.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.