解决例化多重申明索引错误的问题
This commit is contained in:
parent
57298904a0
commit
091bacf006
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.readNetFile = async () => {
|
window.readNetFile = async () => {
|
||||||
const inputVcdFile = 'IF_ID.json';
|
const inputVcdFile = 'full_adder.json';
|
||||||
const skin = 'dide.skin';
|
const skin = 'dide.skin';
|
||||||
const r1 = await fetch(inputVcdFile);
|
const r1 = await fetch(inputVcdFile);
|
||||||
const r2 = await fetch(skin);
|
const r2 = await fetch(skin);
|
||||||
@ -23,7 +23,7 @@
|
|||||||
const skinBinary = await r2.arrayBuffer();
|
const skinBinary = await r2.arrayBuffer();
|
||||||
return [ netJson, skinBinary ];
|
return [ netJson, skinBinary ];
|
||||||
}
|
}
|
||||||
window.moduleName = 'IF_ID';
|
window.moduleName = 'full_adder';
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { globalLookup } from "@/hook/global";
|
import { globalLookup } from "@/hook/global";
|
||||||
import { pinkLog } from "@/hook/utils";
|
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 });
|
const res = await axios.post('http://localhost:3000/netlist/goto-definition', { defs });
|
||||||
} else {
|
} else {
|
||||||
vscode.postMessage({
|
vscode.postMessage({
|
||||||
command: 'save-as-svg',
|
command: 'goto-definition',
|
||||||
data: { svgBuffer, moduleName }
|
data: { defs }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import pako from 'pako';
|
|||||||
export const mode = window.acquireVsCodeApi === undefined ? 'debug' : 'release';
|
export const mode = window.acquireVsCodeApi === undefined ? 'debug' : 'release';
|
||||||
pinkLog('digital-netlist-render mode: ' + mode);
|
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) {
|
function getColorFromMacro(rootStyles, optionName, theme, isLight) {
|
||||||
if (theme === 'dark') {
|
if (theme === 'dark') {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { globalLookup, globalSetting } from '@/hook/global';
|
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 { SkinManager } from '@/hook/skin';
|
||||||
import i18n from '@/i18n';
|
import i18n from '@/i18n';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
@ -30,6 +30,8 @@ export const infoView = reactive({
|
|||||||
inoutCount: undefined,
|
inoutCount: undefined,
|
||||||
instanceCount: undefined,
|
instanceCount: undefined,
|
||||||
cellCount: undefined,
|
cellCount: undefined,
|
||||||
|
instanceName: undefined,
|
||||||
|
instanceDefinition: undefined,
|
||||||
|
|
||||||
// edge 渲染属性
|
// edge 渲染属性
|
||||||
from: undefined,
|
from: undefined,
|
||||||
@ -54,13 +56,23 @@ export const infoView = reactive({
|
|||||||
/**
|
/**
|
||||||
* @description 显示一个 module 到当前窗口
|
* @description 显示一个 module 到当前窗口
|
||||||
* @param {ModuleView} module
|
* @param {ModuleView} module
|
||||||
|
* @param {Cell} [cell]
|
||||||
*/
|
*/
|
||||||
displayModule(module) {
|
displayModule(module, cell) {
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
|
const isTop = (cell === undefined);
|
||||||
|
|
||||||
this.name = module.name;
|
this.name = module.name;
|
||||||
this.type = t("common.instance");
|
this.type = (!isTop) ?
|
||||||
|
t("common.instance"):
|
||||||
|
t('common.top-module');
|
||||||
|
|
||||||
this.typeId = 'module';
|
this.typeId = 'module';
|
||||||
this.definition = module.definition;
|
this.definition = module.definition;
|
||||||
|
|
||||||
|
this.instanceName = (cell || {}).name;
|
||||||
|
this.instanceDefinition = (cell || {}).definition;
|
||||||
|
|
||||||
const portInfo = module.portInfo;
|
const portInfo = module.portInfo;
|
||||||
this.inputCount = portInfo.input;
|
this.inputCount = portInfo.input;
|
||||||
@ -99,6 +111,6 @@ export const infoView = reactive({
|
|||||||
this.width = undefined;
|
this.width = undefined;
|
||||||
this.from = undefined;
|
this.from = undefined;
|
||||||
this.to = undefined;
|
this.to = undefined;
|
||||||
|
this.instanceName = undefined;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -25,6 +25,17 @@
|
|||||||
<span class="iconfont icon-link"></span>{{ renderDefinition(infoView.definition) }}
|
<span class="iconfont icon-link"></span>{{ renderDefinition(infoView.definition) }}
|
||||||
</span>
|
</span>
|
||||||
</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 class="info-item-container">
|
||||||
<span>{{ t('common.input-number') }}</span>
|
<span>{{ t('common.input-number') }}</span>
|
||||||
<span>{{ infoView.inputCount }}</span>
|
<span>{{ infoView.inputCount }}</span>
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
<modules
|
<modules
|
||||||
v-for="(cell, index) in cells"
|
v-for="(cell, index) in cells"
|
||||||
:module="cell.view"
|
:module="cell.view"
|
||||||
|
:cell="cell.data"
|
||||||
:render-name="cell.renderName"
|
:render-name="cell.renderName"
|
||||||
:key="index"
|
:key="index"
|
||||||
></modules>
|
></modules>
|
||||||
@ -57,6 +58,9 @@ const props = defineProps({
|
|||||||
type: ModuleView,
|
type: ModuleView,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
cell: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
renderName: {
|
renderName: {
|
||||||
type: String
|
type: String
|
||||||
}
|
}
|
||||||
@ -90,6 +94,7 @@ for (const cellName of module.nameToCell.keys()) {
|
|||||||
if (cell.isInstantiation) {
|
if (cell.isInstantiation) {
|
||||||
cells.push({
|
cells.push({
|
||||||
name: cellName,
|
name: cellName,
|
||||||
|
data: cell,
|
||||||
view: cell.belongModuleView,
|
view: cell.belongModuleView,
|
||||||
renderName: `${cellName} (${cell.belongModuleView.name})`
|
renderName: `${cellName} (${cell.belongModuleView.name})`
|
||||||
});
|
});
|
||||||
@ -103,7 +108,12 @@ function sameModule(module) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const currentView = globalLookup.currentSelectEntity.moduleView;
|
const currentView = globalLookup.currentSelectEntity.moduleView;
|
||||||
|
const cell = globalLookup.currentSelectEntity.cell;
|
||||||
|
if (cell && props.cell !== cell) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const data = globalLookup.currentSelectEntity.data;
|
const data = globalLookup.currentSelectEntity.data;
|
||||||
|
|
||||||
return data.name === module.name && currentView.name === module.name;
|
return data.name === module.name && currentView.name === module.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,19 +135,16 @@ function clickPort(port) {
|
|||||||
type: 'port',
|
type: 'port',
|
||||||
moduleView: props.module
|
moduleView: props.module
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取渲染视图,并高亮对应的渲染实体
|
|
||||||
const renderView = globalLookup.netlistRender.renderView;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickModule() {
|
function clickModule() {
|
||||||
infoView.displayModule(module);
|
infoView.displayModule(module, props.cell);
|
||||||
|
|
||||||
globalLookup.currentSelectEntity = {
|
globalLookup.currentSelectEntity = {
|
||||||
data: props.module,
|
data: props.module,
|
||||||
type: 'module',
|
type: 'module',
|
||||||
moduleView: props.module
|
moduleView: props.module,
|
||||||
|
cell: props.cell
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Module } from "./render/layout";
|
import { Module } from "./render/layout";
|
||||||
import { ModuleView } from "./render/yosys";
|
import { Cell, ModuleView } from "./render/yosys";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {number | string} WireId 信号ID
|
* @typedef {number | string} WireId 信号ID
|
||||||
@ -278,6 +278,7 @@ import { ModuleView } from "./render/yosys";
|
|||||||
* @property {any} data 数据本体,用于匹配 id
|
* @property {any} data 数据本体,用于匹配 id
|
||||||
* @property {'module' | 'port'} type 类型
|
* @property {'module' | 'port'} type 类型
|
||||||
* @property {ModuleView} moduleView 所在模块的数据视图
|
* @property {ModuleView} moduleView 所在模块的数据视图
|
||||||
|
* @property {Cell} [cell] 例化模块在原模块中的视图
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,5 +57,8 @@
|
|||||||
"common.output-number": "عدد الإخراج",
|
"common.output-number": "عدد الإخراج",
|
||||||
"common.inout-number": "الكمية",
|
"common.inout-number": "الكمية",
|
||||||
"common.instance-number": "عدد الوحدات المثبتة",
|
"common.instance-number": "عدد الوحدات المثبتة",
|
||||||
"common.general-cell-number": "عدد الأجهزة العامة"
|
"common.general-cell-number": "عدد الأجهزة العامة",
|
||||||
|
"common.top-module": "الوحدة العلوية",
|
||||||
|
"common.instance-name": "اسم مستعار",
|
||||||
|
"common.instance-definition": "تعريف التمثيل"
|
||||||
}
|
}
|
@ -57,5 +57,8 @@
|
|||||||
"common.output-number": "Ausgabemenge",
|
"common.output-number": "Ausgabemenge",
|
||||||
"common.inout-number": "Menge",
|
"common.inout-number": "Menge",
|
||||||
"common.instance-number": "Anzahl der instanziierten Module",
|
"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"
|
||||||
}
|
}
|
@ -57,5 +57,8 @@
|
|||||||
"common.output-number": "output quantity",
|
"common.output-number": "output quantity",
|
||||||
"common.inout-number": "Quantity",
|
"common.inout-number": "Quantity",
|
||||||
"common.instance-number": "Number of instantiated modules",
|
"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"
|
||||||
}
|
}
|
@ -57,5 +57,8 @@
|
|||||||
"common.output-number": "quantité de sortie",
|
"common.output-number": "quantité de sortie",
|
||||||
"common.inout-number": "Quantité",
|
"common.inout-number": "Quantité",
|
||||||
"common.instance-number": "Nombre de modules instanciés",
|
"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"
|
||||||
}
|
}
|
@ -57,5 +57,8 @@
|
|||||||
"common.output-number": "出力数量",
|
"common.output-number": "出力数量",
|
||||||
"common.inout-number": "数量",
|
"common.inout-number": "数量",
|
||||||
"common.instance-number": "インスタンス化されたモジュールの数",
|
"common.instance-number": "インスタンス化されたモジュールの数",
|
||||||
"common.general-cell-number": "一般デバイスの数"
|
"common.general-cell-number": "一般デバイスの数",
|
||||||
|
"common.top-module": "トップモジュール",
|
||||||
|
"common.instance-name": "別名",
|
||||||
|
"common.instance-definition": "インスタンス化定義"
|
||||||
}
|
}
|
@ -57,5 +57,8 @@
|
|||||||
"common.output-number": "출력 수량",
|
"common.output-number": "출력 수량",
|
||||||
"common.inout-number": "수량",
|
"common.inout-number": "수량",
|
||||||
"common.instance-number": "인스턴스화된 모듈 수",
|
"common.instance-number": "인스턴스화된 모듈 수",
|
||||||
"common.general-cell-number": "일반 장치 수"
|
"common.general-cell-number": "일반 장치 수",
|
||||||
|
"common.top-module": "최상위 모듈",
|
||||||
|
"common.instance-name": "가명",
|
||||||
|
"common.instance-definition": "인스턴스화 정의"
|
||||||
}
|
}
|
@ -57,5 +57,8 @@
|
|||||||
"common.output-number": "количество вывода",
|
"common.output-number": "количество вывода",
|
||||||
"common.inout-number": "Количество",
|
"common.inout-number": "Количество",
|
||||||
"common.instance-number": "Количество созданных модулей",
|
"common.instance-number": "Количество созданных модулей",
|
||||||
"common.general-cell-number": "Количество общих устройств"
|
"common.general-cell-number": "Количество общих устройств",
|
||||||
|
"common.top-module": "Верхний модуль",
|
||||||
|
"common.instance-name": "Псевдоним",
|
||||||
|
"common.instance-definition": "Определение инстанцирования"
|
||||||
}
|
}
|
@ -57,5 +57,8 @@
|
|||||||
"common.output-number": "output 数量",
|
"common.output-number": "output 数量",
|
||||||
"common.inout-number": "inout 数量",
|
"common.inout-number": "inout 数量",
|
||||||
"common.instance-number": "例化模块数量",
|
"common.instance-number": "例化模块数量",
|
||||||
"common.general-cell-number": "通用器件数量"
|
"common.general-cell-number": "通用器件数量",
|
||||||
|
"common.top-module": "顶层模块",
|
||||||
|
"common.instance-name": "例化名",
|
||||||
|
"common.instance-definition": "例化定义"
|
||||||
}
|
}
|
@ -57,5 +57,8 @@
|
|||||||
"common.output-number": "輸出數量",
|
"common.output-number": "輸出數量",
|
||||||
"common.inout-number": "數量",
|
"common.inout-number": "數量",
|
||||||
"common.instance-number": "實例化模組數量",
|
"common.instance-number": "實例化模組數量",
|
||||||
"common.general-cell-number": "通用器件數量"
|
"common.general-cell-number": "通用器件數量",
|
||||||
|
"common.top-module": "頂層模組",
|
||||||
|
"common.instance-name": "別名",
|
||||||
|
"common.instance-definition": "實例化定義"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user