解决例化多重申明索引错误的问题

This commit is contained in:
锦恢 2025-01-04 23:57:24 +08:00
parent 57298904a0
commit 091bacf006
16 changed files with 84 additions and 26 deletions

View File

@ -15,7 +15,7 @@
<script>
window.readNetFile = async () => {
const inputVcdFile = 'IF_ID.json';
const inputVcdFile = 'full_adder.json';
const skin = 'dide.skin';
const r1 = await fetch(inputVcdFile);
const r2 = await fetch(skin);
@ -23,7 +23,7 @@
const skinBinary = await r2.arrayBuffer();
return [ netJson, skinBinary ];
}
window.moduleName = 'IF_ID';
window.moduleName = 'full_adder';
</script>
</head>

View File

@ -1,7 +1,7 @@
import axios from 'axios';
import { globalLookup } from "@/hook/global";
import { pinkLog } from "@/hook/utils";
import { mode } from ".";
import { mode, vscode } from ".";
/**
@ -14,8 +14,8 @@ export async function gotoDefinition(definition) {
const res = await axios.post('http://localhost:3000/netlist/goto-definition', { defs });
} else {
vscode.postMessage({
command: 'save-as-svg',
data: { svgBuffer, moduleName }
command: 'goto-definition',
data: { defs }
});
}
}

View File

@ -8,7 +8,7 @@ import pako from 'pako';
export const mode = window.acquireVsCodeApi === undefined ? 'debug' : 'release';
pinkLog('digital-netlist-render mode: ' + mode);
let vscode = window.acquireVsCodeApi === undefined ? undefined : acquireVsCodeApi();
export let vscode = window.acquireVsCodeApi === undefined ? undefined : acquireVsCodeApi();
function getColorFromMacro(rootStyles, optionName, theme, isLight) {
if (theme === 'dark') {

View File

@ -1,5 +1,5 @@
import { globalLookup, globalSetting } from '@/hook/global';
import { ModuleView, Port } from '@/hook/render/yosys';
import { Cell, ModuleView, Port } from '@/hook/render/yosys';
import { SkinManager } from '@/hook/skin';
import i18n from '@/i18n';
import { reactive } from 'vue';
@ -30,6 +30,8 @@ export const infoView = reactive({
inoutCount: undefined,
instanceCount: undefined,
cellCount: undefined,
instanceName: undefined,
instanceDefinition: undefined,
// edge 渲染属性
from: undefined,
@ -54,13 +56,23 @@ export const infoView = reactive({
/**
* @description 显示一个 module 到当前窗口
* @param {ModuleView} module
* @param {Cell} [cell]
*/
displayModule(module) {
displayModule(module, cell) {
this.clear();
const isTop = (cell === undefined);
this.name = module.name;
this.type = t("common.instance");
this.type = (!isTop) ?
t("common.instance"):
t('common.top-module');
this.typeId = 'module';
this.definition = module.definition;
this.instanceName = (cell || {}).name;
this.instanceDefinition = (cell || {}).definition;
const portInfo = module.portInfo;
this.inputCount = portInfo.input;
@ -99,6 +111,6 @@ export const infoView = reactive({
this.width = undefined;
this.from = undefined;
this.to = undefined;
this.instanceName = undefined;
}
});

View File

@ -25,6 +25,17 @@
<span class="iconfont icon-link"></span>{{ renderDefinition(infoView.definition) }}
</span>
</span>
<span class="info-item-container" v-if="infoView.instanceName">
<span>{{ t('common.instance-name') }}</span>
<span><code>{{ infoView.instanceName }}</code></span>
</span>
<span class="info-item-container" v-if="infoView.instanceDefinition">
<span>{{ t('common.instance-definition') }}</span>
<span class="definition" @click="gotoDefinition(infoView.instanceDefinition)">
<span class="iconfont icon-link"></span>{{ renderDefinition(infoView.instanceDefinition) }}
</span>
</span>
<span class="info-item-container">
<span>{{ t('common.input-number') }}</span>
<span>{{ infoView.inputCount }}</span>

View File

@ -35,6 +35,7 @@
<modules
v-for="(cell, index) in cells"
:module="cell.view"
:cell="cell.data"
:render-name="cell.renderName"
:key="index"
></modules>
@ -57,6 +58,9 @@ const props = defineProps({
type: ModuleView,
required: true
},
cell: {
type: Object
},
renderName: {
type: String
}
@ -90,6 +94,7 @@ for (const cellName of module.nameToCell.keys()) {
if (cell.isInstantiation) {
cells.push({
name: cellName,
data: cell,
view: cell.belongModuleView,
renderName: `${cellName} (${cell.belongModuleView.name})`
});
@ -103,7 +108,12 @@ function sameModule(module) {
return false;
}
const currentView = globalLookup.currentSelectEntity.moduleView;
const cell = globalLookup.currentSelectEntity.cell;
if (cell && props.cell !== cell) {
return false;
}
const data = globalLookup.currentSelectEntity.data;
return data.name === module.name && currentView.name === module.name;
}
@ -125,19 +135,16 @@ function clickPort(port) {
type: 'port',
moduleView: props.module
};
//
const renderView = globalLookup.netlistRender.renderView;
}
function clickModule() {
infoView.displayModule(module);
infoView.displayModule(module, props.cell);
globalLookup.currentSelectEntity = {
data: props.module,
type: 'module',
moduleView: props.module
moduleView: props.module,
cell: props.cell
};
}

View File

@ -6,7 +6,7 @@
*/
import { Module } from "./render/layout";
import { ModuleView } from "./render/yosys";
import { Cell, ModuleView } from "./render/yosys";
/**
* @typedef {number | string} WireId 信号ID
@ -278,6 +278,7 @@ import { ModuleView } from "./render/yosys";
* @property {any} data 数据本体用于匹配 id
* @property {'module' | 'port'} type 类型
* @property {ModuleView} moduleView 所在模块的数据视图
* @property {Cell} [cell] 例化模块在原模块中的视图
*/

View File

@ -57,5 +57,8 @@
"common.output-number": "عدد الإخراج",
"common.inout-number": "الكمية",
"common.instance-number": "عدد الوحدات المثبتة",
"common.general-cell-number": "عدد الأجهزة العامة"
"common.general-cell-number": "عدد الأجهزة العامة",
"common.top-module": "الوحدة العلوية",
"common.instance-name": "اسم مستعار",
"common.instance-definition": "تعريف التمثيل"
}

View File

@ -57,5 +57,8 @@
"common.output-number": "Ausgabemenge",
"common.inout-number": "Menge",
"common.instance-number": "Anzahl der instanziierten Module",
"common.general-cell-number": "Anzahl der allgemeinen Geräte"
"common.general-cell-number": "Anzahl der allgemeinen Geräte",
"common.top-module": "Top-Modul",
"common.instance-name": "Pseudonym",
"common.instance-definition": "Instanziierungsdefinition"
}

View File

@ -57,5 +57,8 @@
"common.output-number": "output quantity",
"common.inout-number": "Quantity",
"common.instance-number": "Number of instantiated modules",
"common.general-cell-number": "Number of general devices"
"common.general-cell-number": "Number of general devices",
"common.top-module": "Top Module",
"common.instance-name": "Alias",
"common.instance-definition": "Instantiation Definition"
}

View File

@ -57,5 +57,8 @@
"common.output-number": "quantité de sortie",
"common.inout-number": "Quantité",
"common.instance-number": "Nombre de modules instanciés",
"common.general-cell-number": "Nombre d'appareils généraux"
"common.general-cell-number": "Nombre d'appareils généraux",
"common.top-module": "Module supérieur",
"common.instance-name": "Pseudonyme",
"common.instance-definition": "Définition d'instanciation"
}

View File

@ -57,5 +57,8 @@
"common.output-number": "出力数量",
"common.inout-number": "数量",
"common.instance-number": "インスタンス化されたモジュールの数",
"common.general-cell-number": "一般デバイスの数"
"common.general-cell-number": "一般デバイスの数",
"common.top-module": "トップモジュール",
"common.instance-name": "別名",
"common.instance-definition": "インスタンス化定義"
}

View File

@ -57,5 +57,8 @@
"common.output-number": "출력 수량",
"common.inout-number": "수량",
"common.instance-number": "인스턴스화된 모듈 수",
"common.general-cell-number": "일반 장치 수"
"common.general-cell-number": "일반 장치 수",
"common.top-module": "최상위 모듈",
"common.instance-name": "가명",
"common.instance-definition": "인스턴스화 정의"
}

View File

@ -57,5 +57,8 @@
"common.output-number": "количество вывода",
"common.inout-number": "Количество",
"common.instance-number": "Количество созданных модулей",
"common.general-cell-number": "Количество общих устройств"
"common.general-cell-number": "Количество общих устройств",
"common.top-module": "Верхний модуль",
"common.instance-name": "Псевдоним",
"common.instance-definition": "Определение инстанцирования"
}

View File

@ -57,5 +57,8 @@
"common.output-number": "output 数量",
"common.inout-number": "inout 数量",
"common.instance-number": "例化模块数量",
"common.general-cell-number": "通用器件数量"
"common.general-cell-number": "通用器件数量",
"common.top-module": "顶层模块",
"common.instance-name": "例化名",
"common.instance-definition": "例化定义"
}

View File

@ -57,5 +57,8 @@
"common.output-number": "輸出數量",
"common.inout-number": "數量",
"common.instance-number": "實例化模組數量",
"common.general-cell-number": "通用器件數量"
"common.general-cell-number": "通用器件數量",
"common.top-module": "頂層模組",
"common.instance-name": "別名",
"common.instance-definition": "實例化定義"
}