From d6c80a919a96bf77ff8d6aa8bc8f553fce045d0f Mon Sep 17 00:00:00 2001 From: Kirigaya <1193466151@qq.com> Date: Sat, 22 Jul 2023 01:54:18 +0800 Subject: [PATCH] #fix beta 0.3.0 Bitwidth of 1-bit signal is incorrectly recognized as Unknown in auto instantiation and auto document --- src/function/hdlDoc/markdown.ts | 11 ++++++++--- src/function/sim/instance.ts | 3 +++ src/test/user/Hardware/src/netlist_test.v | 1 + tsconfig.json | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/function/hdlDoc/markdown.ts b/src/function/hdlDoc/markdown.ts index 017a5ce..037a871 100644 --- a/src/function/hdlDoc/markdown.ts +++ b/src/function/hdlDoc/markdown.ts @@ -31,15 +31,20 @@ function makeTableFromObjArray(md: MarkdownString, array: any[], name: string, f const rows = []; for (const obj of array) { const data = []; - for (const name of fieldNames) { - let value = obj[name]; - if (name === 'instModPath' && value) { + for (const subName of fieldNames) { + let value = obj[subName]; + if (subName === 'instModPath' && value) { value = value.replace(ws, ''); } if (value && value.trim().length === 0) { value = ' '; } + + // TODO : 1 not known + if (name === 'ports' && value === 'Unknown') { + value = '1'; + } data.push(value); } rows.push(data); diff --git a/src/function/sim/instance.ts b/src/function/sim/instance.ts index b01044b..72b15d1 100644 --- a/src/function/sim/instance.ts +++ b/src/function/sim/instance.ts @@ -86,6 +86,9 @@ function makeNetOutputDeclaration(ports: HdlModulePort[], prefix: string, needCo if (port.type === HdlModulePortType.Output) { haveOutput = true; let portWidth = port.width ? port.width : ''; + if (portWidth === 'Unknown') { + portWidth = ''; + } portWidth += ' '.repeat(maxWidthLength - portWidth.length + 1); const netDeclaration = prefix + `wire ${portWidth}\t${port.name};\n`; netOutputDeclaration += netDeclaration; diff --git a/src/test/user/Hardware/src/netlist_test.v b/src/test/user/Hardware/src/netlist_test.v index 0abc1fd..ea8dc7d 100644 --- a/src/test/user/Hardware/src/netlist_test.v +++ b/src/test/user/Hardware/src/netlist_test.v @@ -11,6 +11,7 @@ output reg carry_out, borrow_out, parity_out; reg [9:0] cnt_up, cnt_dn; reg [8:0] count_nxt; + always @(posedge clock) begin cnt_dn = count_out - 3'b 101; diff --git a/tsconfig.json b/tsconfig.json index e8f8126..34f8f15 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "module": "commonjs", "target": "ES2020", - "outDir": "out-js", + "outDir": "out", "skipLibCheck": true, "lib": [ "ES2020"