取消 fsm
This commit is contained in:
parent
cbb9c40940
commit
2ef8b78d26
635
efinity.json
635
efinity.json
@ -1,635 +0,0 @@
|
||||
{
|
||||
"efx:project": {
|
||||
"_attributes": {
|
||||
"xmlns:efx": "http://www.efinixinc.com/enf_proj",
|
||||
"xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
||||
"name": "Ti60_Demo",
|
||||
"description": "",
|
||||
"last_change": "1724637727",
|
||||
"sw_version": "2023.2.307",
|
||||
"last_run_state": "pass",
|
||||
"last_run_flow": "bitstream",
|
||||
"config_result_in_sync": "sync",
|
||||
"design_ood": "sync",
|
||||
"place_ood": "sync",
|
||||
"route_ood": "sync",
|
||||
"xsi:schemaLocation": "http://www.efinixinc.com/enf_proj enf_proj.xsd"
|
||||
},
|
||||
"efx:device_info": {
|
||||
"efx:family": {
|
||||
"_attributes": {
|
||||
"name": "Titanium"
|
||||
}
|
||||
},
|
||||
"efx:device": {
|
||||
"_attributes": {
|
||||
"name": "Ti60F100S3F2"
|
||||
}
|
||||
},
|
||||
"efx:timing_model": {
|
||||
"_attributes": {
|
||||
"name": "C4"
|
||||
}
|
||||
}
|
||||
},
|
||||
"efx:design_info": {
|
||||
"_attributes": {
|
||||
"def_veri_version": "verilog_2k",
|
||||
"def_vhdl_version": "vhdl_2008"
|
||||
},
|
||||
"efx:top_module": {
|
||||
"_attributes": {
|
||||
"name": "example_top"
|
||||
}
|
||||
},
|
||||
"efx:design_file": [
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "example_top.v",
|
||||
"version": "default",
|
||||
"library": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "src/Reset.v",
|
||||
"version": "default",
|
||||
"library": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "src/uart_index/precise_divider.v",
|
||||
"version": "default",
|
||||
"library": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "src/uart_index/uart_transfer.v",
|
||||
"version": "default",
|
||||
"library": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "src/uart_index/uart_receiver.v",
|
||||
"version": "default",
|
||||
"library": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "src/uart_index/integer_divider.v",
|
||||
"version": "default",
|
||||
"library": "default"
|
||||
}
|
||||
}
|
||||
],
|
||||
"efx:top_vhdl_arch": {
|
||||
"_attributes": {
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"efx:constraint_info": {
|
||||
"efx:sdc_file": {
|
||||
"_attributes": {
|
||||
"name": "Ti60_Demo.pt.sdc"
|
||||
}
|
||||
},
|
||||
"efx:inter_file": {
|
||||
"_attributes": {
|
||||
"name": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"efx:sim_info": {},
|
||||
"efx:misc_info": {},
|
||||
"efx:ip_info": {
|
||||
"efx:ip": {
|
||||
"_attributes": {
|
||||
"instance_name": "FIFO_4Kx8",
|
||||
"path": "ip/FIFO_4Kx8/settings.json"
|
||||
},
|
||||
"efx:ip_src_file": {
|
||||
"_attributes": {
|
||||
"name": "FIFO_4Kx8.v"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"efx:synthesis": {
|
||||
"_attributes": {
|
||||
"tool_name": "efx_map"
|
||||
},
|
||||
"efx:param": [
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "work_dir",
|
||||
"value": "prj/work_syn",
|
||||
"value_type": "e_string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "write_efx_verilog",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "mode",
|
||||
"value": "speed",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "max_ram",
|
||||
"value": "-1",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "max_mult",
|
||||
"value": "-1",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "infer-clk-enable",
|
||||
"value": "3",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "infer-sync-set-reset",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "fanout-limit",
|
||||
"value": "0",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "seq_opt",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "retiming",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "dsp-mac-packing",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "dsp-input-regs-packing",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "dsp-output-regs-packing",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "bram_output_regs_packing",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "blast_const_operand_adders",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "operator-sharing",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "optimize-adder-tree",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "pack-luts-to-comb4",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "min-sr-fanout",
|
||||
"value": "0",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "min-ce-fanout",
|
||||
"value": "0",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "seq-opt-sync-only",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "blackbox-error",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "allow-const-ram-index",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "hdl-compile-unit",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "create-onehot-fsms",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "mult-decomp-retime",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "optimize-zero-init-rom",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "insert-carry-skip",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "mult-auto-pipeline",
|
||||
"value": "0",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "use-logic-for-small-mem",
|
||||
"value": "64",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "use-logic-for-small-rom",
|
||||
"value": "64",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "include",
|
||||
"value": "ip/FIFO_4Kx8",
|
||||
"value_type": "e_string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"efx:place_and_route": {
|
||||
"_attributes": {
|
||||
"tool_name": "efx_pnr"
|
||||
},
|
||||
"efx:param": [
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "work_dir",
|
||||
"value": "prj/work_pnr",
|
||||
"value_type": "e_string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "verbose",
|
||||
"value": "off",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "load_delaym",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "optimization_level",
|
||||
"value": "CONGESTION_1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "seed",
|
||||
"value": "1",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "placer_effort_level",
|
||||
"value": "1",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "max_threads",
|
||||
"value": "32",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "beneficial_skew",
|
||||
"value": "on",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "print_critical_path",
|
||||
"value": "10",
|
||||
"value_type": "e_integer"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"efx:bitstream_generation": {
|
||||
"_attributes": {
|
||||
"tool_name": "efx_pgm"
|
||||
},
|
||||
"efx:param": [
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "mode",
|
||||
"value": "active",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "width",
|
||||
"value": "2",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "cold_boot",
|
||||
"value": "off",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "cascade",
|
||||
"value": "off",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "enable_roms",
|
||||
"value": "on",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "spi_low_power_mode",
|
||||
"value": "off",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "io_weak_pullup",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "oscillator_clock_divider",
|
||||
"value": "DIV8",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "enable_crc_check",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "bitstream_compression",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "active_capture_clk_edge",
|
||||
"value": "negedge",
|
||||
"value_type": "e_option"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "release_tri_then_reset",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "enable_external_master_clock",
|
||||
"value": "off",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "jtag_usercode",
|
||||
"value": "0xFFFFFFFF",
|
||||
"value_type": "e_string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "generate_bit",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "generate_bitbin",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "generate_hex",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "generate_hexbin",
|
||||
"value": "on",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "four_byte_addressing",
|
||||
"value": "off",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"efx:debugger": {
|
||||
"efx:param": [
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "work_dir",
|
||||
"value": "prj/work_dbg",
|
||||
"value_type": "e_string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "auto_instantiation",
|
||||
"value": "off",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "profile",
|
||||
"value": "NONE",
|
||||
"value_type": "e_string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"efx:security": {
|
||||
"efx:param": [
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "enable_bitstream_encrypt",
|
||||
"value": "off",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "enable_bitstream_auth",
|
||||
"value": "off",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "encryption_key_file",
|
||||
"value": "NONE",
|
||||
"value_type": "e_string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "auth_key_file",
|
||||
"value": "NONE",
|
||||
"value_type": "e_string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "randomize_iv_value",
|
||||
"value": "off",
|
||||
"value_type": "e_bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_attributes": {
|
||||
"name": "iv_value",
|
||||
"value": "",
|
||||
"value_type": "e_string"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
15
package.json
15
package.json
@ -696,11 +696,6 @@
|
||||
"command": "digital-ide.tool.icarus.simulateFile",
|
||||
"group": "navigation@1"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == verilog || editorLangId == systemverilog || editorLangId == vhdl",
|
||||
"command": "digital-ide.fsm.show",
|
||||
"group": "navigation@2"
|
||||
},
|
||||
{
|
||||
"when": "editorLangId == verilog || editorLangId == systemverilog || editorLangId == vhdl",
|
||||
"command": "digital-ide.netlist.show",
|
||||
@ -758,11 +753,6 @@
|
||||
"command": "digital-ide.waveviewer.show",
|
||||
"group": "navigation@7"
|
||||
},
|
||||
{
|
||||
"when": "resourceLangId == verilog || resourceLangId == systemverilog || resourceLangId == vhdl",
|
||||
"command": "digital-ide.fsm.show",
|
||||
"group": "navigation@8"
|
||||
},
|
||||
{
|
||||
"when": "resourceLangId == vhdl",
|
||||
"command": "digital-ide.vhdl2vlog",
|
||||
@ -805,11 +795,6 @@
|
||||
"command": "digital-ide.waveviewer.show",
|
||||
"group": "navigation@10"
|
||||
},
|
||||
{
|
||||
"when": "resourceLangId == verilog || resourceLangId == systemverilog || resourceLangId == vhdl",
|
||||
"command": "digital-ide.fsm.show",
|
||||
"group": "navigation@11"
|
||||
},
|
||||
{
|
||||
"when": "resourceLangId == vhdl",
|
||||
"command": "digital-ide.vhdl2vlog",
|
||||
|
10
resources/fsm/index.d.ts
vendored
10
resources/fsm/index.d.ts
vendored
@ -1,10 +0,0 @@
|
||||
import type * as vscode from 'vscode';
|
||||
|
||||
declare module FSM {
|
||||
export class FsmViewer {
|
||||
constructor(context: vscode.ExtensionContext);
|
||||
public open(uri: vscode.Uri);
|
||||
}
|
||||
}
|
||||
|
||||
export = FSM;
|
@ -1,217 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const fs = require("fs");
|
||||
const fspath = require("path");
|
||||
const vscode = require("vscode");
|
||||
const parse = require("./utils/fsm_parser");
|
||||
|
||||
function getLanguageId(path) {
|
||||
let vhdlExtensions = [".vhd",".vhdl",".vho",".vht"];
|
||||
let vlogExtensions = [".v",".V",".vh",".vl"];
|
||||
let svlogExtensions = [".sv",".SV"];
|
||||
let value = fspath.extname(path);
|
||||
if (vlogExtensions.includes(value)) {
|
||||
return 'verilog';
|
||||
}
|
||||
else if (svlogExtensions.includes(value)) {
|
||||
return 'systemverilog';
|
||||
}
|
||||
else if (vhdlExtensions.includes(value)) {
|
||||
return 'vhdl';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class FsmViewer {
|
||||
/**
|
||||
*
|
||||
* @param {vscode.ExtensionContext} context
|
||||
*/
|
||||
constructor(context) {
|
||||
this.panel = undefined;
|
||||
this.sources = [];
|
||||
this.context = context;
|
||||
this.rootPath = context.extensionPath.replace(/\\/g, '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* CN: 打开FSM图表的 webview 网页
|
||||
* @param {*} uri 指定所需转换为图表的文件uri信息
|
||||
*/
|
||||
open(uri) {
|
||||
this.current_uri = uri;
|
||||
const docPath = uri.fsPath.replace(/\\/g, '/');
|
||||
if (this.panel === undefined) {
|
||||
this.create();
|
||||
}
|
||||
this.send(docPath);
|
||||
}
|
||||
|
||||
async create() {
|
||||
// Create panel
|
||||
this.panel = vscode.window.createWebviewPanel(
|
||||
'state_machine_viewer',
|
||||
'State machine viewer',
|
||||
vscode.ViewColumn.Two,
|
||||
{
|
||||
enableScripts: true
|
||||
}
|
||||
);
|
||||
this.panel.onDidDispose(() => {
|
||||
// When the panel is closed, cancel any future updates to the webview content
|
||||
this.panel = undefined;
|
||||
}, null, this.context.subscriptions);
|
||||
// Handle messages from the webview
|
||||
this.panel.webview.onDidReceiveMessage((message) => {
|
||||
switch (message.command) {
|
||||
case 'export':
|
||||
this.export_as(message.text);
|
||||
return;
|
||||
case 'go_to_state':
|
||||
this.go_to_state(message.stm_index, message.state);
|
||||
return;
|
||||
case 'go_to_condition':
|
||||
this.go_to_condition(message.stm_index, message.transition, message.condition);
|
||||
return;
|
||||
}
|
||||
}, undefined, this.context.subscriptions);
|
||||
let previewHtml = this.getWebviewContent(this.context);
|
||||
this.panel.webview.html = previewHtml;
|
||||
}
|
||||
|
||||
async send(path) {
|
||||
let languageId = getLanguageId(path);
|
||||
let content = fs.readFileSync(path, "utf-8");
|
||||
let state_machines = await parse(languageId, content);
|
||||
this.state_machines = state_machines;
|
||||
this.panel.webview.postMessage({
|
||||
command: "update",
|
||||
svg: state_machines.svg,
|
||||
stms: state_machines.stm
|
||||
});
|
||||
}
|
||||
|
||||
go_to_state(stm_index, state) {
|
||||
if (this.state_machines === undefined) {
|
||||
return;
|
||||
}
|
||||
let states = this.state_machines.stm[stm_index].states;
|
||||
let state_stm;
|
||||
for (let i = 0; i < states.length; ++i) {
|
||||
if (states[i].name.replace(/\"/g, '').replace(/\'/g, '') === state) {
|
||||
state_stm = states[i];
|
||||
}
|
||||
}
|
||||
if (state_stm !== undefined) {
|
||||
let start_position = state_stm.start_position;
|
||||
let end_position = state_stm.end_position;
|
||||
let pos_1 = new vscode.Position(start_position[0], start_position[1]);
|
||||
let pos_2 = new vscode.Position(end_position[0], end_position[1]);
|
||||
vscode.workspace.openTextDocument(this.current_uri).then(doc => {
|
||||
vscode.window.showTextDocument(doc, vscode.ViewColumn.One).then(editor => {
|
||||
// Line added - by having a selection at the same position twice, the cursor jumps there
|
||||
editor.selections = [new vscode.Selection(pos_1, pos_2)];
|
||||
// And the visible range jumps there too
|
||||
var range = new vscode.Range(pos_1, pos_2);
|
||||
editor.revealRange(range);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
go_to_condition(stm_index, transition, condition) {
|
||||
let normalized_condition = this.normalize_string(condition);
|
||||
let state_origen = transition[0];
|
||||
let state_destination = transition[1];
|
||||
if (this.state_machines === undefined) {
|
||||
return;
|
||||
}
|
||||
let states = this.state_machines.stm[stm_index].states;
|
||||
let transition_match;
|
||||
//Search state
|
||||
for (let i = 0; i < states.length; ++i) {
|
||||
if (states[i].name.replace(/\"/g, '').replace(/\'/g, '') === state_origen) {
|
||||
let transitions = states[i].transitions;
|
||||
//Search condition
|
||||
for (let j = 0; j < transitions.length; ++j) {
|
||||
let normalized_condition_state = this.normalize_string(transitions[j].condition);
|
||||
if (transitions[j].destination.replace(/\"/g, '').replace(/\'/g, '') === state_destination
|
||||
&& normalized_condition_state === normalized_condition) {
|
||||
transition_match = transitions[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (transition_match !== undefined) {
|
||||
if (transition_match.start_position === undefined || transition_match.end_position === undefined) {
|
||||
return;
|
||||
}
|
||||
let start_position = transition_match.start_position;
|
||||
let end_position = transition_match.end_position;
|
||||
let pos_1 = new vscode.Position(start_position[0], start_position[1]);
|
||||
let pos_2 = new vscode.Position(end_position[0], end_position[1]);
|
||||
vscode.workspace.openTextDocument(this.current_uri).then(doc => {
|
||||
vscode.window.showTextDocument(doc, vscode.ViewColumn.One).then(editor => {
|
||||
// Line added - by having a selection at the same position twice, the cursor jumps there
|
||||
editor.selections = [new vscode.Selection(pos_1, pos_2)];
|
||||
// And the visible range jumps there too
|
||||
var range = new vscode.Range(pos_1, pos_2);
|
||||
editor.revealRange(range);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export_as(type) {
|
||||
if (type === "svg") {
|
||||
let filter = { 'svg': ['svg'] };
|
||||
vscode.window.showSaveDialog({ filters: filter }).then(fileInfos => {
|
||||
if ((fileInfos === null || fileInfos === void 0 ? void 0 : fileInfos.path) !== undefined) {
|
||||
let path_full = this.normalize_path(fileInfos === null || fileInfos === void 0 ? void 0 : fileInfos.path);
|
||||
let dir_name = fspath.dirname(path_full);
|
||||
let file_name = fspath.basename(path_full).split('.')[0];
|
||||
for (let i = 0; i < this.state_machines.svg.length; ++i) {
|
||||
let custom_path = `${dir_name}${fspath.sep}${file_name}_${i}.svg`;
|
||||
fs.writeFileSync(custom_path, this.state_machines.svg[i].svg);
|
||||
}
|
||||
vscode.window.showInformationMessage('Documentation has been saved.');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log("Error export documentation.");
|
||||
}
|
||||
}
|
||||
|
||||
normalize_path(path) {
|
||||
if (path[0] === '/' && require('os').platform() === 'win32') {
|
||||
return path.substring(1);
|
||||
}
|
||||
else {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
normalize_string(str) {
|
||||
let n_string = str.replace(/[^ -~]+/g, '');
|
||||
n_string = n_string.replace(/ /g, '');
|
||||
n_string = n_string.replace(/\n/g, '');
|
||||
return n_string;
|
||||
}
|
||||
|
||||
getWebviewContent() {
|
||||
const resource_path = fspath.join(this.rootPath, 'resources', 'fsm', 'view', 'fsm_viewer.html');
|
||||
const dir_path = fspath.dirname(resource_path);
|
||||
|
||||
let html = fs.readFileSync(resource_path, 'utf-8');
|
||||
html = html.replace(/(<link.+?href="|<script.+?src="|<img.+?src=")(.+?)"/g, (m, $1, $2) => {
|
||||
const absLocalPath = fspath.resolve(dir_path, $2);
|
||||
const webviewUri = this.panel.webview.asWebviewUri(vscode.Uri.file(absLocalPath));
|
||||
const replaceHref = $1 + webviewUri.toString() + '"';
|
||||
return replaceHref;
|
||||
});
|
||||
return html;
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
FsmViewer
|
||||
};
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,234 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const vscode = acquireVsCodeApi();
|
||||
|
||||
// Handle the message inside the webview
|
||||
window.addEventListener('message', event => {
|
||||
const message = event.data; // The JSON data our extension sen
|
||||
switch (message.command) {
|
||||
case 'update':
|
||||
update_graph(message.svg, message.stms);
|
||||
break;
|
||||
case 'clear':
|
||||
clear();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
let graph = [];
|
||||
let div = [];
|
||||
let stms = [];
|
||||
|
||||
function update_graph(svgs, stms_i) {
|
||||
stms = stms_i;
|
||||
const el = document.querySelector('body');
|
||||
// get scroll position in px
|
||||
let last_scroll_left = el.scrollLeft;
|
||||
let last_scroll_top = el.scrollTop;
|
||||
|
||||
let message = document.getElementById("message");
|
||||
message.innerHTML = `#State machines ${svgs.length}`;
|
||||
|
||||
delete_graph();
|
||||
if (svgs === undefined) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < svgs.length; ++i) {
|
||||
create_graph(svgs[i].svg, `svg_${i}`, i);
|
||||
}
|
||||
|
||||
// set scroll position in px
|
||||
el.scrollLeft = last_scroll_left;
|
||||
el.scrollTop = last_scroll_top;
|
||||
}
|
||||
|
||||
function create_graph(svg, name, index) {
|
||||
let embed = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
embed.setAttribute('style', 'width: 100%; height: 720px;');
|
||||
embed.setAttribute('type', 'image/svg+xml');
|
||||
embed.innerHTML = svg;
|
||||
embed.id = name;
|
||||
|
||||
//Add div
|
||||
var elem = document.createElement('div');
|
||||
elem.style.width = "100%";
|
||||
elem.style.heigh = "500px";
|
||||
elem.style.border = "1px solid black";
|
||||
div.push(elem);
|
||||
|
||||
document.body.appendChild(elem);
|
||||
|
||||
//Add svg
|
||||
elem.appendChild(embed);
|
||||
|
||||
let pan_zoom = svgPanZoom(`#${name}`, pan_config);
|
||||
pan_zoom.center();
|
||||
pan_zoom.resize();
|
||||
|
||||
let countries = embed.childNodes;
|
||||
for (let i = 0; i < countries.length; i++) {
|
||||
countries[i].addEventListener('click', e => {
|
||||
let parent_target = e.target.parentNode;
|
||||
let childs = parent_target.childNodes;
|
||||
for (let i = 0; i < childs.length; ++i) {
|
||||
let child = childs[i];
|
||||
if (child.tagName === 'title') {
|
||||
let state_name = child.textContent;
|
||||
let state_machine_index_i = index;
|
||||
for (let j = 0; j < childs.length; ++j) {
|
||||
let child_0 = childs[j];
|
||||
if (child_0.tagName === 'polygon' && check_state(state_machine_index_i, state_name) === true) {
|
||||
uncheck_all();
|
||||
child_0.style = "fill:#d0fdf7";
|
||||
go_to_code_state(state_machine_index_i, state_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
countries[i].addEventListener('click', e => {
|
||||
let state_machine_index_i = index;
|
||||
let parent_target = e.target.parentNode;
|
||||
let childs = parent_target.childNodes;
|
||||
for (let i = 0; i < childs.length; ++i) {
|
||||
let child = childs[i];
|
||||
let transtion = child.textContent.split('->');
|
||||
|
||||
if (child.tagName === 'title' && transtion.length === 2) {
|
||||
let text_count = 0;
|
||||
let condition = '';
|
||||
let child_match;
|
||||
let child_match_0;
|
||||
for (let j = 0; j < childs.length; ++j) {
|
||||
let child_0 = childs[j];
|
||||
if (child_0.tagName === 'text') {
|
||||
if (text_count === 0) {
|
||||
condition = child_0.textContent;
|
||||
}
|
||||
else {
|
||||
condition += '\n' + child_0.textContent;
|
||||
}
|
||||
text_count += 1;
|
||||
}
|
||||
else if (child_0.tagName === 'polygon') {
|
||||
child_match = child_0;
|
||||
}
|
||||
else if (child_0.tagName === 'path') {
|
||||
child_match_0 = child_0;
|
||||
}
|
||||
}
|
||||
if (text_count >= 0) {
|
||||
uncheck_all();
|
||||
child_match.style = "fill:#0024b9;stroke:#0024b9";
|
||||
child_match_0.style = "stroke:#0024b9";
|
||||
go_to_condition(state_machine_index_i, transtion, condition);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
graph.push(embed);
|
||||
document.body.contentEditable = false;
|
||||
}
|
||||
|
||||
function uncheck_all() {
|
||||
for (let i = 0; i < graph.length; i++) {
|
||||
search_in_tree(graph[i], 'polygon');
|
||||
search_in_tree(graph[i], 'path');
|
||||
}
|
||||
}
|
||||
|
||||
function check_state(stm_index, state) {
|
||||
let states = stms[stm_index].states;
|
||||
for (let i = 0; i < states.length; ++i) {
|
||||
if (states[i].name.replace(/\"/g, '').replace(/\'/g, '') === state) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function search_in_tree(element, matchingTitle) {
|
||||
let match = undefined;
|
||||
function recursive_searchTree(element, matchingTitle) {
|
||||
let type = element.tagName;
|
||||
if (type === matchingTitle) {
|
||||
if (element.style !== undefined && element.style.fill === 'rgb(208, 253, 247)') {
|
||||
element.style = "fill:transparent";
|
||||
}
|
||||
else if (element.style !== undefined && element.style.fill === 'rgb(0, 36, 185)'
|
||||
&& element.style.stroke === 'rgb(0, 36, 185)') {
|
||||
element.style = "fill:#000000;stroke:#000000";
|
||||
}
|
||||
else if (element.style !== undefined && element.style.stroke === 'rgb(0, 36, 185)') {
|
||||
element.style = "fill:none;stroke:#000000";
|
||||
}
|
||||
match = element;
|
||||
} else if (element !== null) {
|
||||
let i;
|
||||
let result = null;
|
||||
let childs = element.childNodes;
|
||||
for (i = 0; result === null && i < childs.length; i++) {
|
||||
result = recursive_searchTree(childs[i], matchingTitle);
|
||||
if (result !== null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
recursive_searchTree(element, matchingTitle);
|
||||
return match;
|
||||
}
|
||||
|
||||
|
||||
function go_to_code_state(stm_index, state) {
|
||||
vscode.postMessage({
|
||||
command: 'go_to_state',
|
||||
stm_index: stm_index,
|
||||
state: state
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function go_to_condition(stm_index, transition, condition) {
|
||||
vscode.postMessage({
|
||||
command: 'go_to_condition',
|
||||
stm_index: stm_index,
|
||||
transition: transition,
|
||||
condition: condition
|
||||
});
|
||||
}
|
||||
|
||||
function delete_graph() {
|
||||
if (graph === undefined) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < graph.length; ++i) {
|
||||
svgPanZoom(graph[i]).destroy();
|
||||
if (div[i].parentNode !== null) {
|
||||
div[i].parentNode.removeChild(div[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let pan_config = {
|
||||
zoomEnabled: true,
|
||||
controlIconsEnabled: true,
|
||||
fit: true,
|
||||
center: true,
|
||||
};
|
||||
|
||||
document.getElementById("export-as-svg").onclick = () => {
|
||||
export_message("svg");
|
||||
};
|
||||
|
||||
function export_message(message) {
|
||||
vscode.postMessage({
|
||||
command: 'export',
|
||||
text: message
|
||||
});
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Dependencies viewer</title>
|
||||
|
||||
<script src="../../public/jquery-2.2.4.min.js"></script>
|
||||
<script src="../../public/svg-pan-zoom.min.js"></script>
|
||||
<script src="../../public/full.render.js"></script>
|
||||
<script src="../../public/viz.js"></script>
|
||||
<div id="svg" style="text-align: center;"></div>
|
||||
<link rel="stylesheet" href="../../../css/fsm_viewer.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="toolbar">
|
||||
<div class="center-panel">
|
||||
<label class="fancy-checkbox">
|
||||
<input id="export-as-svg" name="zoom-mode" type="radio" value="fit" />
|
||||
<div class="button">Save as SVG</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<script src="./fsm_draw.js"></script>
|
||||
<div id="error-info" class="trontron">
|
||||
<div id="inner" class="fuck"></div>
|
||||
</div>
|
||||
<div class="config">
|
||||
<p id="message"></p>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div id="container"></div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,13 +0,0 @@
|
||||
@echo off
|
||||
|
||||
set production_folder=dist
|
||||
|
||||
@REM important static or config
|
||||
|
||||
|
||||
if not exist %production_folder% (
|
||||
mkdir %production_folder%
|
||||
)
|
||||
|
||||
echo vsce package
|
||||
call vsce package
|
@ -1,10 +0,0 @@
|
||||
const { vlogFast, callParser } = require('../../resources/hdlParser');
|
||||
|
||||
const testFile = 'c:/Users/11934/Project/Digital-IDE/Digital-Test/user/src/netlist_test.v';
|
||||
|
||||
(async () => {
|
||||
const fast = await callParser(testFile, 5);
|
||||
console.log(fast);
|
||||
const all = await callParser(testFile, 6);
|
||||
console.log(all);
|
||||
})();
|
@ -1,8 +0,0 @@
|
||||
const { svAll } = require('../../resources/hdlParser');
|
||||
|
||||
const testFile = '../Digital-Test/svlog/user/src/hello.sv';
|
||||
|
||||
(async () => {
|
||||
const all = await svAll(testFile);
|
||||
(JSON.stringify(all, null, ' '));
|
||||
})();
|
@ -1,9 +0,0 @@
|
||||
const { vhdlAll } = require('../../resources/hdlParser');
|
||||
|
||||
const testFile = '../Digital-Test/Verilog/dependence_test/test.vhd';
|
||||
|
||||
(async () => {
|
||||
const all = await vhdlAll(testFile);
|
||||
console.log(JSON.stringify(all, null, ' '));
|
||||
console.log('number of symbols:', all.content.length);
|
||||
})();
|
@ -1,8 +0,0 @@
|
||||
const { vhdlFast } = require('../../resources/hdlParser');
|
||||
|
||||
const testFile = '../Digital-Test/Verilog/dependence_test/test.vhd';
|
||||
|
||||
(async () => {
|
||||
const fast = await vhdlFast(testFile);
|
||||
console.log(JSON.stringify(fast, null, ' '));
|
||||
})();
|
@ -1,8 +0,0 @@
|
||||
const { vlogAll } = require('../../resources/hdlParser');
|
||||
|
||||
const testFile = '../Digital-Test/user/src/child_2.v';
|
||||
|
||||
(async () => {
|
||||
const all = await vlogAll(testFile);
|
||||
console.log(JSON.stringify(all, null, ' '));
|
||||
})();
|
@ -1,8 +0,0 @@
|
||||
const { vlogFast, callParser } = require('../../resources/hdlParser');
|
||||
|
||||
const testFile = '../Digital-Test/user/src/netlist_test.v';
|
||||
|
||||
(async () => {
|
||||
const fast = await vlogFast(testFile);
|
||||
console.log(JSON.stringify(fast, null, ' '));
|
||||
})();
|
@ -18,7 +18,6 @@ async function registerCommand(context: vscode.ExtensionContext, packageJson: an
|
||||
func.registerTreeViewDataProvider(context);
|
||||
func.registerLsp(context, packageJson.version);
|
||||
func.registerToolCommands(context);
|
||||
func.registerFSM(context);
|
||||
func.registerNetlist(context);
|
||||
func.registerWaveViewer(context);
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
import { FsmViewer } from '../../../resources/fsm';
|
||||
|
||||
async function openFsmViewer(context: vscode.ExtensionContext, uri: vscode.Uri) {
|
||||
const viewer = new FsmViewer(context);
|
||||
viewer.open(uri);
|
||||
|
||||
}
|
||||
|
||||
export {
|
||||
|
Loading…
x
Reference in New Issue
Block a user