iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
💎

Updates to the Hardware Description Language Veryl

に公開

Introduction

Veryl is a hardware description language currently under development as an alternative to SystemVerilog.

https://github.com/dalance/veryl

At the end of last year, when it reached a somewhat functional state, I wrote a brief introductory article.

https://zenn.dev/dalance/articles/e3a926b0f0e04d

In this article, I will introduce the updates that have occurred in the year since then.

Documentation

In last year's article, there were only sample source codes prepared as test cases, but now the documentation has been organized to some extent.

https://dalance.github.io/veryl/book/

While some pages in the language reference are still unwritten, I think you can now get a feel for the language. If you're thinking of trying it out, please take a look at 2. Getting Started or 3. Code Examples.

Playground

We have also prepared a Playground as an environment where you can easily try it out from a web browser.

https://dalance.github.io/veryl/playground/

Language Features and Compiler

I will introduce some of the major updates to the language and compiler.

Dependencies

It is now possible to fetch dependencies from Git repositories and publish your own packages with version numbers.

[dependencies]
"https://github.com/dalance/veryl_sample" = "0.1.0"

For more details, please see the following:

Automatic Documentation Generation

It is now possible to automatically generate documentation such as module lists and their port lists. Similar to Rust, it supports documentation comments (comments starting with ///), so if you write descriptions for modules and other elements, they will be automatically reflected.

/// The detailed description of ModuleA
///
/// * list item0
/// * list item1
module ModuleA #(
    /// Data width
    parameter  ParamA: u32 = 1,
    localparam ParamB: u32 = 1,
) (
    i_clk  : input  logic        , /// Clock
    i_rst_n: input  logic        , /// Reset
    i_data : input  logic<ParamA>, /// Data input
    o_data : output logic<ParamA>, /// Data output
) {}

Naming Conventions

It is now possible to configure naming conventions for identifiers. You can set case styles (like snake_case or camelCase), require specific prefixes, or use regular expressions for configuration.

< and >

The most significant change in the language is the handling of < and >. In general programming languages, these are treated as comparison operators, but trying to use <> as brackets poses a problem where it is difficult to determine whether they are brackets or operators.

While most languages try to support both by using context-sensitive parsing, Veryl has adopted the solution of giving up on the operator side. By using <: and :> as comparison operators:

  • The character count aligns with other comparison operators like <= and =>.
  • <> can be used as brackets without complex parsing.

We judged that these were significant advantages. Ultimately, <> is the syntax used for packed arrays, which helps distinguish them from [] used for unpacked arrays.

module ModuleA #(
    parameter  ParamA: u32 = 10,
) (
    i_clk : input  logic,
    i_rst : input  logic,
    i_sel : input  logic,
    i_data: input  logic<ParamA> [2], // `[]` means unpacked array in SystemVerilog
    o_data: output logic<ParamA>    , // `<>` means packed array in SystemVerilog
) {

}

Furthermore, we plan to use this as the syntax for generics in the future (something closer to general generics processed by the Veryl compiler, rather than SystemVerilog's generate).

Others

Other minor updates are summarized below.

  • Changed modport separator from . to :: by @dalance in #65
  • Changed [package] in Veryl.toml to [project] by @dalance in #82
  • Changed enum member scope by @dalance in #66
  • Type cast by @dalance in #48
  • Unknown member check by @dalance in #84
  • File scope import by @dalance in #59
  • Signed type modifier by @dalance in #85
  • Attribute arguments check by @dalance in #90
  • Metadata check by @dalance in #91
  • Dependency support by @dalance in #36
  • Language server metadata support by @dalance in #95
  • Changed compare operator to <: and >: by @dalance in #94
  • Width <> and array [] notation by @dalance in #94
  • Operator completeion support of language server by @dalance in #16
  • String literal support by @dalance in #109
  • implicit_parameter_types in Veryl.toml by @dalance in #109
  • Fixed Incorrect if block scope by @dalance in #55
  • Msb/lsb notation by @dalance in #9
  • Struct packed by default by @dalance in #118
  • Reset statement check by @dalance in #117
  • allow attribute by @dalance in #116
  • lint for naming convention by @dalance in #116
  • Remove rev tag branch in dependencies by @dalance in #132
  • Change dependencies format by @dalance in #139
  • Closed range syntax by @dalance in #146
  • initial/final declaration by @dalance in #148
  • Function call as statement by @dalance in #149
  • Error check before veryl publish by @dalance in #150
  • Multithreaded veryl-ls by @dalance in #155
  • Add toplevel entity and keyword completion by @dalance in #156
  • Add inside/outside expression by @dalance in #159
  • Release aarch64 mac binray by @dalance in #163
  • Widthless number by @dalance in #174
  • Sized set bits by @dalance in #189
  • Unconnected port support by @dalance in #190
  • Automatic ducumentation by @dalance in #195
  • Add modport member resolve by @dalance in #332
  • Add hierarchical identifier check by @dalance in #333
  • Typedef by @nblei in #326
  • Added union type by @nblei in #357
  • Cycle check by @nblei in #383
  • Checks that (module) inputs are only read by @nblei in #393

Conclusion

I have introduced the updates from this past year. My goal for this year was to brush up the language while putting it into practice in actual work, but things didn't go quite as planned, and I couldn't find much time to work on it in the second half of the year.
I hope to make more progress next year.

Discussion