google / google/xls

VAST source correlation rewrite

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

Description

After 1a0fd8f59c6d37879b3fb82cc3e1b85065dd4bdc we now have support for relating each generated line of code back to the `VastNode*` that generated it. Unfortunately, because this was written in a time-sensitive way, it's written in a somewhat error-prone way that should be rewritten, especially since rewriting it in a less errorprone way would also allow tracking of column numbers.

Mark's description of how the rewritten version would work:

> I'm worried that the api for tracking lines is complicated and error prone. I think things would be easier if the emitted string were accumulated in LineInfo so LineInfo has all the information needed for precisely tracking location. LineInfo could have methods which take a string, or a node to emit into the accumulated string. Example implementation for Cover:
>
> ```
> std::string Cover::Emit(LineInfo* line_info) {
> line_info->Start(this);
> line_info->Append(absl::StrFormat(""%s: cover property (@(posedge ", label_));
> line_info->AppendNode(clk_); // calls clk_->Emit() under the hood.
> line_info->Append(") ");
> line_info->AppendNode(condition_)
> line_info->Append(")");
> return line_info->End(this); // produces accumulated string since Start(this).
> }
> ```
> I think you can imagine what the guts of the LineInfo methods might look like. This makes line tracking much more bullet proof. There no chance of a mismatch between emitted string and adjustment of line number. Also makes tracking columns easy too.

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.