Skip to content

Commit

Permalink
Merge pull request #299 from suzizecat/add-gtkwave-formats
Browse files Browse the repository at this point in the history
Add capacity to read .fst and .gtkw files
  • Loading branch information
qarlosalberto authored Feb 18, 2022
2 parents cc62fa0 + d604262 commit 8433c39
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
25 changes: 23 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,15 @@
"explorer/context": [
{
"command": "teroshdl.start_vcd",
"when": "resourceLangId == vcd || resourceLangId == ghw",
"when": "resourceLangId == vcd",
"group": "navigation"
},
{
"command": "teroshdl.start_gtkwave",
"when": "resourceLangId == gtkw_wavebin || resourceLangId == gtkw_waveconfig",
"group": "navigation"
}

],
"view/title": [
{
Expand Down Expand Up @@ -207,6 +213,10 @@
"command": "teroshdl.start_vcd",
"when": "view == teroshdl_tree_view && viewItem == hdl_source"
},
{
"command": "teroshdl.start_gtkwave",
"when": "view == teroshdl_tree_view && viewItem == hdl_source"
},
{
"command": "teroshdl_tree_view.delete_file",
"when": "view == teroshdl_tree_view && viewItem == hdl_source"
Expand Down Expand Up @@ -365,6 +375,10 @@
"command": "teroshdl.start_vcd",
"title": "Open with waveform viewer"
},
{
"command": "teroshdl.start_gtkwave",
"title": "Open with GTKWave"
},
{
"command": "teroshdl_tree_view.stop",
"title": "Stop",
Expand Down Expand Up @@ -673,8 +687,15 @@
]
},
{
"id": "ghw",
"id": "gtkw_waveconfig",
"extensions": [
".gtkw"
]
},
{
"id": "gtkw_wavebin",
"extensions": [
".fst",
".ghw"
]
},
Expand Down
19 changes: 16 additions & 3 deletions src/lib/project_manager/project_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export class Project_manager {
vscode.commands.registerCommand("teroshdl_tree_view.help", (item) => this.help());
vscode.commands.registerCommand("teroshdl_tree_view.netlist_project", (item) => this.netlist(item));
vscode.commands.registerCommand("teroshdl.start_vcd", (item) => this.start_vcd(item));
vscode.commands.registerCommand("teroshdl.start_gtkwave", (item) => this.start_gtkwave(item));

this.hdl_dependencies_provider = new Hdl_dependencies_tree(context, output_channel);
vscode.window.registerTreeDataProvider('teroshdl_dependencies_tree_view', this.hdl_dependencies_provider);
Expand All @@ -136,9 +137,7 @@ export class Project_manager {

let waveform_viewer = this.config_reader.get_waveform_viewer();
if (waveform_viewer === 'gtkwave') {
let shell = require('shelljs');
let command = `gtkwave ${waveform_path}`;
shell.exec(command, { async: true });
this.start_gtkwave(item);
}
else if (waveform_viewer === "impulse") {
let uri = vscode.Uri.file(waveform_path);
Expand All @@ -150,6 +149,20 @@ export class Project_manager {
}
}

start_gtkwave(item) {
let waveform_path = item.path;

let waveform_viewer = this.config_reader.get_waveform_viewer();
if (waveform_viewer === 'gtkwave') {
let shell = require('shelljs');
let command = "gtkwave " + waveform_path;
shell.exec(command, { async: true });
}
else {
this.output_channel.show_message("You need to have GTKWave configured to use this feature");
}
}

help() {
const resolve = require('path').resolve;

Expand Down

0 comments on commit 8433c39

Please sign in to comment.