xls icon indicating copy to clipboard operation
xls copied to clipboard

VAST source correlation rewrite

Open taktoa opened this issue 2 years ago • 0 comments

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.

taktoa avatar Mar 18 '22 17:03 taktoa