Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
160e519a
Commit
160e519a
authored
2 years ago
by
Mikael Henriksson
Browse files
Options
Downloads
Patches
Plain Diff
codegen: add B-ASIC commit hash in VHDL preamble
parent
821b417f
Branches
codegen-commit-hash
No related tags found
1 merge request
!246
WIP: codegen: add B-ASIC commit hash in VHDL preamble
Pipeline
#91537
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/codegen/vhdl/common.py
+10
-0
10 additions, 0 deletions
b_asic/codegen/vhdl/common.py
with
10 additions
and
0 deletions
b_asic/codegen/vhdl/common.py
+
10
−
0
View file @
160e519a
...
...
@@ -4,6 +4,7 @@ Generation of common VHDL constructs
from
datetime
import
datetime
from
io
import
TextIOWrapper
from
subprocess
import
PIPE
,
Popen
from
typing
import
Any
,
Optional
,
Set
,
Tuple
from
b_asic.codegen.vhdl
import
VHDL_TAB
...
...
@@ -18,9 +19,18 @@ def write_b_asic_vhdl_preamble(f: TextIOWrapper):
f : :class:`io.TextIOWrapper`
The file object to write the header to.
"""
# Try to acquire the current git commit hash
git_commit_id
=
None
try
:
process
=
Popen
([
'
git
'
,
'
rev-parse
'
,
'
--short
'
,
'
HEAD
'
],
stdout
=
PIPE
)
git_commit_id
=
process
.
communicate
()[
0
].
decode
(
'
utf-8
'
).
strip
()
except
:
pass
f
.
write
(
f
'
--
\n
'
)
f
.
write
(
f
'
-- This code was automatically generated by the B-ASIC toolbox.
\n
'
)
f
.
write
(
f
'
-- Code generation timestamp: (
{
datetime
.
now
()
}
)
\n
'
)
if
git_commit_id
:
f
.
write
(
f
'
-- B-ASIC short commit hash:
{
git_commit_id
}
\n
'
)
f
.
write
(
f
'
-- URL: https://gitlab.liu.se/da/B-ASIC
\n
'
)
f
.
write
(
f
'
--
\n\n
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment