Improve conversion of DSLX structs to SystemVerilog - #4668
Draft
magancarz wants to merge 2 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request proposes an automatic way of converting DSLX structs to SystemVerilog by adding a struct type in IR. Using structs in SystemVerilog can be used to improve debugging experience of the codegen result and discussion about this topic was introduced in #1239.
DSLX structs could already be converted and used in SystemVerilog with the following workflow:
dslx_to_verilog_mainto generate SystemVerilog from DSLX types.sv_typeattribute to DSLX types user want to use in SystemVerilog.sv_types are used tocodegen_main.emit_sv_typesflag is set toTrueincodegen_main.Automatic generation of structs to SystemVerilog can be tested by building
structs_verilogtarget added with draft changes:It will generate a
bazel-bin/xls/examples/structs.svfile with struct definitions andSenderproc's codegen result with struct types used in channel ports.I've also added a commit 1178df45 which fixes handling of
sv_typeattribute with input/output ports in codegen as copying the system verilog type value was omitted in theBlock::Clone()function.TODO:
dslx_to_verilog_maindoes.unpackedtype as currently structs arepackedby default.