Skip to content

Commit

Permalink
fix: linter vivado with SV
Browse files Browse the repository at this point in the history
  • Loading branch information
qarlosalberto committed Jul 13, 2023
1 parent 0572e58 commit 86917f2
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/colibri/src/config/config_web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ export const WEB_CONFIG = `
<div class="mb-3">
<label for="linter-modelsim-verilog_arguments" class="form-label">Verilog linter arguments.</label>
<label for="linter-modelsim-verilog_arguments" class="form-label">Verilog/SV linter arguments.</label>
<input class="form-control" id="linter-modelsim-verilog_arguments" rows="3" value=""></input>
</div>
Expand Down Expand Up @@ -1249,7 +1249,7 @@ export const WEB_CONFIG = `
<div class="mb-3">
<label for="linter-vivado-verilog_arguments" class="form-label">Verilog linter arguments.</label>
<label for="linter-vivado-verilog_arguments" class="form-label">Verilog/SV linter arguments.</label>
<input class="form-control" id="linter-vivado-verilog_arguments" rows="3" value=""></input>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ vhdl_arguments:
value: ""

verilog_arguments:
description: "Verilog linter arguments."
description: "Verilog/SV linter arguments."
type: string
value: ""
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ vhdl_arguments:
value: ""

verilog_arguments:
description: "Verilog linter arguments."
description: "Verilog/SV linter arguments."
type: string
value: ""
4 changes: 2 additions & 2 deletions packages/colibri/src/config/web_config.html
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ <h6 class="card-subtitle mb-2 text-muted"></h6>


<div class="mb-3">
<label for="linter-modelsim-verilog_arguments" class="form-label">Verilog linter arguments.</label>
<label for="linter-modelsim-verilog_arguments" class="form-label">Verilog/SV linter arguments.</label>
<input class="form-control" id="linter-modelsim-verilog_arguments" rows="3" value=""></input>
</div>

Expand Down Expand Up @@ -1229,7 +1229,7 @@ <h6 class="card-subtitle mb-2 text-muted"></h6>


<div class="mb-3">
<label for="linter-vivado-verilog_arguments" class="form-label">Verilog linter arguments.</label>
<label for="linter-vivado-verilog_arguments" class="form-label">Verilog/SV linter arguments.</label>
<input class="form-control" id="linter-vivado-verilog_arguments" rows="3" value=""></input>
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/colibri/src/linter/vivado.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Vivado extends Base_linter {
binary = "xvhdl";
}
else if (file_lang === HDL_LANG.SYSTEMVERILOG) {
binary = "xvlog";
binary = `xvlog ${this.sv_options}`;
}
else {
binary = "xvlog";
Expand Down
2 changes: 1 addition & 1 deletion packages/teroshdl/auto_package/templates/info.nj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"displayName": "TerosHDL",
"publisher": "teros-technology",
"description": "Powerful IDE for ASIC/FPGA: state machine viewer, linter, documentation, snippets... and more! ",
"version": "5.0.2",
"version": "5.0.3",
"engines": {
"vscode": "^1.74.0"
},
Expand Down
20 changes: 13 additions & 7 deletions packages/teroshdl/src/features/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Linter {
}
}

private get_options(): teroshdl2.linter.common.l_options {
private get_options(lang: teroshdl2.common.general.HDL_LANG): teroshdl2.linter.common.l_options {
let path = "";
let argument = "";
const linter_name = this.get_linter_name();
Expand All @@ -82,27 +82,31 @@ class Linter {
path = this.get_config().tools.ghdl.installation_path;
argument = this.get_config().linter.ghdl.arguments;
}
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_vhdl.modelsim){
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_vhdl.modelsim &&
lang === teroshdl2.common.general.HDL_LANG.VHDL){
path = this.get_config().tools.modelsim.installation_path;
argument = this.get_config().linter.modelsim.vhdl_arguments;
}
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_vhdl.vivado){
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_vhdl.vivado &&
lang === teroshdl2.common.general.HDL_LANG.VHDL){
path = this.get_config().tools.vivado.installation_path;
argument = this.get_config().linter.vivado.vhdl_arguments;
}
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_verilog.icarus){
path = this.get_config().tools.icarus.installation_path;
argument = this.get_config().linter.icarus.arguments;
}
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_verilog.modelsim){
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_verilog.modelsim &&
lang !== teroshdl2.common.general.HDL_LANG.VHDL){
path = this.get_config().tools.modelsim.installation_path;
argument = this.get_config().linter.vivado.verilog_arguments;
}
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_verilog.verilator){
path = this.get_config().tools.verilator.installation_path;
argument = this.get_config().linter.verilator.arguments;
}
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_verilog.vivado){
else if (linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_verilog.vivado &&
lang !== teroshdl2.common.general.HDL_LANG.VHDL){
path = this.get_config().tools.vivado.installation_path;
argument = this.get_config().linter.vivado.verilog_arguments;
}
Expand Down Expand Up @@ -165,7 +169,7 @@ class Linter {

console.log(`[terosHDL] Linting ${current_path}`);

let errors = await this.linter.lint_from_file(linter_name, current_path, this.get_options());
let errors = await this.linter.lint_from_file(linter_name, current_path, this.get_options(lang),);

let diagnostics: vscode.Diagnostic[] = [];
for (var i = 0; i < errors.length; ++i) {
Expand Down Expand Up @@ -193,7 +197,9 @@ class Linter {
let current_path = uri.fsPath;
const linter_name = this.get_linter_name();

let errors = await this.linter.lint_from_file(linter_name, current_path, this.get_options());
const lang = teroshdl2.utils.hdl.get_lang_from_path(current_path);

let errors = await this.linter.lint_from_file(linter_name, current_path, this.get_options(lang));
let diagnostics: vscode.Diagnostic[] = [];
if (empty === true
|| linter_name === teroshdl2.config.config_declaration.e_linter_general_linter_vhdl.none
Expand Down

0 comments on commit 86917f2

Please sign in to comment.