├── .eslintignore
├── .eslintrc.json
├── .github
└── workflows
│ ├── codeql.yml
│ ├── deploy.yaml
│ └── test.yaml
├── .gitignore
├── .prettierignore
├── .prettierrc
├── .vscode
├── launch.json
├── settings.json
└── tasks.json
├── .vscodeignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── build
├── client.webpack.config.js
├── server.webpack.config.js
└── shared.webpack.config.js
├── configs
├── sdc.json
├── systemVerilog.json
├── verilogFileList.json
└── vhdl.configuration.json
├── package-lock.json
├── package.json
├── resources
├── CompletionItemKind_icons.png
├── SymbolKind_icons.png
├── VSCode_SystemVerilog_Icons.fig
├── client_server_configuration.png
├── f_dark.svg
├── f_light.svg
├── find_references.gif
├── goToDef_demo.gif
├── icon.png
├── moduleInit_demo.gif
├── module_index_status.png
├── sdc_dark.svg
├── sdc_light.svg
├── sv_dark.svg
├── sv_light.svg
├── svh_dark.svg
├── svh_light.svg
├── syntax_example_adder.png
├── sys_verilog_logo.png
├── v_dark.svg
├── v_light.svg
├── va.svg
├── vams.svg
├── vh_dark.svg
└── vh_light.svg
├── schemas
└── tasks.schema.json
├── snippets
└── systemverilog.json
├── src
├── compiling
│ ├── ANTLR
│ │ ├── SyntaxErrorListener.ts
│ │ └── grammar
│ │ │ ├── AssertionDeclarations.g4
│ │ │ ├── AssertionStatements.g4
│ │ │ ├── Attributes.g4
│ │ │ ├── BlockItemDeclarations.g4
│ │ │ ├── CaseStatements.g4
│ │ │ ├── CheckerItems.g4
│ │ │ ├── ClassItems.g4
│ │ │ ├── ClockingBlock.g4
│ │ │ ├── Concatenations.g4
│ │ │ ├── ConditionalStatements.g4
│ │ │ ├── ConfigurationSourceText.g4
│ │ │ ├── Constraints.g4
│ │ │ ├── ContinuousAssignmentAndNetAliasStatements.g4
│ │ │ ├── CovergroupDeclarations.g4
│ │ │ ├── DeclarationAssignments.g4
│ │ │ ├── DeclarationDataTypes.g4
│ │ │ ├── DeclarationLists.g4
│ │ │ ├── DeclarationRanges.g4
│ │ │ ├── DeclarationTypes.g4
│ │ │ ├── ExpressionLeftsideValues.g4
│ │ │ ├── Expressions.g4
│ │ │ ├── FunctionDeclarations.g4
│ │ │ ├── GeneratedInstantiation.g4
│ │ │ ├── Identifiers.g4
│ │ │ ├── Instantiation.g4
│ │ │ ├── InterfaceDeclarations.g4
│ │ │ ├── InterfaceItems.g4
│ │ │ ├── LetDeclarations.g4
│ │ │ ├── LexRules.g4
│ │ │ ├── LoopingStatements.g4
│ │ │ ├── ModuleItems.g4
│ │ │ ├── ModuleParametersAndPorts.g4
│ │ │ ├── Numbers.g4
│ │ │ ├── Operators.g4
│ │ │ ├── PackageItems.g4
│ │ │ ├── ParallelAndSequentialBlocks.g4
│ │ │ ├── Primaries.g4
│ │ │ ├── PrimitiveGateAndSwitchTypes.g4
│ │ │ ├── PrimitiveInstantiationAndInstances.g4
│ │ │ ├── PrimitiveStrengths.g4
│ │ │ ├── PrimitiveTerminals.g4
│ │ │ ├── ProceduralBlocksAndAssignments.g4
│ │ │ ├── ProgramItems.g4
│ │ │ ├── Randsequence.g4
│ │ │ ├── SpecifyBlockDeclaration.g4
│ │ │ ├── SpecifyBlockTerminals.g4
│ │ │ ├── SpecifyPathDeclarations.g4
│ │ │ ├── SpecifyPathDelays.g4
│ │ │ ├── Statements.g4
│ │ │ ├── Strings.g4
│ │ │ ├── SubroutineCallStatements.g4
│ │ │ ├── SubroutineCalls.g4
│ │ │ ├── SystemTimingChecks.g4
│ │ │ ├── SystemVerilog.g4
│ │ │ ├── SystemVerilogSourceText.g4
│ │ │ ├── TaskDeclarations.g4
│ │ │ ├── TimingControlStatements.g4
│ │ │ ├── UDPBody.g4
│ │ │ ├── UDPDeclaration.g4
│ │ │ ├── UDPInstantiation.g4
│ │ │ └── UDPPorts.g4
│ ├── ANTLRBackend.ts
│ ├── DiagnosticData.ts
│ ├── DocumentCompiler.ts
│ ├── SystemVerilogCompiler.ts
│ ├── VCSCompiler.ts
│ ├── VeribleCompiler.ts
│ └── VerilatorCompiler.ts
├── extension.ts
├── indexer.ts
├── parser.ts
├── providers
│ ├── DefinitionProvider.ts
│ ├── DocumentSymbolProvider.ts
│ ├── FormatProvider.ts
│ ├── HoverProvider.ts
│ ├── ModuleInstantiator.ts
│ ├── ReferenceProvider.ts
│ └── WorkspaceSymbolProvider.ts
├── server.ts
├── symbol.ts
├── test
│ ├── ANTLRCompiler.test.ts
│ ├── MacroReplacement.test.ts
│ ├── ModuleInstantiator.test.ts
│ ├── ReferenceProvider.test.ts
│ ├── SyntaxErrorListener.test.ts
│ ├── VCSCompiler.test.ts
│ ├── VeribleCompiler.test.ts
│ ├── VerilatorCompiler.test.ts
│ ├── extension.test.ts
│ ├── index-coverage.ts
│ ├── index.ts
│ ├── indexer_map.test.ts
│ ├── runTest.ts
│ ├── test-files
│ │ ├── ANTLRCompiler.test
│ │ │ ├── correct.sv
│ │ │ ├── empty.sv
│ │ │ ├── several_error.sv
│ │ │ ├── single_error.sv
│ │ │ ├── single_error.txt
│ │ │ ├── single_error.v
│ │ │ └── unicode.sv
│ │ ├── MacroReplace.test
│ │ │ ├── multiline_macro.sv
│ │ │ ├── multiline_macro_expected.sv
│ │ │ ├── multiple_macros_interspersed.sv
│ │ │ ├── multiple_macros_interspersed_expected.sv
│ │ │ ├── multiple_macros_multiple_uses.sv
│ │ │ ├── multiple_macros_multiple_uses_expected.sv
│ │ │ ├── no_macros.sv
│ │ │ ├── no_macros_expected.sv
│ │ │ ├── redefined_macro.sv
│ │ │ ├── redefined_macro_expected.sv
│ │ │ ├── single_macro_multiple_uses.sv
│ │ │ ├── single_macro_multiple_uses_expected.sv
│ │ │ ├── single_macro_no_uses.sv
│ │ │ └── single_macro_no_uses_expected.sv
│ │ ├── ModuleInstantiator.test.1.v
│ │ ├── ModuleInstantiator.test.2.v
│ │ ├── VCSCompiler.test
│ │ │ ├── baz.sv
│ │ │ ├── foo.stdout.txt
│ │ │ └── foo.sv
│ │ ├── VeribleCompiler.test
│ │ │ ├── baz.sv
│ │ │ ├── foo.stdout.txt
│ │ │ ├── foo.sv
│ │ │ ├── foo_error.stdout.txt
│ │ │ └── foo_error.sv
│ │ ├── VerilatorCompiler.test
│ │ │ ├── bar.stderr.txt
│ │ │ ├── bar.sv
│ │ │ ├── baz.sv
│ │ │ ├── foo.stderr.txt
│ │ │ ├── foo.sv
│ │ │ ├── qux.stderr.txt
│ │ │ └── qux.sv
│ │ ├── design.sv
│ │ ├── foo.txt
│ │ └── illegal_symbols.sv
│ ├── utils.client.test.ts
│ ├── utils.common.test.ts
│ └── utils.server.test.ts
├── utils
│ ├── client.ts
│ ├── common.ts
│ └── server.ts
└── wip
│ ├── CompletionItemProvider.ts
│ └── TreeDataProvider.ts
├── syntaxes
├── codeblock.json
├── sdc.json
├── systemverilog.tmLanguage.yaml
├── verilog-filelist.json
└── vhdl.tmLanguage.json
├── tsconfig.json
└── verilog-examples
├── .vscode
├── settings.json
└── tasks.json
├── allman_example.sv
├── allman_example.svh
├── class_example.sv
├── class_extern.svh
├── comment_error.sv
├── cover_example.sv
├── design.v
├── design.vh
├── directed_test.sv
├── driver.sv
├── ekv.va
├── environment.sv
├── error_test.sv
├── excluded_inst.sv
├── fiellist.f
├── generator.sv
├── inheritance_example.sv
├── instantiation_example.sv
├── interface.sv
├── jtag.xdc
├── my_invl.vh
├── package.sv
├── parameter_test.sv
├── primitive_table.sv
├── random_test.sv
├── segdetect.v
├── testbench.sv
├── transaction.sv
└── varistor.vams
/.eslintignore:
--------------------------------------------------------------------------------
1 | .vscode/
2 | .vscode-test/
3 | build/
4 | coverage/
5 | dist/
6 | node_modules/
7 | out/
8 | src/compiling/ANTLR/grammar
9 | src/wip/
10 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "@typescript-eslint/parser",
3 | "parserOptions": {
4 | "project": "tsconfig.json"
5 | },
6 | "plugins": ["@typescript-eslint", "import"],
7 | "extends": [
8 | "eslint:recommended",
9 | "airbnb-typescript/base",
10 | "plugin:import/recommended",
11 | "plugin:import/typescript",
12 | "plugin:prettier/recommended"
13 | ],
14 | "rules": {
15 | "no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
16 | "import/no-extraneous-dependencies": ["error", { "devDependencies": ["**/src/test/*.ts"] }],
17 | "import/no-unresolved": ["error", { "ignore": ["^vscode$"] }],
18 | "@typescript-eslint/indent": ["error", 4],
19 | "@typescript-eslint/no-empty-function": ["error", { "allow": ["arrowFunctions", "methods"] }],
20 | "@typescript-eslint/lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
21 | "@typescript-eslint/no-shadow": ["error", { "allow": ["err"] }],
22 | "@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": true, "variables": true }],
23 | "@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
24 | "@typescript-eslint/naming-convention": [
25 | "error",
26 | { "selector": "variable", "format": ["camelCase", "PascalCase", "UPPER_CASE"], "leadingUnderscore": "allow" },
27 | { "selector": "function", "format": ["camelCase", "PascalCase"] },
28 | { "selector": "typeLike", "format": ["PascalCase"] }
29 | ]
30 | // "@typescript-eslint/no-explicit-any": "off"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/.github/workflows/deploy.yaml:
--------------------------------------------------------------------------------
1 | on:
2 | push:
3 | tags:
4 | - '*'
5 |
6 | name: Deploy Extension
7 | jobs:
8 | deploy:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v2
12 | - uses: actions/setup-node@v1
13 | with:
14 | node-version: 16
15 | - run: npm ci
16 | - name: Publish to Visual Studio Marketplace
17 | uses: HaaLeo/publish-vscode-extension@v1
18 | with:
19 | pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
20 | registryUrl: https://marketplace.visualstudio.com
21 |
--------------------------------------------------------------------------------
/.github/workflows/test.yaml:
--------------------------------------------------------------------------------
1 | name: Test and QA
2 | on:
3 | push:
4 | branches:
5 | - 'master'
6 | pull_request:
7 | branches:
8 | - '**'
9 |
10 | jobs:
11 | test:
12 | strategy:
13 | fail-fast: false
14 | matrix:
15 | os: [macos-latest, ubuntu-latest, windows-latest]
16 | name: Run extension tests (Node.js 16 on ${{ matrix.os }})
17 | runs-on: ${{ matrix.os }}
18 | steps:
19 | - name: Clone vscode-systemverilog
20 | uses: actions/checkout@v2
21 | - name: Setup Node.js
22 | uses: actions/setup-node@v2
23 | id: node
24 | with:
25 | node-version: '16'
26 | - name: Install NPM dependencies
27 | run: npm ci --production=false --unsafe-perm
28 | - name: Compile extension
29 | run: npm run compile
30 | - name: Create bundle
31 | run: npm run webpack
32 | - name: Run headless tests and collect coverage
33 | uses: GabrielBB/xvfb-action@v1
34 | with:
35 | run: npm run coverage
36 | working-directory: ./
37 | options: ''
38 | - name: Verify files
39 | if: runner.os == 'Linux'
40 | run: ls -l dist/client/extension.js dist/server/server.js coverage/index.html
41 | qa:
42 | name: Run quality checks
43 | runs-on: ubuntu-latest
44 | steps:
45 | - name: Clone vscode-systemverilog
46 | uses: actions/checkout@v2
47 | - name: Install NPM dependencies
48 | run: npm ci --production=false --unsafe-perm
49 | - name: Compile ANTLR
50 | run: npm run compile:antlr4ts
51 | - name: Run ESLint
52 | run: npm run lint
53 | - name: Run Prettier
54 | run: npm run pretty:check
55 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.nyc_output/
2 | /.vscode-test/
3 | /coverage/
4 | /dist/
5 | /node_modules/
6 | /out/
7 | /packages/
8 | /results.xml
9 | /src/compiling/ANTLR/grammar/build/
10 | /syntaxes/systemverilog.tmLanguage.json
11 | **/.antlr
12 | *.vsix
13 | .DS_Store
14 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | /.nyc_output/
2 | /.vscode-test/
3 | /coverage/
4 | /out/
5 | /resources/
6 | /dist/
7 | /src/compiling/ANTLR/grammar/
8 | /src/test/test-files/
9 | /verilog-examples/
10 | /snippets/systemverilog.json
11 | /syntaxes/systemverilog.tmLanguage*.json
12 | /.eslintignore
13 | /.gitignore
14 | /.prettierignore
15 | /.vscodeignore
16 | /LICENSE
17 | /results.xml
18 | *.vsix
19 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 120,
3 | "tabWidth": 4,
4 | "useTabs": false,
5 | "semi": true,
6 | "singleQuote": true,
7 | "quoteProps": "as-needed",
8 | "jsxSingleQuote": false,
9 | "trailingComma": "none",
10 | "bracketSpacing": true,
11 | "bracketSameLine": false,
12 | "arrowParens": "always",
13 | "rangeStart": 0,
14 | "requirePragma": false,
15 | "insertPragma": false,
16 | "proseWrap": "preserve",
17 | "htmlWhitespaceSensitivity": "strict",
18 | "endOfLine": "lf",
19 | "embeddedLanguageFormatting": "auto",
20 | "overrides": [
21 | { "files": "*.yaml", "options": { "tabWidth": 2 } },
22 | { "files": "*.json", "options": { "printWidth": 130 } },
23 | { "files": "*.md", "options": { "tabWidth": 2 } }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": "Extension",
6 | "type": "extensionHost",
7 | "request": "launch",
8 | "runtimeExecutable": "${execPath}",
9 | "args": ["--disable-extensions", "--extensionDevelopmentPath=${workspaceRoot}"],
10 | "outFiles": ["${workspaceRoot}/dist/client/**/*.js"],
11 | "preLaunchTask": {
12 | "type": "npm",
13 | "script": "webpack:dev"
14 | }
15 | },
16 | {
17 | "name": "Attach",
18 | "type": "node",
19 | "request": "attach",
20 | "port": 6009,
21 | "restart": true,
22 | "outFiles": ["${workspaceRoot}/dist/server/**/*.js"]
23 | },
24 | {
25 | "name": "Extension Tests",
26 | "type": "extensionHost",
27 | "request": "launch",
28 | "runtimeExecutable": "${execPath}",
29 | "args": [
30 | "--disable-extensions",
31 | "--extensionDevelopmentPath=${workspaceRoot}",
32 | "--extensionTestsPath=${workspaceRoot}/out/test/index",
33 | "${workspaceRoot}/verilog-examples"
34 | ],
35 | "outFiles": ["${workspaceRoot}/out/test/**/*.js"],
36 | "preLaunchTask": {
37 | "type": "npm",
38 | "script": "compile"
39 | }
40 | }
41 | ],
42 | "compounds": [
43 | {
44 | "name": "Client + Server",
45 | "configurations": ["Extension", "Attach"]
46 | }
47 | ]
48 | }
49 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "typescript.tsdk": "./node_modules/typescript/lib"
3 | }
4 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "type": "npm",
6 | "script": "watch",
7 | "problemMatcher": "$tsc-watch",
8 | "isBackground": true,
9 | "presentation": {
10 | "reveal": "never",
11 | "panel": "dedicated"
12 | },
13 | "group": {
14 | "kind": "build",
15 | "isDefault": true
16 | }
17 | },
18 | {
19 | "type": "npm",
20 | "script": "compile",
21 | "isBackground": false,
22 | "group": "build",
23 | "presentation": {
24 | "reveal": "never",
25 | "panel": "dedicated"
26 | },
27 | "problemMatcher": ["$tsc"]
28 | },
29 | {
30 | "label": "Verilator: Compile",
31 | "isBackground": true,
32 | // "runOptions": {
33 | // "runOn": "folderOpen",
34 | // "reevaluateOnRerun": true
35 | // },
36 | "presentation": {
37 | "echo": true,
38 | "reveal": "always",
39 | "focus": false,
40 | "panel": "shared",
41 | "showReuseMessage": true,
42 | "clear": false
43 | },
44 | "command": "wsl",
45 | "args": ["verilator", "-sv", "--language", "1800-2012", "--lint-only", "`wslpath", "'${relativeFile}'`"],
46 | "problemMatcher": {
47 | "owner": "systemverilog",
48 | "pattern": [
49 | {
50 | "regexp": "^%([\\w-]+): ([\\w_\\./-]+):(\\d+):\\s+([\\w\\W]+)$",
51 | "severity": 1,
52 | "file": 2,
53 | "line": 3,
54 | "message": 4
55 | }
56 | ]
57 | },
58 | "group": {
59 | "kind": "build",
60 | "isDefault": true
61 | }
62 | }
63 | ]
64 | }
65 |
--------------------------------------------------------------------------------
/.vscodeignore:
--------------------------------------------------------------------------------
1 | .git/
2 | .nyc_output/
3 | .vscode/
4 | .vscode-test/
5 | build/
6 | coverage/
7 | # dist/
8 | dist/**/*.LICENSE.txt
9 | dist/**/*.map
10 | node_modules/
11 | out/
12 | # out/test/
13 | # out/wip/
14 | resources/*
15 | !resources/icon.png
16 | !resources/*.svg
17 | src/
18 | syntaxes/systemverilog.tmLanguage.yaml
19 | verilog-examples/
20 | .gitignore
21 | .eslintignore
22 | .eslintrc
23 | .prettierignore
24 | .prettierrc
25 | .vscodeignore
26 | package-lock.json
27 | tsconfig.json
28 | results.xml
29 | *.vsix
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Eirik Prestegårdshus
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/build/client.webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const withDefaults = require('./shared.webpack.config');
3 |
4 | module.exports = withDefaults({
5 | context: path.join(__dirname),
6 | entry: {
7 | extension: '../src/extension.ts'
8 | },
9 | output: {
10 | filename: 'extension.js',
11 | path: path.join(__dirname, '..', 'dist', 'client')
12 | }
13 | });
14 |
--------------------------------------------------------------------------------
/build/server.webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const withDefaults = require('./shared.webpack.config');
3 |
4 | module.exports = withDefaults({
5 | context: path.join(__dirname),
6 | entry: {
7 | extension: '../src/server.ts'
8 | },
9 | output: {
10 | filename: 'server.js',
11 | path: path.join(__dirname, '..', 'dist', 'server')
12 | }
13 | });
14 |
--------------------------------------------------------------------------------
/build/shared.webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const merge = require('merge-options'); // eslint-disable-line import/no-extraneous-dependencies
3 |
4 | module.exports = function withDefaults(extConfig) {
5 | const config = {
6 | mode: 'none',
7 | target: 'node',
8 | node: {
9 | __dirname: false
10 | },
11 | entry: './src/extension.ts',
12 | output: {
13 | path: path.join(extConfig.context, 'dist'),
14 | filename: '[name].js',
15 | libraryTarget: 'commonjs2',
16 | devtoolModuleFilenameTemplate: '../[resource-path]'
17 | },
18 | devtool: 'source-map',
19 | externals: {
20 | vscode: 'commonjs vscode'
21 | },
22 | resolve: {
23 | extensions: ['.ts', '.js']
24 | },
25 | module: {
26 | rules: [
27 | {
28 | test: /\.ts$/,
29 | exclude: /node_modules/,
30 | use: [
31 | {
32 | loader: 'ts-loader'
33 | }
34 | ]
35 | }
36 | ]
37 | }
38 | };
39 |
40 | return merge(config, extConfig);
41 | };
42 |
--------------------------------------------------------------------------------
/configs/sdc.json:
--------------------------------------------------------------------------------
1 | {
2 | "comments": {
3 | "lineComment": "#"
4 | },
5 | "brackets": [
6 | ["{", "}"],
7 | ["[", "]"],
8 | ["(", ")"]
9 | ],
10 | "autoClosingPairs": [
11 | ["{", "}"],
12 | ["[", "]"],
13 | ["(", ")"],
14 | ["\"", "\""],
15 | ["'", "'"]
16 | ],
17 | "surroundingPairs": [
18 | ["{", "}"],
19 | ["[", "]"],
20 | ["(", ")"],
21 | ["\"", "\""],
22 | ["'", "'"]
23 | ]
24 | }
--------------------------------------------------------------------------------
/configs/systemVerilog.json:
--------------------------------------------------------------------------------
1 | {
2 | "comments": {
3 | "lineComment": "//",
4 | "blockComment": ["/*", "*/"]
5 | },
6 | "brackets": [
7 | ["{", "}"],
8 | ["[", "]"],
9 | ["(", ")"],
10 | ["begin", "end"],
11 | ["randcase", "endcase"],
12 | ["casex", "endcase"],
13 | ["casez", "endcase"],
14 | ["case", "endcase"],
15 | ["checker", "endchecker"],
16 | ["class", "endclass"],
17 | ["clocking", "endclocking"],
18 | ["config", "endconfig"],
19 | ["coverage", "endcoverage"],
20 | ["covergroup", "endgroup"],
21 | ["fork", "join"],
22 | ["fork", "join_any"],
23 | ["fork", "join_none"],
24 | ["function", "endfunction"],
25 | ["generate", "endgenerate"],
26 | ["interface", "endinterface"],
27 | ["macromodule", "endmodule"],
28 | ["module", "endmodule"],
29 | ["package", "endpackage"],
30 | ["primitive", "endprimitive"],
31 | ["program", "endprogram"],
32 | ["property", "endproperty"],
33 | ["specify", "endspecify"],
34 | ["sequence", "endsequence"],
35 | ["table", "endtable"],
36 | ["task", "endtask"]
37 | ],
38 | "autoClosingPairs": [
39 | { "open": "(", "close": ")" },
40 | { "open": "[", "close": "]" },
41 | { "open": "{", "close": "}" },
42 | { "open": "\"", "close": "\"", "notIn": ["string"] }
43 | ],
44 | "surroundingPairs": [
45 | ["{", "}"],
46 | ["[", "]"],
47 | ["(", ")"],
48 | ["'", "'"],
49 | ["\"", "\""]
50 | ],
51 | "folding": {
52 | "markers": {
53 | "start": "^[ \\t\\n]*(?://[ \\t\\n]*#?region|`(?:ifdef|ifndef|elsif|else)\\b|\\b(?:(?:macro)?module|class)\\b)",
54 | "end": "^[ \\t\\n]*(?://[ \\t\\n]*#?endregion|`(?:elsif|else|endif)\\b|\\b(?:endmodule|endclass)\\b)"
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/configs/verilogFileList.json:
--------------------------------------------------------------------------------
1 | {
2 | "comments": {
3 | "lineComment": ["//", "#"]
4 | },
5 | "brackets": [
6 | ["{", "}"],
7 | ["(", ")"]
8 | ],
9 | "autoClosingPairs": [
10 | ["{", "}"],
11 | ["(", ")"]
12 | ],
13 | "surroundingPairs": [
14 | ["{", "}"],
15 | ["(", ")"]
16 | ]
17 | }
--------------------------------------------------------------------------------
/configs/vhdl.configuration.json:
--------------------------------------------------------------------------------
1 | {
2 | "comments": {
3 | "lineComment": "--",
4 | "blockComment": []
5 | },
6 | "brackets": [
7 | ["{", "}"],
8 | ["[", "]"],
9 | ["(", ")"]
10 | ]
11 | }
--------------------------------------------------------------------------------
/resources/CompletionItemKind_icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/CompletionItemKind_icons.png
--------------------------------------------------------------------------------
/resources/SymbolKind_icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/SymbolKind_icons.png
--------------------------------------------------------------------------------
/resources/VSCode_SystemVerilog_Icons.fig:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/VSCode_SystemVerilog_Icons.fig
--------------------------------------------------------------------------------
/resources/client_server_configuration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/client_server_configuration.png
--------------------------------------------------------------------------------
/resources/f_dark.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/resources/f_light.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/resources/find_references.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/find_references.gif
--------------------------------------------------------------------------------
/resources/goToDef_demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/goToDef_demo.gif
--------------------------------------------------------------------------------
/resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/icon.png
--------------------------------------------------------------------------------
/resources/moduleInit_demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/moduleInit_demo.gif
--------------------------------------------------------------------------------
/resources/module_index_status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/module_index_status.png
--------------------------------------------------------------------------------
/resources/sdc_dark.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/resources/sdc_light.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/resources/sv_dark.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/resources/sv_light.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/resources/svh_dark.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/resources/svh_light.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/resources/syntax_example_adder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/syntax_example_adder.png
--------------------------------------------------------------------------------
/resources/sys_verilog_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eirikpre/VSCode-SystemVerilog/f70d6e2fd39512a768d62c3b1e05f20c549e0ffd/resources/sys_verilog_logo.png
--------------------------------------------------------------------------------
/resources/v_dark.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/resources/v_light.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/resources/va.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/resources/vams.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/resources/vh_dark.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/resources/vh_light.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/schemas/tasks.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "$id": "./schemas/tasks.schema.json",
4 | "title": "Verilog/SystemVerilog Tasks",
5 | "type": "object",
6 | "properties": {
7 | "tasks": {
8 | "type": "array",
9 | "items": {
10 | "type": "object",
11 | "default": {
12 | "label": "Verilator",
13 | "type": "shell",
14 | "command": "verilator",
15 | "args": ["-sv", "--language", "1800-2012", "--lint-only", "${relativeFile}"],
16 | "problemMatcher": {
17 | "owner": "systemverilog",
18 | "pattern": {
19 | "regexp": "^%([\\w-]+): ([\\w_\\./-]+):(\\d+):\\s+([\\w\\W]+)$",
20 | "severity": 1,
21 | "file": 2,
22 | "line": 3,
23 | "message": 4
24 | }
25 | }
26 | }
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/SyntaxErrorListener.ts:
--------------------------------------------------------------------------------
1 | // import {SystemVerilogListener} from './grammar/build/SystemVerilogListener';
2 | import { Recognizer, RecognitionException, ANTLRErrorListener } from 'antlr4ts';
3 |
4 | /**
5 | * Stores errors in ANTLR parsing in a list for later access
6 | */
7 | export class SyntaxErrorListener implements ANTLRErrorListener {
8 | public error_list = [];
9 |
10 | public syntaxError(
11 | _recognizer: Recognizer,
12 | offendingSymbol: T,
13 | line: number,
14 | charPositionInLine: number,
15 | msg: string,
16 | _e: RecognitionException | undefined
17 | ): void {
18 | line -= 1;
19 | this.error_list.push({ offendingSymbol, line, charPositionInLine, msg });
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/AssertionStatements.g4:
--------------------------------------------------------------------------------
1 | grammar AssertionStatements;
2 | import ClockingBlock;
3 |
4 | assertion_item : concurrent_assertion_item | deferred_immediate_assertion_item ;
5 | deferred_immediate_assertion_item : ( block_identifier ':' )? deferred_immediate_assertion_statement ;
6 | procedural_assertion_statement : concurrent_assertion_statement
7 | | immediate_assertion_statement
8 | | checker_instantiation ;
9 | immediate_assertion_statement : simple_immediate_assertion_statement
10 | | deferred_immediate_assertion_statement ;
11 | simple_immediate_assertion_statement : simple_immediate_assert_statement
12 | | simple_immediate_assume_statement
13 | | simple_immediate_cover_statement ;
14 | simple_immediate_assert_statement : 'assert' '(' expression ')' action_block ;
15 | simple_immediate_assume_statement : 'assume' '(' expression ')' action_block ;
16 | simple_immediate_cover_statement : 'cover' '(' expression ')' statement_or_null ;
17 | deferred_immediate_assertion_statement : deferred_immediate_assert_statement
18 | | deferred_immediate_assume_statement
19 | | deferred_immediate_cover_statement ;
20 | deferred_immediate_assert_statement : 'assert' '#0' '(' expression ')' action_block
21 | | 'assert' 'final' '(' expression ')' action_block ;
22 | deferred_immediate_assume_statement : 'assume' '#0' '(' expression ')' action_block
23 | | 'assume' 'final' '(' expression ')' action_block ;
24 | deferred_immediate_cover_statement : 'cover' '#0' '(' expression ')' statement_or_null
25 | | 'cover' 'final' '(' expression ')' statement_or_null ;
26 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Attributes.g4:
--------------------------------------------------------------------------------
1 | grammar Attributes;
2 | import Identifiers;
3 |
4 | attribute_instance : '(*' attr_spec ( ',' attr_spec )* '*)' ;
5 | attr_spec : attr_name ( '=' constant_expression )? ;
6 | attr_name : identifier ;
7 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/BlockItemDeclarations.g4:
--------------------------------------------------------------------------------
1 | grammar BlockItemDeclarations;
2 | import InterfaceDeclarations;
3 |
4 | block_item_declaration : ( attribute_instance )* data_declaration
5 | | ( attribute_instance )* local_parameter_declaration ';'
6 | | ( attribute_instance )* parameter_declaration ';'
7 | | ( attribute_instance )* let_declaration ;
8 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/CaseStatements.g4:
--------------------------------------------------------------------------------
1 | grammar CaseStatements;
2 | import LoopingStatements;
3 |
4 | case_statement : ( unique_priority )? case_keyword '(' case_expression ')' case_item ( case_item )*
5 | 'endcase'
6 | | ( unique_priority )? case_keyword '(' case_expression ')' 'matches' case_pattern_item
7 | ( case_pattern_item )* 'endcase'
8 | | ( unique_priority )? 'case' '(' case_expression ')' 'inside' case_inside_item ( case_inside_item )*
9 | 'endcase' ;
10 | case_keyword : 'case' | 'casez' | 'casex' ;
11 | case_expression : expression ;
12 | case_item : case_item_expression ( ',' case_item_expression )* ':' statement_or_null
13 | | 'default' ( ':' )? statement_or_null ;
14 | case_pattern_item : pattern ( '&&&' expression )? ':' statement_or_null
15 | | 'default' ( ':' )? statement_or_null ;
16 | case_inside_item : open_range_list ':' statement_or_null | 'default' ( ':' )? statement_or_null ;
17 | case_item_expression : expression ;
18 | randcase_statement : 'randcase' randcase_item ( randcase_item )* 'endcase' ;
19 | randcase_item : expression ':' statement_or_null ;
20 | open_range_list : open_value_range ( ',' open_value_range )* ;
21 | open_value_range : value_range ;
22 | pattern : '.' variable_identifier
23 | | '.*'
24 | | constant_expression
25 | | 'tagged' member_identifier ( pattern )?
26 | | APOSTROPHE '{' pattern ( ',' pattern )* '}'
27 | | APOSTROPHE '{' member_identifier ':' pattern ( ',' member_identifier ':' pattern )* '}' ;
28 | assignment_pattern : APOSTROPHE '{' expression ( ',' expression )* '}'
29 | | APOSTROPHE '{' structure_pattern_key ':' expression ( ',' structure_pattern_key ':' expression )* '}'
30 | | APOSTROPHE '{' array_pattern_key ':' expression ( ',' array_pattern_key ':' expression )* '}'
31 | | APOSTROPHE '{' constant_expression '{' expression ( ',' expression )* '}' '}' ;
32 | structure_pattern_key : member_identifier | assignment_pattern_key ;
33 | array_pattern_key : constant_expression | assignment_pattern_key ;
34 | assignment_pattern_key : simple_type | 'default' ;
35 | assignment_pattern_expression : ( assignment_pattern_expression_type )? assignment_pattern ;
36 | assignment_pattern_expression_type : ps_type_identifier
37 | | ps_parameter_identifier
38 | | integer_atom_type
39 | | type_reference ;
40 | constant_assignment_pattern_expression : assignment_pattern_expression ;
41 | assignment_pattern_net_lvalue : APOSTROPHE '{' net_lvalue ( ',' net_lvalue )* '}' ; assignment_pattern_variable_lvalue : APOSTROPHE '{' variable_lvalue ( ',' variable_lvalue )* '}' ;
42 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/CheckerItems.g4:
--------------------------------------------------------------------------------
1 | grammar CheckerItems;
2 | import ClassItems;
3 |
4 | checker_port_list : checker_port_item ( ',' checker_port_item )* ;
5 | checker_port_item : ( attribute_instance )* ( checker_port_direction )? property_formal_type
6 | formal_port_identifier ( variable_dimension )* ( '=' property_actual_arg )? ;
7 | checker_port_direction : 'input' | 'output' ;
8 | checker_or_generate_item : checker_or_generate_item_declaration
9 | | initial_construct
10 | | always_construct
11 | | final_construct
12 | | assertion_item
13 | | continuous_assign
14 | | checker_generate_item ;
15 | checker_or_generate_item_declaration : ( 'rand' )? data_declaration
16 | | function_declaration
17 | | checker_declaration
18 | | assertion_item_declaration
19 | | covergroup_declaration
20 | | genvar_declaration
21 | | clocking_declaration
22 | | 'default' 'clocking' clocking_identifier ';'
23 | | 'default' 'disable' 'iff' expression_or_dist ';'
24 | | ';' ;
25 | checker_generate_item : loop_generate_construct
26 | | conditional_generate_construct
27 | | generate_region
28 | | elaboration_system_task
29 | | simulation_control_task ;
30 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ClassItems.g4:
--------------------------------------------------------------------------------
1 | grammar ClassItems;
2 | import Constraints;
3 |
4 | class_item : ( attribute_instance )* class_property
5 | | ( attribute_instance )* class_method
6 | | ( attribute_instance )* class_constraint
7 | | ( attribute_instance )* class_declaration
8 | | ( attribute_instance )* covergroup_declaration
9 | | local_parameter_declaration ';'
10 | | parameter_declaration ';'
11 | | ';' ;
12 | class_property : ( property_qualifier )* data_declaration
13 | | 'const' ( class_item_qualifier )* data_type const_identifier ( '=' constant_expression )? ';' ;
14 | class_method : ( method_qualifier )* task_declaration
15 | | ( method_qualifier )* function_declaration
16 | | 'pure' 'virtual' ( class_item_qualifier )* method_prototype ';'
17 | | 'extern' ( method_qualifier )* method_prototype ';'
18 | | ( method_qualifier )* class_constructor_declaration
19 | | 'extern' ( method_qualifier )* class_constructor_prototype ;
20 | class_constructor_prototype : 'function' 'new' ( '(' ( tf_port_list )? ')' )? ';' ;
21 | class_constraint : constraint_prototype | constraint_declaration ;
22 | class_item_qualifier : 'static' | 'protected' | 'local' ;
23 | property_qualifier : random_qualifier | class_item_qualifier ;
24 | random_qualifier : 'rand' | 'randc' ;
25 | method_qualifier : ( 'pure' )? 'virtual' | class_item_qualifier ;
26 | method_prototype : task_prototype | function_prototype ;
27 | class_constructor_declaration : 'function' ( class_scope )? 'new' ( '(' ( tf_port_list )? ')' )? ';'
28 | ( block_item_declaration )* ( 'super' '.' 'new' ( '(' list_of_arguments ')' )? ';' )?
29 | ( function_statement_or_null )* 'endfunction' ( ':' 'new' )? ;
30 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ClockingBlock.g4:
--------------------------------------------------------------------------------
1 | grammar ClockingBlock;
2 | import Randsequence;
3 |
4 | clocking_declaration : ( 'default' )? 'clocking' ( clocking_identifier )? clocking_event ';'
5 | ( clocking_item )* 'endclocking' ( ':' clocking_identifier )?
6 | | 'global' 'clocking' ( clocking_identifier )? clocking_event ';' 'endclocking'
7 | ( ':' clocking_identifier )? ;
8 | clocking_event : '@' identifier | '@' '(' event_expression ')' ;
9 | clocking_item : 'default' default_skew ';'
10 | | clocking_direction list_of_clocking_decl_assign ';'
11 | | ( attribute_instance )* assertion_item_declaration ;
12 | default_skew : 'input' clocking_skew
13 | | 'output' clocking_skew
14 | | 'input' clocking_skew 'output' clocking_skew ;
15 | clocking_direction : 'input' ( clocking_skew )?
16 | | 'output' ( clocking_skew )?
17 | | 'input' ( clocking_skew )? 'output' ( clocking_skew )?
18 | | 'inout' ;
19 | list_of_clocking_decl_assign : clocking_decl_assign ( ',' clocking_decl_assign )* ;
20 | clocking_decl_assign : signal_identifier ( '=' expression )? ;
21 | clocking_skew : edge_identifier ( delay_control )? | delay_control ;
22 | clocking_drive : clockvar_expression '<=' ( cycle_delay )? expression ;
23 | cycle_delay : '##' integral_number | '##' identifier | '##' '(' expression ')' ;
24 | clockvar : hierarchical_identifier ;
25 | clockvar_expression : clockvar select ;
26 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Concatenations.g4:
--------------------------------------------------------------------------------
1 | grammar Concatenations;
2 | import SubroutineCalls;
3 |
4 | concatenation : '{' expression ( ',' expression )* '}' ;
5 | constant_concatenation : '{' constant_expression ( ',' constant_expression )* '}' ;
6 | constant_multiple_concatenation : '{' constant_expression constant_concatenation '}' ;
7 | module_path_concatenation : '{' module_path_expression ( ',' module_path_expression )* '}' ;
8 | module_path_multiple_concatenation : '{' constant_expression module_path_concatenation '}' ;
9 | multiple_concatenation : '{' expression concatenation '}' ;
10 | streaming_concatenation : '{' stream_operator ( slice_size )? stream_concatenation '}' ;
11 | stream_operator : '>>' | '<<' ;
12 | slice_size : simple_type | constant_expression ;
13 | stream_concatenation : '{' stream_expression ( ',' stream_expression )* '}' ;
14 | stream_expression : expression ( 'with' '[' array_range_expression ']' )? ;
15 | array_range_expression : expression
16 | | expression ':' expression
17 | | expression '+:' expression
18 | | expression '-:' expression ;
19 | empty_unpacked_array_concatenation : '{' '}' ;
20 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ConditionalStatements.g4:
--------------------------------------------------------------------------------
1 | grammar ConditionalStatements;
2 | import CaseStatements;
3 |
4 | conditional_statement : ( unique_priority )? 'if' '(' cond_predicate ')' statement_or_null
5 | ( 'else' 'if' '(' cond_predicate ')' statement_or_null )* ( 'else' statement_or_null )? ;
6 | unique_priority : 'unique' | 'unique0' | 'priority' ;
7 | cond_predicate : ( expression | expression 'matches' pattern ) ( '&&&' ( expression | expression 'matches' pattern ) )* ;
8 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ConfigurationSourceText.g4:
--------------------------------------------------------------------------------
1 | grammar ConfigurationSourceText;
2 | import InterfaceItems;
3 |
4 | config_declaration : 'config' config_identifier ';' ( local_parameter_declaration ';' )* design_statement
5 | ( config_rule_statement )* 'endconfig' ( ':' config_identifier )? ;
6 | design_statement : 'design' ( ( library_identifier '.' )? cell_identifier )* ';' ;
7 | config_rule_statement : default_clause liblist_clause ';'
8 | | inst_clause liblist_clause ';'
9 | | inst_clause use_clause ';'
10 | | cell_clause liblist_clause ';'
11 | | cell_clause use_clause ';' ;
12 | default_clause : 'default' ;
13 | inst_clause : 'instance' inst_name ;
14 | inst_name : topmodule_identifier ( '.' instance_identifier )* ;
15 | cell_clause : 'cell' ( library_identifier '.' )? cell_identifier ;
16 | liblist_clause : 'liblist' ( library_identifier )* ;
17 | use_clause : 'use' ( library_identifier '.' )? cell_identifier ( ':' 'config' )?
18 | | 'use' named_parameter_assignment ( ',' named_parameter_assignment )* ( ':' 'config' )?
19 | | 'use' ( library_identifier '.' )? cell_identifier named_parameter_assignment
20 | ( ',' named_parameter_assignment )* ( ':' 'config' )? ;
21 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Constraints.g4:
--------------------------------------------------------------------------------
1 | grammar Constraints;
2 | import PackageItems;
3 |
4 | constraint_declaration : ( 'static' )? 'constraint' constraint_identifier constraint_block ;
5 | constraint_block : '{' ( constraint_block_item )* '}' ;
6 | constraint_block_item : 'solve' solve_before_list 'before' solve_before_list ';'
7 | | constraint_expression ;
8 | solve_before_list : constraint_primary ( ',' constraint_primary )* ;
9 | constraint_primary : ( implicit_class_handle '.' | class_scope )? hierarchical_identifier select ;
10 | constraint_expression : ( 'soft' )? expression_or_dist ';'
11 | | uniqueness_constraint ';'
12 | | expression '–>' constraint_set
13 | | 'if' '(' expression ')' constraint_set ( 'else' constraint_set )?
14 | | 'foreach' '(' ps_or_hierarchical_array_identifier '[' loop_variables ']' ')' constraint_set
15 | | 'disable' 'soft' constraint_primary ';' ;
16 | uniqueness_constraint : 'unique' '{' open_range_list '}' ;
17 | constraint_set : constraint_expression
18 | | '{' ( constraint_expression )* '}' ;
19 | dist_list : dist_item ( ',' dist_item )* ;
20 | dist_item : value_range ( dist_weight )? ;
21 | dist_weight : ':=' expression | ':/' expression ;
22 | constraint_prototype : ( constraint_prototype_qualifier )? ( 'static' )? 'constraint'
23 | constraint_identifier ';' ;
24 | constraint_prototype_qualifier : 'extern' | 'pure' ;
25 | extern_constraint_declaration : ( 'static' )? 'constraint' class_scope constraint_identifier
26 | constraint_block ;
27 | identifier_list : identifier ( ',' identifier )* ;
28 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ContinuousAssignmentAndNetAliasStatements.g4:
--------------------------------------------------------------------------------
1 | grammar ContinuousAssignmentAndNetAliasStatements;
2 | import ProceduralBlocksAndAssignments;
3 |
4 | continuous_assign : 'assign' ( drive_strength )? ( delay3 )? list_of_net_assignments ';'
5 | | 'assign' ( delay_control )? list_of_variable_assignments ';' ;
6 | list_of_net_assignments : net_assignment ( ',' net_assignment )* ;
7 | list_of_variable_assignments : variable_assignment ( ',' variable_assignment )* ;
8 | net_alias : 'alias' net_lvalue '=' net_lvalue ( '=' net_lvalue )* ';' ;
9 | net_assignment : net_lvalue '=' expression ;
10 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/DeclarationAssignments.g4:
--------------------------------------------------------------------------------
1 | grammar DeclarationAssignments;
2 | import DeclarationRanges;
3 |
4 | defparam_assignment : hierarchical_parameter_identifier '=' constant_mintypmax_expression ;
5 | net_decl_assignment : net_identifier ( unpacked_dimension )* ( '=' expression )? ;
6 | param_assignment : parameter_identifier ( unpacked_dimension )* ( '=' constant_param_expression )? ;
7 | specparam_assignment : specparam_identifier '=' constant_mintypmax_expression
8 | | pulse_control_specparam ;
9 | type_assignment : type_identifier ( '=' data_type )? ;
10 | pulse_control_specparam : 'PATHPULSE$' '=' '(' reject_limit_value ( ',' error_limit_value )? ')'
11 | | 'PATHPULSE$' specify_input_terminal_descriptor '$' specify_output_terminal_descriptor '='
12 | '(' reject_limit_value ( ',' error_limit_value )? ')' ;
13 | error_limit_value : limit_value ;
14 | reject_limit_value : limit_value ;
15 | limit_value : constant_mintypmax_expression ;
16 | variable_decl_assignment : variable_identifier ( variable_dimension )* ( '=' expression )?
17 | | dynamic_array_variable_identifier unsized_dimension ( variable_dimension )* ( '=' dynamic_array_new )?
18 | | class_variable_identifier ( '=' class_new )? ;
19 | class_new : ( class_scope )? 'new' ( '(' list_of_arguments ')' )?
20 | | 'new' expression ;
21 | dynamic_array_new : 'new' '[' expression ']' ( '(' expression ')' )? ;
22 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/DeclarationDataTypes.g4:
--------------------------------------------------------------------------------
1 | grammar DeclarationDataTypes;
2 | import DeclarationLists;
3 |
4 | data_type : integer_vector_type ( signing )? ( packed_dimension )*
5 | | integer_atom_type ( signing )?
6 | | non_integer_type
7 | | struct_union ( 'packed' ( signing )? )? '{' struct_union_member ( struct_union_member )* '}'
8 | ( packed_dimension )*
9 | | 'enum' ( enum_base_type )? '{' enum_name_declaration ( ',' enum_name_declaration )* '}'
10 | ( packed_dimension )*
11 | | 'string'
12 | | 'chandle'
13 | | 'virtual' ( 'interface' )? interface_identifier ( parameter_value_assignment )?
14 | ( '.' modport_identifier )?
15 | | ( class_scope | package_scope )? type_identifier ( packed_dimension )*
16 | | class_type
17 | | 'event'
18 | | ps_covergroup_identifier
19 | | type_reference ;
20 | data_type_or_implicit : data_type | implicit_data_type ;
21 | implicit_data_type : ( signing )? ( packed_dimension )* ;
22 | enum_base_type : integer_atom_type ( signing )?
23 | | integer_vector_type ( signing )? ( packed_dimension )?
24 | | type_identifier ( packed_dimension )? ;
25 | enum_name_declaration : enum_identifier ( '[' integral_number ( ':' integral_number )? ']' )?
26 | ( '=' constant_expression )? ;
27 | class_scope : class_type '::' ;
28 | class_type : ps_class_identifier ( parameter_value_assignment )?
29 | ( '::' class_identifier ( parameter_value_assignment )? )* ;
30 | integer_type : integer_vector_type | integer_atom_type ;
31 | integer_atom_type : 'byte' | 'shortint' | 'int' | 'longint' | 'integer' | 'time' ;
32 | integer_vector_type : 'bit' | 'logic' | 'reg' ;
33 | non_integer_type : 'shortreal' | 'real' | 'realtime' ;
34 | net_type : 'supply0' | 'supply1' | 'tri' | 'triand' | 'trior' | 'trireg' | 'tri0' | 'tri1' | 'uwire'
35 | | 'wire' | 'wand' | 'wor' ;
36 | net_port_type : ( net_type )? data_type_or_implicit
37 | | net_type_identifier
38 | | 'interconnect' implicit_data_type ;
39 | variable_port_type : var_data_type ;
40 | var_data_type : data_type | 'var' data_type_or_implicit ;
41 | signing : 'signed' | 'unsigned' ;
42 | simple_type : integer_type | non_integer_type | ps_type_identifier | ps_parameter_identifier ;
43 | struct_union_member : ( attribute_instance )* ( random_qualifier )? data_type_or_void
44 | list_of_variable_decl_assignments ';' ;
45 | data_type_or_void : data_type | 'void' ;
46 | struct_union : 'struct' | 'union' ( 'tagged' )? ;
47 | type_reference : 'type' '(' expression ')' | 'type' '(' data_type ')' ;
48 | drive_strength : '(' strength0 ',' strength1 ')'
49 | | '(' strength1 ',' strength0 ')'
50 | | '(' strength0 ',' 'highz1' ')'
51 | | '(' strength1 ',' 'highz0' ')'
52 | | '(' 'highz0' ',' strength1 ')'
53 | | '(' 'highz1' ',' strength0 ')' ;
54 | strength0 : 'supply0' | 'strong0' | 'pull0' | 'weak0' ;
55 | strength1 : 'supply1' | 'strong1' | 'pull1' | 'weak1' ;
56 | charge_strength : '(' 'small' ')' | '(' 'medium' ')' | '(' 'large' ')' ;
57 | delay3 : '#' delay_value | '#' '(' mintypmax_expression ( ',' mintypmax_expression
58 | ( ',' mintypmax_expression )? )? ')' ;
59 | delay2 : '#' delay_value | '#' '(' mintypmax_expression ( ',' mintypmax_expression )? ')' ;
60 | delay_value : unsigned_number | real_number | ps_identifier | time_literal | '1step' ;
61 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/DeclarationLists.g4:
--------------------------------------------------------------------------------
1 | grammar DeclarationLists;
2 | import DeclarationAssignments;
3 |
4 | list_of_defparam_assignments : defparam_assignment ( ',' defparam_assignment )* ;
5 | list_of_genvar_identifiers : genvar_identifier ( ',' genvar_identifier )* ;
6 | list_of_interface_identifiers : interface_identifier ( unpacked_dimension )*
7 | ( ',' interface_identifier ( unpacked_dimension )* )* ;
8 | list_of_net_decl_assignments : net_decl_assignment ( ',' net_decl_assignment )* ;
9 | list_of_param_assignments : param_assignment ( ',' param_assignment )* ;
10 | list_of_port_identifiers : port_identifier ( unpacked_dimension )*
11 | ( ',' port_identifier ( unpacked_dimension )* )* ;
12 | list_of_udp_port_identifiers : port_identifier ( ',' port_identifier )* ;
13 | list_of_specparam_assignments : specparam_assignment ( ',' specparam_assignment )* ;
14 | list_of_tf_variable_identifiers : port_identifier ( variable_dimension )* ( '=' expression )?
15 | ( ',' port_identifier ( variable_dimension )* ( '=' expression )? )* ;
16 | list_of_type_assignments : type_assignment ( ',' type_assignment )* ;
17 | list_of_variable_decl_assignments : variable_decl_assignment ( ',' variable_decl_assignment )* ;
18 | list_of_variable_identifiers : variable_identifier ( variable_dimension )*
19 | ( ',' variable_identifier ( variable_dimension )* )* ;
20 | list_of_variable_port_identifiers : port_identifier ( variable_dimension )* ( '=' constant_expression )?
21 | ( ',' port_identifier ( variable_dimension )* ( '=' constant_expression )? )* ;
22 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/DeclarationRanges.g4:
--------------------------------------------------------------------------------
1 | grammar DeclarationRanges;
2 | import FunctionDeclarations;
3 |
4 | unpacked_dimension : '[' constant_range ']'
5 | | '[' constant_expression ']' ;
6 | packed_dimension : '[' constant_range ']'
7 | | unsized_dimension ;
8 | associative_dimension : '[' data_type ']'
9 | | '[' '*' ']' ;
10 | variable_dimension : unsized_dimension
11 | | unpacked_dimension
12 | | associative_dimension
13 | | queue_dimension ;
14 | queue_dimension : '[' '$' ( ':' constant_expression )? ']' ;
15 | unsized_dimension : '[' ']' ;
16 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/DeclarationTypes.g4:
--------------------------------------------------------------------------------
1 | grammar DeclarationTypes;
2 | import DeclarationDataTypes;
3 |
4 | local_parameter_declaration : 'localparam' data_type_or_implicit list_of_param_assignments
5 | | 'localparam' 'type' list_of_type_assignments ;
6 | parameter_declaration : 'parameter' data_type_or_implicit list_of_param_assignments
7 | | 'parameter' 'type' list_of_type_assignments ;
8 | specparam_declaration : 'specparam' ( packed_dimension )? list_of_specparam_assignments ';' ;
9 | inout_declaration : 'inout' net_port_type list_of_port_identifiers ;
10 | input_declaration : 'input' net_port_type list_of_port_identifiers
11 | | 'input' variable_port_type list_of_variable_identifiers ;
12 | output_declaration : 'output' net_port_type list_of_port_identifiers
13 | | 'output' variable_port_type list_of_variable_port_identifiers ;
14 | interface_port_declaration : interface_identifier list_of_interface_identifiers
15 | | interface_identifier '.' modport_identifier list_of_interface_identifiers ;
16 | ref_declaration : 'ref' variable_port_type list_of_variable_identifiers ;
17 | data_declaration : ( 'const' )? ( 'var' )? ( lifetime )? data_type_or_implicit
18 | list_of_variable_decl_assignments ';'
19 | | type_declaration
20 | | package_import_declaration
21 | | net_type_declaration ;
22 | package_import_declaration : 'import' package_import_item ( ',' package_import_item )* ';' ;
23 | package_import_item : package_identifier '::' identifier
24 | | package_identifier '::' '*' ;
25 | package_export_declaration : 'export' '*::*' ';'
26 | | 'export' package_import_item ( ',' package_import_item )* ';' ;
27 | genvar_declaration : 'genvar' list_of_genvar_identifiers ';' ;
28 | net_declaration : net_type ( drive_strength | charge_strength )? ( 'vectored' | 'scalared' )?
29 | data_type_or_implicit ( delay3 )? list_of_net_decl_assignments ';'
30 | | net_type_identifier ( delay_control )? list_of_net_decl_assignments ';'
31 | | 'interconnect' implicit_data_type ( '#' delay_value )? net_identifier ( unpacked_dimension )*
32 | ( ',' net_identifier ( unpacked_dimension )* )? ';' ;
33 | type_declaration : 'typedef' data_type type_identifier ( variable_dimension )* ';'
34 | | 'typedef' interface_instance_identifier constant_bit_select '.' type_identifier type_identifier ';'
35 | | 'typedef' ( 'enum' | 'struct' | 'union' | 'class' | 'interface' 'class' )? type_identifier ';' ;
36 | net_type_declaration : 'nettype' data_type net_type_identifier ( 'with'
37 | ( package_scope | class_scope )? tf_identifier )? ';'
38 | | 'nettype' ( package_scope | class_scope )? net_type_identifier net_type_identifier ';' ;
39 | lifetime : 'static' | 'automatic' ;
40 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ExpressionLeftsideValues.g4:
--------------------------------------------------------------------------------
1 | grammar ExpressionLeftsideValues;
2 | import Operators;
3 |
4 | net_lvalue : ps_or_hierarchical_net_identifier constant_select
5 | | '{' net_lvalue ( ',' net_lvalue )* '}'
6 | | ( assignment_pattern_expression_type )? assignment_pattern_net_lvalue ;
7 | variable_lvalue : ( implicit_class_handle '.' | package_scope )? hierarchical_variable_identifier select
8 | | '{' variable_lvalue ( ',' variable_lvalue )* '}'
9 | | ( assignment_pattern_expression_type )? assignment_pattern_variable_lvalue
10 | | streaming_concatenation ;
11 | nonrange_variable_lvalue : ( implicit_class_handle '.' | package_scope )?
12 | hierarchical_variable_identifier nonrange_select ;
13 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Expressions.g4:
--------------------------------------------------------------------------------
1 | grammar Expressions;
2 | import Primaries;
3 |
4 | inc_or_dec_expression : inc_or_dec_operator ( attribute_instance )* variable_lvalue
5 | | variable_lvalue ( attribute_instance )* inc_or_dec_operator ;
6 | constant_expression : constant_primary
7 | | unary_operator ( attribute_instance )* constant_primary
8 | | constant_expression binary_operator ( attribute_instance )* constant_expression
9 | | constant_expression '?' ( attribute_instance )* constant_expression ':' constant_expression ;
10 | constant_mintypmax_expression : constant_expression
11 | | constant_expression ':' constant_expression ':' constant_expression ;
12 | constant_param_expression : constant_mintypmax_expression | data_type | '$' ;
13 | param_expression : mintypmax_expression | data_type | '$' ;
14 | constant_range_expression : constant_expression | constant_part_select_range ;
15 | constant_part_select_range : constant_range | constant_indexed_range ;
16 | constant_range : constant_expression ':' constant_expression ;
17 | constant_indexed_range : constant_expression '+:' constant_expression
18 | | constant_expression '-:' constant_expression ;
19 | string_or_expression : string_literal | expression ;
20 | expression : primary
21 | | unary_operator ( attribute_instance )* primary
22 | | inc_or_dec_expression
23 | | '(' operator_assignment ')'
24 | | expression binary_operator ( attribute_instance )* expression
25 | | expression ( '&&&' expression )* '?' ( attribute_instance )* expression ':' expression
26 | | expression ( '&&&' expression 'matches' pattern )* '?' ( attribute_instance )* expression ':' expression
27 | | expression 'matches' pattern ( '&&&' expression )* '?' ( attribute_instance )* expression ':' expression
28 | | expression 'matches' pattern ( '&&&' expression 'matches' pattern )* '?' ( attribute_instance )* expression ':' expression
29 | | expression 'inside' '{' open_range_list '}'
30 | | tagged_union_expression ;
31 | tagged_union_expression : 'tagged' member_identifier ( expression )? ;
32 | value_range : expression | '[' expression ':' expression ']' ;
33 | mintypmax_expression : expression | expression ':' expression ':' expression ;
34 | module_path_conditional_expression : module_path_expression '?' ( attribute_instance )*
35 | module_path_expression ':' module_path_expression ;
36 | module_path_expression : module_path_primary
37 | | unary_module_path_operator ( attribute_instance )* module_path_primary
38 | | module_path_expression binary_module_path_operator ( attribute_instance )* module_path_expression
39 | | module_path_expression '?' ( attribute_instance )* module_path_expression ':' module_path_expression ;
40 | module_path_mintypmax_expression : module_path_expression
41 | | module_path_expression ':' module_path_expression ':' module_path_expression ;
42 | part_select_range : constant_range | indexed_range ;
43 | indexed_range : expression '+:' constant_expression
44 | | expression '-:' constant_expression ;
45 | genvar_expression : constant_expression ;
46 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/FunctionDeclarations.g4:
--------------------------------------------------------------------------------
1 | grammar FunctionDeclarations;
2 | import TaskDeclarations;
3 |
4 | function_data_type_or_implicit : data_type_or_void
5 | | implicit_data_type ;
6 | function_declaration : 'function' ( lifetime )? function_body_declaration ;
7 | function_body_declaration : function_data_type_or_implicit
8 | ( interface_identifier '.' | class_scope )? function_identifier ';'
9 | ( tf_item_declaration )*
10 | ( function_statement_or_null )*
11 | 'endfunction' ( ':' function_identifier )?
12 | | function_data_type_or_implicit
13 | ( interface_identifier '.' | class_scope )? function_identifier '(' ( tf_port_list )? ')' ';'
14 | ( block_item_declaration )*
15 | ( function_statement_or_null )*
16 | 'endfunction' ( ':' function_identifier )? ;
17 | function_prototype : 'function' data_type_or_void function_identifier ( '(' ( tf_port_list )? ')' )? ;
18 | dpi_import_export : 'import' dpi_spec_string ( dpi_function_import_property )? ( c_identifier '=' )?
19 | dpi_function_proto ';'
20 | | 'import' dpi_spec_string ( dpi_task_import_property )? ( c_identifier '=' )? dpi_task_proto ';'
21 | | 'export' dpi_spec_string ( c_identifier '=' )? 'function' function_identifier ';'
22 | | 'export' dpi_spec_string ( c_identifier '=' )? 'task' task_identifier ';' ;
23 | dpi_spec_string : '"DPI-C"' | '"DPI"' ;
24 | dpi_function_import_property : 'context' | 'pure' ;
25 | dpi_task_import_property : 'context' ;
26 | dpi_function_proto : function_prototype ;
27 | dpi_task_proto : task_prototype ;
28 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/GeneratedInstantiation.g4:
--------------------------------------------------------------------------------
1 | grammar GeneratedInstantiation;
2 | import UDPDeclaration;
3 |
4 | generate_region : 'generate' ( generate_item )* 'endgenerate';
5 | loop_generate_construct :
6 | 'for' '(' genvar_initialization ';' genvar_expression ';' genvar_iteration ')' generate_block ;
7 | genvar_initialization : ( 'genvar' )? genvar_identifier '=' constant_expression ;
8 | genvar_iteration : genvar_identifier assignment_operator genvar_expression
9 | | inc_or_dec_operator genvar_identifier
10 | | genvar_identifier inc_or_dec_operator ;
11 | conditional_generate_construct : if_generate_construct | case_generate_construct ;
12 | if_generate_construct : 'if' '(' constant_expression ')' generate_block ( 'else' generate_block )? ;
13 | case_generate_construct : 'case' '(' constant_expression ')' case_generate_item ( case_generate_item )*
14 | 'endcase' ;
15 | case_generate_item : constant_expression ( ',' constant_expression )* ':' generate_block
16 | | 'default' ( ':' )? generate_block ;
17 | generate_block : generate_item | ( generate_block_identifier ':' )? 'begin'
18 | ( ':' generate_block_identifier )? ( generate_item )* 'end' ( ':' generate_block_identifier )? ;
19 | generate_item : module_or_generate_item | interface_or_generate_item | checker_or_generate_item ;
20 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Instantiation.g4:
--------------------------------------------------------------------------------
1 | grammar Instantiation;
2 | import GeneratedInstantiation;
3 |
4 | module_instantiation : module_identifier ( parameter_value_assignment )? hierarchical_instance
5 | ( ',' hierarchical_instance )* ';' ;
6 | parameter_value_assignment : '#' '(' ( list_of_parameter_assignments )? ')' ;
7 | list_of_parameter_assignments : ordered_parameter_assignment ( ',' ordered_parameter_assignment )*
8 | | named_parameter_assignment ( ',' named_parameter_assignment )* ;
9 | ordered_parameter_assignment : param_expression ;
10 | named_parameter_assignment : '.' parameter_identifier '(' ( param_expression )? ')' ;
11 | hierarchical_instance : name_of_instance '(' ( list_of_port_connections )? ')' ;
12 | name_of_instance : instance_identifier ( unpacked_dimension )* ;
13 | list_of_port_connections : ordered_port_connection ( ',' ordered_port_connection )*
14 | | named_port_connection ( ',' named_port_connection )* ;
15 | ordered_port_connection : ( attribute_instance )* ( expression )? ;
16 | named_port_connection : ( attribute_instance )* '.' port_identifier ( '(' ( expression )? ')' )?
17 | | ( attribute_instance )* '.*' ;
18 | interface_instantiation : interface_identifier ( parameter_value_assignment )? hierarchical_instance
19 | ( ',' hierarchical_instance )* ';' ;
20 | program_instantiation : program_identifier ( parameter_value_assignment )? hierarchical_instance
21 | ( ',' hierarchical_instance )* ';' ;
22 | checker_instantiation : ps_checker_identifier name_of_instance
23 | '(' ( list_of_checker_port_connections )? ')' ';' ;
24 | list_of_checker_port_connections : ordered_checker_port_connection
25 | ( ',' ordered_checker_port_connection )*
26 | | named_checker_port_connection ( ',' named_checker_port_connection )* ;
27 | ordered_checker_port_connection : ( attribute_instance )* ( property_actual_arg )? ;
28 | named_checker_port_connection : ( attribute_instance )* '.' formal_port_identifier
29 | ( '(' ( property_actual_arg )? ')' )?
30 | | ( attribute_instance )* '.*' ;
31 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/InterfaceDeclarations.g4:
--------------------------------------------------------------------------------
1 | grammar InterfaceDeclarations;
2 | import AssertionDeclarations;
3 |
4 | modport_declaration : 'modport' modport_item ( ',' modport_item )* ';' ;
5 | modport_item : modport_identifier '(' modport_ports_declaration
6 | ( ',' modport_ports_declaration )* ')' ;
7 | modport_ports_declaration : ( attribute_instance )* modport_simple_ports_declaration
8 | | ( attribute_instance )* modport_tf_ports_declaration
9 | | ( attribute_instance )* modport_clocking_declaration ;
10 | modport_clocking_declaration : 'clocking' clocking_identifier ;
11 | modport_simple_ports_declaration : port_direction modport_simple_port ( ',' modport_simple_port )* ;
12 | modport_simple_port : port_identifier | '.' port_identifier '(' ( expression )? ')' ;
13 | modport_tf_ports_declaration : import_export modport_tf_port ( ',' modport_tf_port )* ;
14 | modport_tf_port : method_prototype | tf_identifier ;
15 | import_export : 'import' | 'export' ;
16 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/InterfaceItems.g4:
--------------------------------------------------------------------------------
1 | grammar InterfaceItems;
2 | import ProgramItems;
3 |
4 | interface_or_generate_item : ( attribute_instance )* module_common_item
5 | | ( attribute_instance )* extern_tf_declaration ;
6 | extern_tf_declaration : 'extern' method_prototype ';'
7 | | 'extern' 'forkjoin' task_prototype ';' ;
8 | interface_item : port_declaration ';'
9 | | non_port_interface_item ;
10 | non_port_interface_item : generate_region
11 | | interface_or_generate_item
12 | | program_declaration
13 | | modport_declaration
14 | | interface_declaration
15 | | timeunits_declaration ;
16 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/LetDeclarations.g4:
--------------------------------------------------------------------------------
1 | grammar LetDeclarations;
2 | import PrimitiveInstantiationAndInstances;
3 |
4 | let_declaration : 'let' let_identifier ( '(' ( let_port_list )? ')' )? '=' expression ';' ;
5 | let_identifier : identifier ;
6 | let_port_list : let_port_item ( ',' let_port_item )* ;
7 | let_port_item : ( attribute_instance )* let_formal_type formal_port_identifier ( variable_dimension )*
8 | ( '=' expression )? ;
9 | let_formal_type : data_type_or_implicit | 'untyped' ;
10 | let_expression : ( package_scope )? let_identifier ( '(' ( let_list_of_arguments )? ')' )? ;
11 | let_list_of_arguments : ( let_actual_arg )? ( ',' ( let_actual_arg )? )*
12 | ( ',' '.' identifier '(' ( let_actual_arg )? ')' )*
13 | | '.' identifier '(' ( let_actual_arg )? ')' ( ',' '.' identifier '(' ( let_actual_arg )? ')' )* ;
14 | let_actual_arg : expression ;
15 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/LexRules.g4:
--------------------------------------------------------------------------------
1 | grammar LexRules;
2 |
3 | MACROMODULE : 'macromodule' ;
4 | MODULE : 'module' ;
5 | EXP : [eE] ;
6 |
7 | fragment APOSTROPHE_FRAG : ['] ;
8 | fragment S_FRAG : [sS] ;
9 | fragment D_FRAG : [dD] ;
10 | fragment B_FRAG : [bB] ;
11 | fragment O_FRAG : [oO] ;
12 | fragment H_FRAG : [hH] ;
13 | fragment Z_FRAG : [zZ] ;
14 | fragment X_FRAG : [xX] ;
15 | fragment ZERO_FRAG : [0] ;
16 | fragment ONE_FRAG : [1] ;
17 |
18 | DECIMAL_BASE : APOSTROPHE_FRAG S_FRAG? D_FRAG ;
19 | BINARY_BASE : APOSTROPHE_FRAG S_FRAG? B_FRAG ;
20 | OCTAL_BASE : APOSTROPHE_FRAG S_FRAG? O_FRAG ;
21 | HEX_BASE : APOSTROPHE_FRAG S_FRAG? H_FRAG ;
22 | APOSTROPHE_ZERO : APOSTROPHE_FRAG ZERO_FRAG ;
23 | APOSTROPHE_ONE : APOSTROPHE_FRAG ONE_FRAG ;
24 | APOSTROPHE_Z_OR_X : APOSTROPHE_FRAG ( Z_FRAG | X_FRAG ) ;
25 | ZERO : [0] ;
26 | ONE : [1] ;
27 | TWO : [2] ;
28 | OCTAL_DIGIT : [3-7] ;
29 | DECIMAL_DIGIT : [89] ;
30 |
31 | APOSTROPHE : ['] ;
32 |
33 | B : [bB] ;
34 | F : [fF] ;
35 | R : [rR] ;
36 | P : [pP] ;
37 | N : [nN] ;
38 | LOWER_S : [s] ;
39 | LOWER_MS : [m][s] ;
40 | LOWER_US : [u][s] ;
41 | LOWER_NS : [n][s] ;
42 | LOWER_PS : [p][s] ;
43 | LOWER_FS : [f][s] ;
44 | HEX_DIGIT : [a-fA-F] ;
45 | X_DIGIT : [xX] ;
46 | Z_DIGIT : [zZ] ;
47 | UNDERSCORE : [_] ;
48 | QUESTION : [?] ;
49 |
50 | C_IDENTIFIER : [a-zA-Z_] ( [a-zA-Z0-9_] )* ;
51 | SIMPLE_IDENTIFIER : [a-zA-Z_] ( [a-zA-Z0-9_$] )* ;
52 | SYSTEM_TF_IDENTIFIER : '$' [a-zA-Z0-9_$] ( [a-zA-Z0-9_$] )* ;
53 |
54 | ESCAPED_IDENTIFIER : '\\' ( ANY_PRINTABLE_ASCII_CHARACTER_EXCEPT_WHITE_SPACE )* ;
55 |
56 | SPACE : ' ' -> skip ;
57 | TAB : '\t' -> skip ;
58 | NEWLINE : '\r'? '\n' -> skip ;
59 |
60 | /* ANY_PRINTABLE_ASCII_CHARACTER_EXCEPT_WHITE_SPACE : [\u0021-\u007E] ; */
61 | fragment ANY_PRINTABLE_ASCII_CHARACTER_EXCEPT_WHITE_SPACE : [\u0021-\u007E] ;
62 |
63 | /* ANY_ASCII_CHARACTER : [\u0000-\u007F] ; */
64 | ANY_ASCII_CHARACTER : [\u0000-\u007F] ;
65 |
66 | ONE_LINE_COMMENT : '//' (~[\n])* '\n' -> skip ;
67 | BLOCK_COMMENT : '/*' .*? '*/' -> skip ;
68 |
69 | FILENAME : '<' [a-zA-Z0-9_./\\\-]+ '.' ('v' | 'sv' | 'svh' | 'vh' | 'sva' | 'svi' | 'svp' | 'svhp') '>'
70 | | '"' [a-zA-Z0-9_./\\\-]+ '.' ('v' | 'sv' | 'svh' | 'vh' | 'sva' | 'svi' | 'svp' | 'svhp') '"'
71 | | '"' [a-zA-Z0-9_/\\\-]+ '"' ;
72 |
73 | STRING_LITERAL : '"' (~["] | '\\"')* '"' ;
74 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/LoopingStatements.g4:
--------------------------------------------------------------------------------
1 | grammar LoopingStatements;
2 | import SubroutineCallStatements;
3 |
4 | loop_statement : 'forever' statement_or_null
5 | | 'repeat' '(' expression ')' statement_or_null
6 | | 'while' '(' expression ')' statement_or_null
7 | | 'for' '(' ( for_initialization )? ';' ( expression )? ';' ( for_step )? ')' statement_or_null
8 | | 'do' statement_or_null 'while' '(' expression ')' ';'
9 | | 'foreach' '(' ps_or_hierarchical_array_identifier '[' loop_variables ']' ')' statement ;
10 | for_initialization : list_of_variable_assignments
11 | | for_variable_declaration ( ',' for_variable_declaration )* ;
12 | for_variable_declaration : ( 'var' )? data_type variable_identifier '=' expression
13 | ( ',' variable_identifier '=' expression )* ;
14 | for_step : for_step_assignment ( ',' for_step_assignment )* ;
15 | for_step_assignment : operator_assignment | inc_or_dec_expression | function_subroutine_call ;
16 | loop_variables : ( index_variable_identifier )? ( ',' ( index_variable_identifier )? )* ;
17 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ModuleItems.g4:
--------------------------------------------------------------------------------
1 | grammar ModuleItems;
2 | import ConfigurationSourceText;
3 |
4 | elaboration_system_task : '$fatal' ( '(' finish_number ( ',' list_of_arguments )? ')' )? ';'
5 | | '$error' ( '(' ( list_of_arguments )? ')' )? ';'
6 | | '$warning' ( '(' ( list_of_arguments )? ')' )? ';'
7 | | '$info' ( '(' ( list_of_arguments )? ')' )? ';' ;
8 | finish_number : ZERO | ONE | TWO ;
9 | module_common_item : module_or_generate_item_declaration
10 | | interface_instantiation
11 | | program_instantiation
12 | | assertion_item
13 | | bind_directive
14 | | continuous_assign
15 | | net_alias
16 | | initial_construct
17 | | final_construct
18 | | always_construct
19 | | loop_generate_construct
20 | | conditional_generate_construct
21 | | elaboration_system_task
22 | | simulation_control_task ;
23 | simulation_control_task : '$stop' ( '(' finish_number ')' )? ';'
24 | | '$finish' ( '(' finish_number ')' )? ';'
25 | | '$exit' ( '(' finish_number ')' )? ';' ;
26 | module_item : port_declaration ';'
27 | | non_port_module_item ;
28 | module_or_generate_item : ( attribute_instance )* parameter_override
29 | | ( attribute_instance )* gate_instantiation
30 | | ( attribute_instance )* udp_instantiation
31 | | ( attribute_instance )* module_instantiation
32 | | ( attribute_instance )* module_common_item ;
33 | module_or_generate_item_declaration : package_or_generate_item_declaration
34 | | genvar_declaration
35 | | clocking_declaration
36 | | 'default' 'clocking' clocking_identifier ';'
37 | | 'default' 'disable' 'iff' expression_or_dist ';' ;
38 | non_port_module_item : generate_region
39 | | module_or_generate_item
40 | | specify_block
41 | | ( attribute_instance )* specparam_declaration
42 | | program_declaration
43 | | module_declaration
44 | | interface_declaration
45 | | timeunits_declaration ;
46 | parameter_override : 'defparam' list_of_defparam_assignments ';' ;
47 | bind_directive : 'bind' bind_target_scope ( ':' bind_target_instance_list )? bind_instantiation ';'
48 | | 'bind' bind_target_instance bind_instantiation ';' ;
49 | bind_target_scope : module_identifier
50 | | interface_identifier ;
51 | bind_target_instance : hierarchical_identifier constant_bit_select ;
52 | bind_target_instance_list : bind_target_instance ( ',' bind_target_instance )* ;
53 | bind_instantiation : program_instantiation
54 | | module_instantiation
55 | | interface_instantiation
56 | | checker_instantiation ;
57 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ModuleParametersAndPorts.g4:
--------------------------------------------------------------------------------
1 | grammar ModuleParametersAndPorts;
2 | import ModuleItems;
3 |
4 | parameter_port_list : '#' '(' list_of_param_assignments ( ',' parameter_port_declaration )* ')'
5 | | '#' '(' parameter_port_declaration ( ',' parameter_port_declaration )* ')'
6 | | '#' '(' ')' ;
7 | parameter_port_declaration : parameter_declaration
8 | | local_parameter_declaration
9 | | data_type list_of_param_assignments
10 | | 'type' list_of_type_assignments ;
11 | list_of_ports : '(' port ( ',' port )* ')' ;
12 | list_of_port_declarations : '(' ( ( attribute_instance )* ansi_port_declaration
13 | ( ',' ( attribute_instance )* ansi_port_declaration )* )? ')' ;
14 | port_declaration : ( attribute_instance )* inout_declaration
15 | | ( attribute_instance )* input_declaration
16 | | ( attribute_instance )* output_declaration
17 | | ( attribute_instance )* ref_declaration
18 | | ( attribute_instance )* interface_port_declaration ;
19 | port : ( port_expression )?
20 | | '.' port_identifier '(' ( port_expression )? ')' ;
21 | port_expression : port_reference
22 | | '{' port_reference ( ',' port_reference )* '}' ;
23 | port_reference : port_identifier constant_select ;
24 | port_direction : 'input' | 'output' | 'inout' | 'ref' ;
25 | net_port_header : ( port_direction )? net_port_type ;
26 | variable_port_header : ( port_direction )? variable_port_type ;
27 | interface_port_header : interface_identifier ( '.' modport_identifier )?
28 | | 'interface' ( '.' modport_identifier )? ;
29 | ansi_port_declaration : ( net_port_header | interface_port_header )? port_identifier ( unpacked_dimension )*
30 | ( '=' constant_expression )?
31 | | ( variable_port_header )? port_identifier ( variable_dimension )* ( '=' constant_expression )?
32 | | ( port_direction )? '.' port_identifier '(' ( expression )? ')' ;
33 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Numbers.g4:
--------------------------------------------------------------------------------
1 | grammar Numbers;
2 | import Strings;
3 |
4 | number : integral_number | real_number ;
5 | integral_number : decimal_number | octal_number | binary_number | hex_number ;
6 | decimal_number : unsigned_number
7 | | ( size )? decimal_base unsigned_number
8 | | ( size )? decimal_base x_digit ( UNDERSCORE )*
9 | | ( size )? decimal_base z_digit ( UNDERSCORE )* ;
10 | binary_number : ( size )? binary_base binary_value ;
11 | octal_number : ( size )? octal_base octal_value ;
12 | hex_number : ( size )? hex_base hex_value ;
13 | sign : '+' | '-' ;
14 | size : non_zero_unsigned_number ;
15 | non_zero_unsigned_number : non_zero_decimal_digit ( UNDERSCORE | decimal_digit )* ;
16 | real_number : fixed_point_number
17 | | unsigned_number ( '.' unsigned_number )? exp ( sign )? unsigned_number ;
18 | fixed_point_number : unsigned_number '.' unsigned_number ;
19 | exp : EXP ;
20 | unsigned_number : decimal_digit ( UNDERSCORE | decimal_digit )* ;
21 | binary_value : binary_digit ( UNDERSCORE | binary_digit )* ;
22 | octal_value : octal_digit ( UNDERSCORE | octal_digit )* ;
23 | hex_value : hex_digit ( UNDERSCORE | hex_digit )* ;
24 | decimal_base : DECIMAL_BASE ;
25 | binary_base : BINARY_BASE ;
26 | octal_base : OCTAL_BASE ;
27 | hex_base : HEX_BASE ;
28 | non_zero_decimal_digit : ONE | TWO | OCTAL_DIGIT | DECIMAL_DIGIT ;
29 | decimal_digit : ZERO | non_zero_decimal_digit ;
30 | binary_digit : x_digit | z_digit | ZERO | ONE ;
31 | octal_digit : binary_digit | TWO | OCTAL_DIGIT ;
32 | hex_digit : octal_digit | DECIMAL_DIGIT | HEX_DIGIT | B | F ;
33 | x_digit : X_DIGIT ;
34 | z_digit : Z_DIGIT | QUESTION ;
35 | unbased_unsized_literal : APOSTROPHE_ZERO | APOSTROPHE_ONE | APOSTROPHE_Z_OR_X ;
36 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Operators.g4:
--------------------------------------------------------------------------------
1 | grammar Operators;
2 | import Numbers;
3 |
4 | unary_operator : '+' | '-' | '!' | '~' | '&' | '~&' | '|' | '~|' | '^' | '~^' | '^~' ;
5 | binary_operator : '+' | '-' | '*' | '/' | '%' | '==' | '!=' | '===' | '!==' | '==?' | '!=?' | '&&' | '||'
6 | | '**' | '<' | '<=' | '>' | '>=' | '&' | '|' | '^' | '^~' | '~^' | '>>' | '<<' | '>>>' | '<<<' | '->'
7 | | '<->' ;
8 | inc_or_dec_operator : '++' | '--' ;
9 | unary_module_path_operator : '!' | '~' | '&' | '~&' | '|' | '~|' | '^' | '~^' | '^~' ;
10 | binary_module_path_operator : '==' | '!=' | '&&' | '||' | '&' | '|' | '^' | '^~' | '~^' ;
11 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/PackageItems.g4:
--------------------------------------------------------------------------------
1 | grammar PackageItems;
2 | import DeclarationTypes;
3 |
4 | package_item : package_or_generate_item_declaration
5 | | anonymous_program
6 | | include_compiler_directive
7 | | package_export_declaration
8 | | timeunits_declaration ;
9 | package_or_generate_item_declaration : net_declaration
10 | | data_declaration
11 | | task_declaration
12 | | function_declaration
13 | | checker_declaration
14 | | dpi_import_export
15 | | extern_constraint_declaration
16 | | class_declaration
17 | | class_constructor_declaration
18 | | local_parameter_declaration ';'
19 | | parameter_declaration ';'
20 | | covergroup_declaration
21 | | assertion_item_declaration
22 | | ';' ;
23 | anonymous_program : 'program' ';' ( anonymous_program_item )* 'endprogram' ;
24 | anonymous_program_item : task_declaration
25 | | function_declaration
26 | | class_declaration
27 | | covergroup_declaration
28 | | class_constructor_declaration
29 | | ';' ;
30 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ParallelAndSequentialBlocks.g4:
--------------------------------------------------------------------------------
1 | grammar ParallelAndSequentialBlocks;
2 | import Statements;
3 |
4 | action_block : statement_or_null | ( statement )? 'else' statement_or_null ;
5 | seq_block : 'begin' ( ':' block_identifier )? ( block_item_declaration )* ( statement_or_null )* 'end'
6 | ( ':' block_identifier )? ;
7 | par_block : 'fork' ( ':' block_identifier )? ( block_item_declaration )* ( statement_or_null )*
8 | join_keyword ( ':' block_identifier )? ;
9 | join_keyword : 'join' | 'join_any' | 'join_none' ;
10 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Primaries.g4:
--------------------------------------------------------------------------------
1 | grammar Primaries;
2 | import ExpressionLeftsideValues;
3 |
4 | constant_primary : primary_literal
5 | | ps_parameter_identifier constant_select
6 | | specparam_identifier ( '[' constant_range_expression ']' )?
7 | | genvar_identifier
8 | | formal_port_identifier constant_select
9 | | ( package_scope | class_scope )? enum_identifier
10 | | constant_concatenation ( '[' constant_range_expression ']' )?
11 | | constant_multiple_concatenation ( '[' constant_range_expression ']' )?
12 | | subroutine_call
13 | | constant_let_expression
14 | | '(' constant_mintypmax_expression ')'
15 | | ( simple_type | signing | 'string' | 'const' ) APOSTROPHE '(' constant_expression ')'
16 | | constant_primary APOSTROPHE '(' constant_expression ')'
17 | | constant_assignment_pattern_expression
18 | | type_reference
19 | | 'null' ;
20 | primary : primary_literal
21 | | ( class_qualifier | package_scope )? hierarchical_identifier select
22 | | empty_unpacked_array_concatenation
23 | | concatenation ( '[' range_expression ']' )?
24 | | multiple_concatenation ( '[' range_expression ']' )?
25 | | function_subroutine_call
26 | | let_expression
27 | | '(' mintypmax_expression ')'
28 | | ( simple_type | constant_primary | signing | 'string' | 'const' ) APOSTROPHE '(' expression ')'
29 | | assignment_pattern_expression
30 | | streaming_concatenation
31 | | sequence_method_call
32 | | 'this'
33 | | '$'
34 | | 'null' ;
35 | module_path_primary : number
36 | | identifier
37 | | module_path_concatenation
38 | | module_path_multiple_concatenation
39 | | function_subroutine_call
40 | | '(' module_path_mintypmax_expression ')' ;
41 | class_qualifier : ( 'local' '::' )? ( implicit_class_handle '.' | class_scope )? ;
42 | range_expression : expression | part_select_range ;
43 | primary_literal : number | time_literal | unbased_unsized_literal | string_literal ;
44 | time_literal : unsigned_number time_unit | fixed_point_number time_unit ;
45 | time_unit : LOWER_S | LOWER_MS | LOWER_US | LOWER_NS | LOWER_PS | LOWER_FS ;
46 | implicit_class_handle : 'this' | 'super' | 'this' '.' 'super' ;
47 | bit_select : ( '[' expression ']' )* ;
48 | select : ( ( '.' member_identifier bit_select )* '.' member_identifier )? bit_select
49 | ( '[' part_select_range ']' )? ;
50 | nonrange_select : ( ( '.' member_identifier bit_select )* '.' member_identifier )? bit_select ;
51 | constant_bit_select : ( '[' constant_expression ']' )* ;
52 | constant_select : ( ( '.' member_identifier constant_bit_select )* '.' member_identifier )?
53 | constant_bit_select ( '[' constant_part_select_range ']' )? ;
54 | constant_let_expression : let_expression ;
55 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/PrimitiveGateAndSwitchTypes.g4:
--------------------------------------------------------------------------------
1 | grammar PrimitiveGateAndSwitchTypes;
2 | import Instantiation;
3 |
4 | cmos_switchtype : 'cmos' | 'rcmos' ;
5 | enable_gatetype : 'bufif0' | 'bufif1' | 'notif0' | 'notif1' ;
6 | mos_switchtype : 'nmos' | 'pmos' | 'rnmos' | 'rpmos' ;
7 | n_input_gatetype : 'and' | 'nand' | 'or' | 'nor' | 'xor' | 'xnor' ;
8 | n_output_gatetype : 'buf' | 'not' ;
9 | pass_en_switchtype : 'tranif0' | 'tranif1' | 'rtranif1' | 'rtranif0' ;
10 | pass_switchtype : 'tran' | 'rtran' ;
11 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/PrimitiveInstantiationAndInstances.g4:
--------------------------------------------------------------------------------
1 | grammar PrimitiveInstantiationAndInstances;
2 | import PrimitiveStrengths;
3 |
4 | gate_instantiation : cmos_switchtype ( delay3 )? cmos_switch_instance ( ',' cmos_switch_instance )* ';'
5 | | enable_gatetype ( drive_strength )? ( delay3 )? enable_gate_instance ( ',' enable_gate_instance )* ';'
6 | | mos_switchtype ( delay3 )? mos_switch_instance ( ',' mos_switch_instance )* ';'
7 | | n_input_gatetype ( drive_strength )? ( delay2 )? n_input_gate_instance
8 | ( ',' n_input_gate_instance )* ';'
9 | | n_output_gatetype ( drive_strength )? ( delay2 )? n_output_gate_instance
10 | ( ',' n_output_gate_instance )* ';'
11 | | pass_en_switchtype ( delay2 )? pass_enable_switch_instance ( ',' pass_enable_switch_instance )* ';'
12 | | pass_switchtype pass_switch_instance ( ',' pass_switch_instance )* ';'
13 | | 'pulldown' ( pulldown_strength )? pull_gate_instance ( ',' pull_gate_instance )* ';'
14 | | 'pullup' ( pullup_strength )? pull_gate_instance ( ',' pull_gate_instance )* ';' ;
15 | cmos_switch_instance : ( name_of_instance )?
16 | '(' output_terminal ',' input_terminal ',' ncontrol_terminal ',' pcontrol_terminal ')' ;
17 | enable_gate_instance : ( name_of_instance )?
18 | '(' output_terminal ',' input_terminal ',' enable_terminal ')' ;
19 | mos_switch_instance : ( name_of_instance )?
20 | '(' output_terminal ',' input_terminal ',' enable_terminal ')' ;
21 | n_input_gate_instance : ( name_of_instance )?
22 | '(' output_terminal ',' input_terminal ( ',' input_terminal )* ')' ;
23 | n_output_gate_instance : ( name_of_instance )?
24 | '(' output_terminal ( ',' output_terminal )* ',' input_terminal ')' ;
25 | pass_switch_instance : ( name_of_instance )? '(' inout_terminal ',' inout_terminal ')' ; pass_enable_switch_instance : ( name_of_instance )?
26 | '(' inout_terminal ',' inout_terminal ',' enable_terminal ')' ;
27 | pull_gate_instance : ( name_of_instance )? '(' output_terminal ')' ;
28 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/PrimitiveStrengths.g4:
--------------------------------------------------------------------------------
1 | grammar PrimitiveStrengths;
2 | import PrimitiveTerminals;
3 |
4 | pulldown_strength : '(' strength0 ',' strength1 ')'
5 | | '(' strength1 ',' strength0 ')'
6 | | '(' strength0 ')' ;
7 | pullup_strength : '(' strength0 ',' strength1 ')'
8 | | '(' strength1 ',' strength0 ')'
9 | | '(' strength1 ')' ;
10 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/PrimitiveTerminals.g4:
--------------------------------------------------------------------------------
1 | grammar PrimitiveTerminals;
2 | import PrimitiveGateAndSwitchTypes;
3 |
4 | enable_terminal : expression ;
5 | inout_terminal : net_lvalue ;
6 | input_terminal : expression ;
7 | ncontrol_terminal : expression ;
8 | output_terminal : net_lvalue ;
9 | pcontrol_terminal : expression ;
10 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ProceduralBlocksAndAssignments.g4:
--------------------------------------------------------------------------------
1 | grammar ProceduralBlocksAndAssignments;
2 | import ParallelAndSequentialBlocks;
3 |
4 | initial_construct : 'initial' statement_or_null ;
5 | always_construct : always_keyword statement ;
6 | always_keyword : 'always' | 'always_comb' | 'always_latch' | 'always_ff' ;
7 | final_construct : 'final' function_statement ;
8 | blocking_assignment : variable_lvalue '=' delay_or_event_control expression
9 | | nonrange_variable_lvalue '=' dynamic_array_new
10 | | ( implicit_class_handle '.' | class_scope | package_scope )? hierarchical_variable_identifier
11 | select '=' class_new
12 | | operator_assignment ;
13 | operator_assignment : variable_lvalue assignment_operator expression ;
14 | assignment_operator : '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>='
15 | | '<<<=' | '>>>=' ;
16 | nonblocking_assignment : variable_lvalue '<=' ( delay_or_event_control )? expression ;
17 | procedural_continuous_assignment : 'assign' variable_assignment
18 | | 'deassign' variable_lvalue
19 | | 'force' variable_assignment
20 | | 'force' net_assignment
21 | | 'release' variable_lvalue
22 | | 'release' net_lvalue ;
23 | variable_assignment : variable_lvalue '=' expression ;
24 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/ProgramItems.g4:
--------------------------------------------------------------------------------
1 | grammar ProgramItems;
2 | import CheckerItems;
3 |
4 | program_item : port_declaration ';'
5 | | non_port_program_item ;
6 | non_port_program_item : ( attribute_instance )* continuous_assign
7 | | ( attribute_instance )* module_or_generate_item_declaration
8 | | ( attribute_instance )* initial_construct
9 | | ( attribute_instance )* final_construct
10 | | ( attribute_instance )* concurrent_assertion_item
11 | | timeunits_declaration
12 | | program_generate_item ;
13 | program_generate_item : loop_generate_construct
14 | | conditional_generate_construct
15 | | generate_region
16 | | elaboration_system_task
17 | | simulation_control_task ;
18 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Randsequence.g4:
--------------------------------------------------------------------------------
1 | grammar Randsequence;
2 | import SpecifyBlockDeclaration;
3 |
4 | randsequence_statement : 'randsequence' '(' ( production_identifier )? ')' production ( production )*
5 | 'endsequence' ;
6 | production : ( data_type_or_void )? production_identifier ( '(' tf_port_list ')' )? ':' rs_rule
7 | ( '|' rs_rule )* ';' ;
8 | rs_rule : rs_production_list ( ':=' weight_specification ( rs_code_block )? )? ;
9 | rs_production_list : rs_prod ( rs_prod )*
10 | | 'rand' 'join' ( '(' expression ')' )? production_item production_item ( production_item )* ;
11 | weight_specification : integral_number | ps_identifier | '(' expression ')' ;
12 | rs_code_block : '{' ( data_declaration )* ( statement_or_null )* '}' ;
13 | rs_prod : production_item | rs_code_block | rs_if_else | rs_repeat | rs_case ;
14 | production_item : production_identifier ( '(' list_of_arguments ')' )? ;
15 | rs_if_else : 'if' '(' expression ')' production_item ( 'else' production_item )? ;
16 | rs_repeat : 'repeat' '(' expression ')' production_item ;
17 | rs_case : 'case' '(' case_expression ')' rs_case_item ( rs_case_item )* 'endcase' ;
18 | rs_case_item : case_item_expression ( ',' case_item_expression )* ':' production_item ';'
19 | | 'default' ( ':' )? production_item ';' ;
20 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/SpecifyBlockDeclaration.g4:
--------------------------------------------------------------------------------
1 | grammar SpecifyBlockDeclaration;
2 | import SpecifyPathDeclarations;
3 |
4 | specify_block : 'specify' ( specify_item )* 'endspecify' ;
5 | specify_item : specparam_declaration
6 | | pulsestyle_declaration
7 | | showcancelled_declaration
8 | | path_declaration
9 | | system_timing_check ;
10 | pulsestyle_declaration : 'pulsestyle_onevent' list_of_path_outputs ';'
11 | | 'pulsestyle_ondetect' list_of_path_outputs ';' ;
12 | showcancelled_declaration : 'showcancelled' list_of_path_outputs ';'
13 | | 'noshowcancelled' list_of_path_outputs ';' ;
14 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/SpecifyBlockTerminals.g4:
--------------------------------------------------------------------------------
1 | grammar SpecifyBlockTerminals;
2 | import SpecifyPathDelays;
3 |
4 | specify_input_terminal_descriptor : input_identifier ( '[' constant_range_expression ']' )? ;
5 | specify_output_terminal_descriptor : output_identifier ( '[' constant_range_expression ']' )? ; input_identifier : input_port_identifier
6 | | inout_port_identifier
7 | | interface_identifier '.' port_identifier ;
8 | output_identifier : output_port_identifier
9 | | inout_port_identifier
10 | | interface_identifier '.' port_identifier ;
11 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/SpecifyPathDeclarations.g4:
--------------------------------------------------------------------------------
1 | grammar SpecifyPathDeclarations;
2 | import SpecifyBlockTerminals;
3 |
4 | path_declaration : simple_path_declaration ';'
5 | | edge_sensitive_path_declaration ';'
6 | | state_dependent_path_declaration ';' ;
7 | simple_path_declaration : parallel_path_description '=' path_delay_value
8 | | full_path_description '=' path_delay_value ;
9 | parallel_path_description : '(' specify_input_terminal_descriptor ( polarity_operator )? '=>'
10 | specify_output_terminal_descriptor ')' ;
11 | full_path_description : '(' list_of_path_inputs ( polarity_operator )? '*>' list_of_path_outputs ')' ;
12 | list_of_path_inputs : specify_input_terminal_descriptor ( ',' specify_input_terminal_descriptor )* ;
13 | list_of_path_outputs : specify_output_terminal_descriptor ( ',' specify_output_terminal_descriptor )* ;
14 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/SpecifyPathDelays.g4:
--------------------------------------------------------------------------------
1 | grammar SpecifyPathDelays;
2 | import SystemTimingChecks;
3 |
4 | path_delay_value : list_of_path_delay_expressions | '(' list_of_path_delay_expressions ')' ;
5 | list_of_path_delay_expressions : t_path_delay_expression
6 | | trise_path_delay_expression ',' tfall_path_delay_expression
7 | | trise_path_delay_expression ',' tfall_path_delay_expression ',' tz_path_delay_expression
8 | | t01_path_delay_expression ',' t10_path_delay_expression ',' t0z_path_delay_expression ','
9 | tz1_path_delay_expression ',' t1z_path_delay_expression ',' tz0_path_delay_expression
10 | | t01_path_delay_expression ',' t10_path_delay_expression ',' t0z_path_delay_expression ','
11 | tz1_path_delay_expression ',' t1z_path_delay_expression ',' tz0_path_delay_expression ','
12 | t0x_path_delay_expression ',' tx1_path_delay_expression ',' t1x_path_delay_expression ','
13 | tx0_path_delay_expression ',' txz_path_delay_expression ',' tzx_path_delay_expression ;
14 | t_path_delay_expression : path_delay_expression ;
15 | trise_path_delay_expression : path_delay_expression ;
16 | tfall_path_delay_expression : path_delay_expression ;
17 | tz_path_delay_expression : path_delay_expression ;
18 | t01_path_delay_expression : path_delay_expression ;
19 | t10_path_delay_expression : path_delay_expression ;
20 | t0z_path_delay_expression : path_delay_expression ;
21 | tz1_path_delay_expression : path_delay_expression ;
22 | t1z_path_delay_expression : path_delay_expression ;
23 | tz0_path_delay_expression : path_delay_expression ;
24 | t0x_path_delay_expression : path_delay_expression ;
25 | tx1_path_delay_expression : path_delay_expression ;
26 | t1x_path_delay_expression : path_delay_expression ;
27 | tx0_path_delay_expression : path_delay_expression ;
28 | txz_path_delay_expression : path_delay_expression ;
29 | tzx_path_delay_expression : path_delay_expression ;
30 | path_delay_expression : constant_mintypmax_expression ;
31 | edge_sensitive_path_declaration : parallel_edge_sensitive_path_description '=' path_delay_value
32 | | full_edge_sensitive_path_description '=' path_delay_value ;
33 | parallel_edge_sensitive_path_description :
34 | '(' ( edge_identifier )? specify_input_terminal_descriptor ( polarity_operator )? '=>'
35 | '(' specify_output_terminal_descriptor ( polarity_operator )? ':' data_source_expression ')' ')' ;
36 | full_edge_sensitive_path_description : '(' ( edge_identifier )? list_of_path_inputs
37 | ( polarity_operator )? '*>' '(' list_of_path_outputs ( polarity_operator )? ':'
38 | data_source_expression ')' ')' ;
39 | data_source_expression : expression ;
40 | edge_identifier : 'posedge' | 'negedge' | 'edge' ;
41 | state_dependent_path_declaration : 'if' '(' module_path_expression ')' simple_path_declaration
42 | | 'if' '(' module_path_expression ')' edge_sensitive_path_declaration
43 | | 'ifnone' simple_path_declaration ;
44 | polarity_operator : '+' | '-' ;
45 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Statements.g4:
--------------------------------------------------------------------------------
1 | grammar Statements;
2 | import TimingControlStatements;
3 |
4 | statement_or_null : statement | ( attribute_instance )* ';' ;
5 | statement : ( block_identifier ':' )? ( attribute_instance )* statement_item ;
6 | statement_item : blocking_assignment ';'
7 | | nonblocking_assignment ';'
8 | | procedural_continuous_assignment ';'
9 | | case_statement
10 | | conditional_statement
11 | | inc_or_dec_expression ';'
12 | | subroutine_call_statement
13 | | disable_statement
14 | | event_trigger
15 | | loop_statement
16 | | jump_statement
17 | | par_block
18 | | procedural_timing_control_statement
19 | | seq_block
20 | | wait_statement
21 | | procedural_assertion_statement
22 | | clocking_drive ';'
23 | | randsequence_statement
24 | | randcase_statement
25 | | expect_property_statement
26 | | display_tasks
27 | | monitor_tasks
28 | | timescale_compiler_directive
29 | | include_compiler_directive
30 | | simulation_control_task ;
31 | display_tasks : display_task_name ( '(' list_of_arguments_with_strings ')' )? ';' ;
32 | display_task_name : '$display' | '$displayb' | '$displayo' | '$displayh'
33 | | '$write' | '$writeb' | '$writeo' | '$writeh' ;
34 | monitor_tasks : monitor_task_name ( '(' list_of_arguments_with_strings ')' )? ';'
35 | | '$monitoron' ';'
36 | | '$monitoroff' ';' ;
37 | monitor_task_name : '$monitor' | '$monitorb' | '$monitoro' | '$monitorh' ;
38 | function_statement : statement ;
39 | function_statement_or_null : function_statement | ( attribute_instance )* ';' ;
40 | variable_identifier_list : variable_identifier ( ',' variable_identifier )* ;
41 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/Strings.g4:
--------------------------------------------------------------------------------
1 | grammar Strings;
2 | import Attributes;
3 |
4 | string_literal : STRING_LITERAL ;
5 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/SubroutineCallStatements.g4:
--------------------------------------------------------------------------------
1 | grammar SubroutineCallStatements;
2 | import AssertionStatements;
3 |
4 | subroutine_call_statement : subroutine_call ';' | 'void' APOSTROPHE '(' function_subroutine_call ')' ';' ;
5 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/SubroutineCalls.g4:
--------------------------------------------------------------------------------
1 | grammar SubroutineCalls;
2 | import Expressions;
3 |
4 | tf_call : ps_or_hierarchical_tf_identifier ( attribute_instance )* ( '(' list_of_arguments ')' )? ;
5 | system_tf_call : SYSTEM_TF_IDENTIFIER ( '(' list_of_arguments ')' )?
6 | | SYSTEM_TF_IDENTIFIER '(' data_type ( ',' expression )? ')'
7 | | SYSTEM_TF_IDENTIFIER '(' expression ( ',' ( expression )? )* ( ',' ( clocking_event )? )? ')' ;
8 | subroutine_call : tf_call | system_tf_call | ( ( primary_literal
9 | | ( class_qualifier | package_scope )? hierarchical_identifier select
10 | | empty_unpacked_array_concatenation
11 | | concatenation ( '[' range_expression ']' )?
12 | | multiple_concatenation ( '[' range_expression ']' )?
13 | | let_expression
14 | | '(' mintypmax_expression ')'
15 | | ( ( simple_type | signing | 'string' | 'const' ) APOSTROPHE '(' expression ')' )
16 | | ( primary_literal
17 | | ps_parameter_identifier constant_select
18 | | specparam_identifier ( '[' constant_range_expression ']' )?
19 | | genvar_identifier
20 | | formal_port_identifier constant_select
21 | | ( package_scope | class_scope )? enum_identifier
22 | | constant_concatenation ( '[' constant_range_expression ']' )?
23 | | constant_multiple_concatenation ( '[' constant_range_expression ']' )?
24 | | constant_let_expression
25 | | '(' constant_mintypmax_expression ')'
26 | | ( ( simple_type | signing | 'string' | 'const' ) APOSTROPHE '(' constant_expression ')' )
27 | | ( primary_literal
28 | | ps_parameter_identifier constant_select
29 | | specparam_identifier ( '[' constant_range_expression ']' )?
30 | | genvar_identifier
31 | | formal_port_identifier constant_select
32 | | ( package_scope | class_scope )? enum_identifier
33 | | constant_concatenation ( '[' constant_range_expression ']' )?
34 | | constant_multiple_concatenation ( '[' constant_range_expression ']' )?
35 | | constant_let_expression
36 | | '(' constant_mintypmax_expression ')'
37 | | constant_assignment_pattern_expression
38 | | type_reference
39 | | 'null' ) APOSTROPHE '(' constant_expression ')'
40 | | constant_assignment_pattern_expression
41 | | type_reference
42 | | 'null' ) APOSTROPHE '(' expression ')'
43 | | assignment_pattern_expression
44 | | streaming_concatenation
45 | | sequence_method_call
46 | | 'this'
47 | | '$'
48 | | 'null'
49 | | implicit_class_handle ) '.' method_call_body )
50 | | subroutine_call ( ( APOSTROPHE '(' constant_expression ')' )? APOSTROPHE '(' expression ')' )? '.' method_call_body
51 | | ( 'std' '::' )? randomize_call ;
52 | function_subroutine_call : subroutine_call ;
53 | list_of_arguments : ( expression )? ( ',' ( expression )? )* ( ',' '.' identifier '(' ( expression )? ')' )*
54 | | '.' identifier '(' ( expression )? ')' ( ',' '.' identifier '(' ( expression )? ')' )* ;
55 | list_of_arguments_with_strings : ( string_or_expression )? ( ',' ( string_or_expression )? )* ( ',' '.' identifier '(' ( expression )? ')' )*
56 | | '.' identifier '(' ( expression )? ')' ( ',' '.' identifier '(' ( expression )? ')' )* ;
57 | method_call_body : method_identifier ( attribute_instance )* ( '(' list_of_arguments ')' )?
58 | | built_in_method_call ;
59 | built_in_method_call : array_manipulation_call | randomize_call ;
60 | array_manipulation_call : array_method_name ( attribute_instance )* ( '(' list_of_arguments ')' )?
61 | ( 'with' '(' expression ')' )?
62 | | array_method_call ;
63 | array_method_call : expression '.' array_method_name ( attribute_instance )* ( ( '(' iterator_argument ')' )? 'with' '(' expression ')' )? ;
64 | iterator_argument : identifier ;
65 | randomize_call : 'randomize' ( attribute_instance )* ( '(' ( variable_identifier_list | 'null' )? ')' )?
66 | ( 'with' ( '(' ( identifier_list )? ')' )? constraint_block )? ;
67 | array_method_name : method_identifier | 'unique' | 'and' | 'or' | 'xor' ;
68 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/SystemVerilog.g4:
--------------------------------------------------------------------------------
1 | grammar SystemVerilog;
2 | import SystemVerilogSourceText;
3 |
4 | system_verilog_text : source_text EOF ;
5 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/TaskDeclarations.g4:
--------------------------------------------------------------------------------
1 | grammar TaskDeclarations;
2 | import BlockItemDeclarations;
3 |
4 | task_declaration : 'task' ( lifetime )? task_body_declaration ;
5 | task_body_declaration : ( interface_identifier '.' | class_scope )? task_identifier ';'
6 | ( tf_item_declaration )* ( statement_or_null )* 'endtask' ( ':' task_identifier )?
7 | | ( interface_identifier '.' | class_scope )? task_identifier '(' ( tf_port_list )? ')' ';'
8 | ( block_item_declaration )* ( statement_or_null )* 'endtask' ( ':' task_identifier )? ;
9 | tf_item_declaration : block_item_declaration | tf_port_declaration ;
10 | tf_port_list : tf_port_item ( ',' tf_port_item )* ;
11 | tf_port_item : ( attribute_instance )* ( tf_port_direction )? ( 'var' )? data_type_or_implicit
12 | ( port_identifier ( variable_dimension )* ( '=' expression )? )? ;
13 | tf_port_direction : port_direction | 'const' 'ref' ;
14 | tf_port_declaration : ( attribute_instance )* tf_port_direction ( 'var' )? data_type_or_implicit
15 | list_of_tf_variable_identifiers ';' ;
16 | task_prototype : 'task' task_identifier ( '(' ( tf_port_list )? ')' )? ;
17 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/TimingControlStatements.g4:
--------------------------------------------------------------------------------
1 | grammar TimingControlStatements;
2 | import ConditionalStatements;
3 |
4 | procedural_timing_control_statement : procedural_timing_control statement_or_null ;
5 | delay_or_event_control : delay_control | event_control | 'repeat' '(' expression ')' event_control ;
6 | delay_control : '#' delay_value | '#' '(' mintypmax_expression ')' ;
7 | event_control : '@' hierarchical_event_identifier
8 | | '@' '(' event_expression ')'
9 | | '@*'
10 | | '@' '(*)'
11 | | '@' ps_or_hierarchical_sequence_identifier ;
12 | event_expression : ( edge_identifier )? expression ( 'iff' expression )?
13 | | sequence_instance ( 'iff' expression )?
14 | | event_expression 'or' event_expression
15 | | event_expression ',' event_expression
16 | | '(' event_expression ')' ;
17 | procedural_timing_control : delay_control | event_control | cycle_delay ;
18 | jump_statement : 'return' ( expression )? ';'
19 | | 'break' ';'
20 | | 'continue' ';' ;
21 | wait_statement : 'wait' '(' expression ')' statement_or_null
22 | | 'wait' 'fork' ';'
23 | | 'wait_order' '(' hierarchical_identifier ( ',' hierarchical_identifier )* ')' action_block ;
24 | event_trigger : '->' hierarchical_event_identifier ';'
25 | | '->>' ( delay_or_event_control )? hierarchical_event_identifier ';' ;
26 | disable_statement : 'disable' hierarchical_task_identifier ';'
27 | | 'disable' hierarchical_block_identifier ';'
28 | | 'disable' 'fork' ';' ;
29 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/UDPBody.g4:
--------------------------------------------------------------------------------
1 | grammar UDPBody;
2 | import UDPInstantiation;
3 |
4 | udp_body : combinational_body | sequential_body ;
5 | combinational_body : 'table' combinational_entry ( combinational_entry )* 'endtable' ;
6 | combinational_entry : level_input_list ':' output_symbol ';' ;
7 | sequential_body : ( udp_initial_statement )? 'table' sequential_entry ( sequential_entry )* 'endtable' ;
8 | udp_initial_statement : 'initial' output_port_identifier '=' init_val ';' ;
9 | init_val : ONE APOSTROPHE B ( ZERO | ONE | X_DIGIT ) | ONE | ZERO ;
10 | sequential_entry : seq_input_list ':' current_state ':' next_state ';' ;
11 | seq_input_list : level_input_list | edge_input_list ;
12 | level_input_list : level_symbol ( level_symbol )* ;
13 | edge_input_list : ( level_symbol )* edge_indicator ( level_symbol )* ;
14 | edge_indicator : '(' level_symbol level_symbol ')' | edge_symbol ;
15 | current_state : level_symbol ;
16 | next_state : output_symbol | '-' ;
17 | output_symbol : ZERO | ONE | X_DIGIT ;
18 | level_symbol : ZERO | ONE | X_DIGIT | QUESTION | B ;
19 | edge_symbol : R | F | P | N | '*' ;
20 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/UDPDeclaration.g4:
--------------------------------------------------------------------------------
1 | grammar UDPDeclaration;
2 | import UDPPorts;
3 |
4 | udp_nonansi_declaration : ( attribute_instance )* 'primitive' udp_identifier '(' udp_port_list ')'
5 | ';' ;
6 | udp_ansi_declaration : ( attribute_instance )* 'primitive' udp_identifier
7 | '(' udp_declaration_port_list ')' ';' ;
8 | udp_declaration : udp_nonansi_declaration udp_port_declaration ( udp_port_declaration )* udp_body
9 | 'endprimitive' ( ':' udp_identifier )?
10 | | udp_ansi_declaration udp_body 'endprimitive' ( ':' udp_identifier )?
11 | | 'extern' udp_nonansi_declaration | 'extern' udp_ansi_declaration
12 | | ( attribute_instance )* 'primitive' udp_identifier '(' '.*' ')' ';' ( udp_port_declaration )*
13 | udp_body 'endprimitive' ( ':' udp_identifier )? ;
14 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/UDPInstantiation.g4:
--------------------------------------------------------------------------------
1 | grammar UDPInstantiation;
2 | import ContinuousAssignmentAndNetAliasStatements;
3 |
4 | udp_instantiation : udp_identifier ( drive_strength )? ( delay2 )? udp_instance ( ',' udp_instance )*
5 | ';' ;
6 | udp_instance : ( name_of_instance )? '(' output_terminal ',' input_terminal ( ',' input_terminal )*
7 | ')' ;
8 |
--------------------------------------------------------------------------------
/src/compiling/ANTLR/grammar/UDPPorts.g4:
--------------------------------------------------------------------------------
1 | grammar UDPPorts;
2 | import UDPBody;
3 |
4 | udp_port_list : output_port_identifier ',' input_port_identifier ( ',' input_port_identifier )* ;
5 | udp_declaration_port_list : udp_output_declaration ',' udp_input_declaration
6 | ( ',' udp_input_declaration )* ;
7 | udp_port_declaration : udp_output_declaration ';'
8 | | udp_input_declaration ';'
9 | | udp_reg_declaration ';' ;
10 | udp_output_declaration : ( attribute_instance )* 'output' port_identifier
11 | | ( attribute_instance )* 'output' 'reg' port_identifier ( '=' constant_expression )? ;
12 | udp_input_declaration : ( attribute_instance )* 'input' list_of_udp_port_identifiers ;
13 | udp_reg_declaration : ( attribute_instance )* 'reg' variable_identifier ;
14 |
--------------------------------------------------------------------------------
/src/compiling/DiagnosticData.ts:
--------------------------------------------------------------------------------
1 | import { DiagnosticSeverity } from 'vscode-languageserver/node';
2 |
3 | /** Defines the information needed to create a `Diagnostic` object. */
4 | export class DiagnosticData {
5 | line: number;
6 | problem: string;
7 | diagnosticSeverity: DiagnosticSeverity;
8 | filePath: string;
9 | offendingSymbol: string;
10 | charPosition: number;
11 | }
12 |
13 | /**
14 | Checks if `diagnosticData`'s fields are not `undefined`
15 |
16 | @param diagnosticData the DiagnosticData
17 | @return true if at least one field is `undefined`
18 | */
19 | export function isDiagnosticDataUndefined(diagnosticData: DiagnosticData): boolean {
20 | if (
21 | diagnosticData.line === undefined ||
22 | diagnosticData.problem === undefined ||
23 | diagnosticData.diagnosticSeverity === undefined ||
24 | diagnosticData.filePath === undefined
25 | ) {
26 | return true;
27 | }
28 |
29 | return false;
30 | }
31 |
--------------------------------------------------------------------------------
/src/compiling/SystemVerilogCompiler.ts:
--------------------------------------------------------------------------------
1 | import { Connection, Diagnostic, TextDocuments } from 'vscode-languageserver/node';
2 | import { TextDocument } from 'vscode-languageserver-textdocument';
3 | import { DocumentCompiler } from './DocumentCompiler';
4 | import { VerilatorCompiler } from './VerilatorCompiler';
5 | import { VCSCompiler } from './VCSCompiler';
6 | import { VeribleCompiler } from './VeribleCompiler';
7 |
8 | /* defines supported simulators/compilers */
9 | export enum CompilerType {
10 | Verilator = 1,
11 | VCS = 2,
12 | Verible = 3
13 | }
14 |
15 | /*
16 | SystemVerilog Compiler handles functionality for compiling documents using the supported simulators.
17 | Used by the LSP's `connection` to handle getting `Diagnostics` for `documents`
18 | */
19 | export class SystemVerilogCompiler {
20 | compiler: DocumentCompiler;
21 | connection: Connection;
22 | documents: TextDocuments;
23 | workspaceRootPath: string;
24 | configurations: Map;
25 | compilerConfigurationsKeys: string[];
26 |
27 | constructor(
28 | connection: Connection,
29 | documents: TextDocuments,
30 | workspaceRootPath: string,
31 | configurations: Map,
32 | compilerConfigurationsKeys: string[]
33 | ) {
34 | this.connection = connection;
35 | this.documents = documents;
36 | this.workspaceRootPath = workspaceRootPath;
37 | this.configurations = configurations;
38 | this.compilerConfigurationsKeys = compilerConfigurationsKeys;
39 | }
40 |
41 | /**
42 | Compiles the given `document` using the compiler/simulator specified by `type`.
43 |
44 | @returns a `Promise` of a map of entries mapping each uri to a `Diagnostic` array
45 | */
46 | public async validateTextDocument(document: TextDocument, type: CompilerType): Promise