Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CHIPKIT Flow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SoCLabs
CHIPKIT Flow
Commits
c5b3d81f
Unverified
Commit
c5b3d81f
authored
5 years ago
by
whatmough
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update RTL-Coding-Guidelines.md
parent
c0b561a1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/rtl-coding/RTL-Coding-Guidelines.md
+50
-1
50 additions, 1 deletion
tools/rtl-coding/RTL-Coding-Guidelines.md
with
50 additions
and
1 deletion
tools/rtl-coding/RTL-Coding-Guidelines.md
+
50
−
1
View file @
c5b3d81f
...
...
@@ -13,7 +13,7 @@ SV includes a number of more advanced language features that prevent a whole cla
This document outlines some coding guidelines for writing bug-free RTL in SV.
More generally, we offer advice for arranging RTL projects.
##
SystemVerilog RTL Coding Style
Overview
## Overview
SV is a very large language with many verification-oriented features that are not relevant to writing synthesizable RTL.
Therefore, we use a strict RTL coding style, which can be summarized in the following directives:
...
...
@@ -48,6 +48,7 @@ These significantly reduce the verbosity of connecting modules and provide addit
*
**Use all-caps for top-level module port signals.**
### Module Example
The following tiny RTL example module
`my_counter`
demonstrates some of these guidelines in a compact example.
...
...
@@ -97,6 +98,10 @@ end
`FF(count_next, count, clock, enable, reset_n, '0);
```
### SV Assertions
TODO
### Instantiated Library Components
Physical IP such as SRAMs, IO cells, clock oscillators, and synchronizers need to be instantiated in the RTL.
...
...
@@ -131,4 +136,48 @@ project
### RTL Module Logging
Opening waveforms should be a last resort during RTL development
Simulation is slower
Opening and working with a GUI is slow and clumsy
Printing signals from a block-level test bench is quite clumsy
Logging directly from an RTL module is a better approach
Wrap non-synthesizable debug code in ‘ifndef SYNTHESIS
Use reset signal to mask junk during reset
Can generate a lot of clutter in the simulation transcript
Even better is to log to file with module name
You know where to look for module specific debug data
Easy to parse in python to check against a model (especially datapath)
```
systemverilog
module my_module (
// …signals…
);
// Module body
// Logging code
`LOGF_INIT // This macro opens the log
`LOGF(clk, rstn, enable, format_expr)
`LOGF(clk, rstn,
iss.valid,
(”| %s | %s |”,iss.op,iss.data)
);
endmodule // my_module
```
```
systemverilog
// Macro prototype
`LOGF(clk, rstn, enable, format_expr)
```
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