Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic generation of version control registers #13

Open
magnmaeh opened this issue Feb 14, 2024 · 0 comments
Open

Automatic generation of version control registers #13

magnmaeh opened this issue Feb 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@magnmaeh
Copy link
Member

All of our projects should contain automatically generated version control registers. This is probably easy to do in Python.

There is room for changes, but a suggestion for how it can be implemented is to generate a module like so:

module VersionCtrl (
    output[63:0] git_commit_hash,
    output[63:0] unix_build_time,
    output[8:0] version_major,
    output[8:0] version_minor,
    output[8:0] version_patch
);

    assign git_commit_hash = CONST;
    assign unix_build_time = CONST;
    assign version_major = CONST;
    assign version_minor = CONST;
    assign version_patch = CONST;

endmodule

where the CONST have to be replaced by actual values. For implementing this, look up how to get the current git commit, how to get the current unix time from your computer (https://www.unixtimestamp.com/), and finally look up how to fetch the git tag from a commit. (This assumes we use Semantic Versioning (https://semver.org/) and add them to our git tags.) If there is no git tag on the current commit, all three should be zero.

Also, if the commit is "dirty", i.e. there are local changes that git does not know about, the Python script should exit with error and tell the user to use a clean commit.

@magnmaeh magnmaeh added the enhancement New feature or request label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant