removed unnecssary comments and code

This commit is contained in:
Kalyan Kumar 2025-06-11 17:59:01 +05:30
parent cb1b7a19e3
commit d93e9b956c
3 changed files with 12 additions and 90 deletions

View file

@ -1,60 +0,0 @@
// module definition
//```wavedrom
//{ signal: [
// { name: "clk", wave: "p.....|..." },
// { name: "Data", wave: "x.345x|=.x", data: ["head", "body", "tail", "data"] },
// { name: "Request", wave: "0.1..0|1.0" },
// {},
// { name: "Acknowledge", wave: "1.....|01." }
//]}
//```
module ModuleA #(
param ParamA: u32 = 10,
const ParamB: u32 = 10, // trailing comma is allowed
) (
i_clk : input clock , // `clock` is a special type for clock
i_rst : input reset , // `reset` is a special type for reset
i_sel : input logic ,
i_data: input logic<ParamA> [2], // `[]` means unpacked array in SystemVerilog
o_data: output logic<ParamA> , // `<>` means packed array in SystemVerilog
) {
// const parameter declaration
// `param` is not allowed in module
const ParamC: u32 = 10;
// variable declaration
var r_data0: logic<ParamA>;
var r_data1: logic<ParamA>;
var r_data2: logic<ParamA>;
// value binding
let _w_data2: logic<ParamA> = i_data;
// always_ff statement with reset
// `always_ff` can take a mandatory clock and a optional reset
// `if_reset` means `if (i_rst)`. This conceals reset porality
// `()` of `if` is not required
// `=` in `always_ff` is non-blocking assignment
always_ff (i_clk, i_rst) {
if_reset {
r_data0 = 0;
} else if i_sel {
r_data0 = i_data[0];
} else {
r_data0 = i_data[1];
}
}
// always_ff statement without reset
always_ff (i_clk) {
r_data1 = r_data0;
}
// clock and reset can be omitted
// if there is a single clock and reset in the module
always_ff {
r_data2 = r_data1;
}
assign o_data = r_data1;
}

View file

@ -59,7 +59,7 @@
{
"command": "waveformRender.toggleLivePreview",
"group": "navigation",
"when": "resourceExtname == .json || resourceExtname == .JSON || resourceExtname == .json5 || resourceExtname == .JSON5 || resourceExtname == .veryl"
"when": "resourceExtname == .veryl"
}
]
},
@ -112,9 +112,9 @@
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"update-wavedrom-scripts": "mkdir -p localScripts/skins && curl -k -o localScripts/wavedrom.min.js https://wavedrom.com/wavedrom.min.js && curl -k -o localScripts/skins/dark.js https://wavedrom.com/skins/dark.js && curl -k -o localScripts/skins/default.js https://wavedrom.com/skins/default.js && curl -k -o localScripts/skins/lowkey.js https://wavedrom.com/skins/lowkey.js && curl -k -o localScripts/skins/narrow.js https://wavedrom.com/skins/narrow.js && curl -k -o localScripts/skins/narrower.js https://wavedrom.com/skins/narrower.js && curl -k -o localScripts/skins/narrowerer.js https://wavedrom.com/skins/narrowerer.js && curl -k -o localScripts/skins/width.html https://wavedrom.com/skins/width.html",
"deploy:linux-x64": "vsce publish --target linux-x64",
"deploy:win32-x64": "vsce publish --target win32-x64",
"predeploy:win32-x64": "vsce prepublish --target win32-x64",
"deploy:darwin-x64": "vsce publish --target darwin-x64",
"deploy:darwin-arm64": "vsce publish --target darwin-arm64"
},

View file

@ -72,8 +72,8 @@ export function activate(context: vscode.ExtensionContext) {
stopServer().then(function () {startServer(context);}, startServer);
})
);
// Added by Kalyan for Waveform Render start
// Start and live preview mode
// Kalyan start
context.subscriptions.push(
vscode.commands.registerCommand("waveformRender.start", () => {
WaveformRenderPanel.disableLivePreview();
@ -95,10 +95,7 @@ export function activate(context: vscode.ExtensionContext) {
if (
WaveformRenderPanel.livePreview &&
editor &&
(editor.document.fileName.toLowerCase().endsWith(".json") ||
editor.document.fileName.toLowerCase().endsWith(".json5") ||
// Added by Kalyan to support Veryl files
editor.document.fileName.toLowerCase().endsWith(".veryl"))
(editor.document.fileName.toLowerCase().endsWith(".veryl"))
) {
WaveformRenderPanel.createOrShow(context.extensionPath);
}
@ -116,7 +113,7 @@ export function activate(context: vscode.ExtensionContext) {
WaveformRenderPanel.saveAsSvg();
})
);
// Kalyan end
// Added by Kalyan for Waveform Render start
startServer(context);
}
@ -127,7 +124,7 @@ export function deactivate(): Thenable<void> {
}
// Added by kalyan
// Added by kalyan for Waveform Render start
function getFilename() {
const editor = vscode.window.activeTextEditor;
if (!editor || !editor.document) {
@ -140,7 +137,7 @@ function getFilename() {
return fileName
.split(/[\\/]/)
.pop()
?.replace(/\.json5?$/i, "") ?? "untitled";
?.replace(/\.veryl?$/i, "") ?? "untitled";
}
function getTitle() {
@ -157,8 +154,8 @@ class WaveformRenderPanel {
public static currentPanel: WaveformRenderPanel | undefined;
public static livePreview: boolean = false;
public static livePreviewDocumentPath: string | null;
public static listenerTextChange: vscode.Disposable | undefined;
public static livePreviewDocumentPath: string | null;
public static listenerTextChange: vscode.Disposable | undefined;
public static readonly viewType = "waveformRender";
@ -210,12 +207,7 @@ public static listenerTextChange: vscode.Disposable | undefined;
// Ensure we have an active editor and it's a JSON file
if (
!activeEditor ||
!(
activeEditor.document.fileName.toLowerCase().endsWith(".json") ||
activeEditor.document.fileName.toLowerCase().endsWith(".json5") ||
// Added by Kalyan to support Veryl files
activeEditor.document.fileName.toLowerCase().endsWith(".veryl")
)
!(activeEditor.document.fileName.toLowerCase().endsWith(".veryl"))
) {
return;
}
@ -307,18 +299,8 @@ public static listenerTextChange: vscode.Disposable | undefined;
let docContent = doc.getText();
const match = docContent.match(/```wavedrom([\s\S]*?)```/);
const wavedromContent = match ? match[1].trim() : "";
// if (match) {
// const wavedromContent = match[1].trim();
// console.log("Extracted content:\n", wavedromContent);
// }
const cleaned = wavedromContent.replace(/\//g, '');
console.log("Kalyan: docContent", docContent);
vscode.window.showInformationMessage(
"Kalyan " + cleaned
);
// Set the webview's html content
// this._update(docContent, getFilename());
this._update(cleaned, getFilename());
const cleanedContent = wavedromContent.replace(/\//g, '');
this._update(cleanedContent, getFilename());
}
private _update(