Features
In this chapter, we introduce the features of Veryl along with clear examples.
- Real-time diagnostics
- Auto formatting
- Integrated test
- Dependency management
- Generics
- Clock Domain Annotation
- Trailing comma
- Abstraction of clock and reset
- Documentation comment
- Compound assignment operator in
always_ff
- Individual namespace of enum variant
repeat
of concatenationif
/case
expression- Range-based
for
/inside
/outside
msb
notationlet
statement- Named block
- Visibility control
Real-time diagnostics
Issues such as undefined, unused, or unassigned variables are notified in real-time while editing in the editor.
In the following example, adding the _
prefix to variables flagged as unused explicitly indicates their unused status, suppressing warnings.
If the video does not play1
Auto formatting
In addition to the automatic formatting feature integrated with the editor, formatting through the command line and formatting checks in CI are also possible.
If the video does not play1
Integrated test
Test code written by SystemVerilog or cocotb can be embeded in Veryl code,
it can be executed through veryl test
command.
#[test(test1)]
embed (inline) sv{{{
module test1;
initial begin
assert (0) else $error("error");
end
endmodule
}}}
Dependency management
Veryl includes a built-in dependency management feature, allowing for easy incorporation of libraries by simply adding the repository path and version of the library on project settings like below.
[dependencies]
"https://github.com/veryl-lang/sample" = "0.1.0"
Generics
Code generation through generics achieves more reusable code than traditional parameter override. Prarmeters in function like the follwoign example, but also module names of instantiation, type names of struct definition, and so on can be parameterized.
SystemVerilog | Veryl |
---|---|
|
|
Clock Domain Annotation
If there are some clocks in a module, explicit clock domain annotation and unsafe (cdc)
block at the clock domain boundaries are required.
By the annotation, Veryl compiler detects unexpected clock domain crossing as error, and explicit unsafe (cdc)
block eases to review clock domain crossing.
SystemVerilog | Veryl |
---|---|
|
|
Trailing comma
Trailing comma is a syntax where a comma is placed after the last element in a list. It facilitates the addition and removal of elements and reduces unnecessary differences in version control systems.
SystemVerilog | Veryl |
---|---|
|
|
Abstraction of clock and reset
There is no need to specify the polarity and synchronicity of the clock and reset in the syntax; these can be specified during build-time configuration. This allows generating code for both ASICs with negative asynchronous reset and FPGAs with positive synchronous reset from the same Veryl code.
Additionally, explicit clock
and reset
type enables to check whether clock and reset are correctly connected to registers.
If there is a single clock and reset in the module, the connection can be omitted.
SystemVerilog | Veryl |
---|---|
|
|
Documentation comment
Writing module descriptions as documentation comments allows for automatic documentation generation. You can use not only plain text but also the following formats:
SystemVerilog | Veryl |
---|---|
|
|
Compound assignment operator in always_ff
There is no dedicated non-blocking assignment operator;
within always_ff
, non-blocking assignments are inferred, while within always_comb
, blocking assignments are inferred.
Therefore, various compound assignment operators can be used within always_ff
just like within always_comb
.
SystemVerilog | Veryl |
---|---|
|
|
Individual namespace of enum variant
Variants of an enum are defined within separate namespaces for each enum, thus preventing unintended name collisions.
SystemVerilog | Veryl |
---|---|
|
|
repeat
of concatenation
By adopting the explicit repeat
syntax as a repetition description in bit concatenation,
readability improves over complex combinations of {}
.
SystemVerilog | Veryl |
---|---|
|
|
if
/ case
expression
By adopting if
and case
expressions instead of the ternary operator,
readability improves, especially when comparing a large number of items.
SystemVerilog | Veryl |
---|---|
|
|
Range-based for
/ inside
/ outside
With notation representing closed intervals ..=
and half-open intervals ..
,
it is possible to uniformly describe ranges using for
, inside
, and outside
(which denotes the inverse of inside
).
SystemVerilog | Veryl |
---|---|
|
|
msb
notation
The msb
notation, indicating the most significant bit, eliminates the need to calculate the most significant bit from parameters, making intentions clearer.
SystemVerilog | Veryl |
---|---|
|
|
let
statement
There is a dedicated let
statement available for binding values simultaneously with variable declaration,
which can be used in various contexts that were not supported in SystemVerilog.
SystemVerilog | Veryl |
---|---|
|
|
Named block
You can define named blocks to limit the scope of variables.
SystemVerilog | Veryl |
---|---|
|
|
Visibility control
Modules without the pub
keyword cannot be referenced from outside the project
and are not included in automatic documentation generation.
This allows distinguishing between what should be exposed externally from the project and internal implementations.
SystemVerilog | Veryl |
---|---|
|
|
Some browsers by default pause the playback of GIF animations. Please check your browser settings.