Chapter 13. Lucid Reference

This chapter contains information on Lucid and can be used as a reference. Although a lot of Lucid’s syntax and features are covered throughout the book, this chapter explains them in a more comprehensive way. This chapter is roughly organized from an outside-in approach, meaning we start from a full module declaration and work our way down to individual expressions and constants.

The templates are written using syntax similar to ANTLR grammar. Things in single quotes are string literals, meaning they must appear as is. A question mark after something means that it is optional. An asterisk following something means zero or more of that thing may be present. A plus following something means one or more of that thing may be present. Parentheses are used to group multiple tokens.

The following page is intended as a quick reference guide. It covers the most commonly used features of Lucid but is not an exhaustive reference. Refer to the rest of the chapter for more details on any specific feature. You may find it helpful to print the reference guide.

Lucid Quick Reference

Modules

module name #(
    PARAM = DEFAULT_VALUE : CONSTRAINT
  )(
    port_type name
  ) {
  SIGNAL_AND_MODULE_INSTANCES
  always {
    ALWAYS_STATEMENTS
  }
}

Assignment Blocks

.port_name(EXPR), #PARAM_NAME(CONST_EXPR) {
  SIGNAL_AND_MODULE_INSTANCES
}

Types 

input
Port input, read-only
output
Port output, write-only
inout
Bidirectional port with subsignals: read, write, enable ...

Get Learning FPGAs now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.