svd2rust icon indicating copy to clipboard operation
svd2rust copied to clipboard

HDL to SVD?

Open rmsyn opened this issue 2 years ago • 2 comments

I'm interested in creating a PAC crate for a chip that only seems to have RTL files available (https://github.com/T-head-Semi/openc910).

Is there any way to convert these files to SVD, and then use svd2rust to generate the PAC crate?

I know they are different purpose-built levels of abstraction, just hoping to not have to wait for the vendor to release SVD files.

Apologies if this is a noobish question that is obvious to others in this community.

rmsyn avatar Jul 18 '23 02:07 rmsyn

I don't think there's any general-purpose existing thing, because the RTL will be quite different for each chip. Some RTL generators like LiteX can output suitable metadata automatically, but if you don't already have that you'll probably have to write something to parse that specific chip's RTL and emit an SVD.

adamgreig avatar Jul 18 '23 18:07 adamgreig

Some RTL generators like LiteX can output suitable metadata automatically, but if you don't already have that you'll probably have to write something to parse that specific chip's RTL and emit an SVD.

Looks like I just got another project to work on :sweat_smile: Thanks for the advice, I'll start working on something.

Edit: Small update, after looking into HTL-to-SVD translation, it seems to require annotating the HDL files to get the required info for SVD.

Ultimately, I don't think it's worth the effort, so I've transitioned to expanding SiFive's cmsis-svd-generator tool. Since a lot of these hardware vendors have some form of u-boot/linux support, the included DTS files seem like a better starting point. Especially when the vendors supply register information for board peripherals.

rmsyn avatar Jul 19 '23 02:07 rmsyn