diff --git a/public/index.html b/public/index.html index 1a0c6dd..b2a4d4c 100644 --- a/public/index.html +++ b/public/index.html @@ -15,7 +15,7 @@ diff --git a/src/api/definition.js b/src/api/definition.js index 69be38e..ac1c046 100644 --- a/src/api/definition.js +++ b/src/api/definition.js @@ -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 } }); } } diff --git a/src/api/index.js b/src/api/index.js index b547af1..7d65cca 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -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') { diff --git a/src/components/treeview/info.js b/src/components/treeview/info.js index 984870e..13091d1 100644 --- a/src/components/treeview/info.js +++ b/src/components/treeview/info.js @@ -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; } }); diff --git a/src/components/treeview/info.vue b/src/components/treeview/info.vue index 44cebfa..65bc536 100644 --- a/src/components/treeview/info.vue +++ b/src/components/treeview/info.vue @@ -25,6 +25,17 @@ {{ renderDefinition(infoView.definition) }} + + {{ t('common.instance-name') }} + {{ infoView.instanceName }} + + + {{ t('common.instance-definition') }} + + {{ renderDefinition(infoView.instanceDefinition) }} + + + {{ t('common.input-number') }} {{ infoView.inputCount }} diff --git a/src/components/treeview/modules.vue b/src/components/treeview/modules.vue index e7260bd..a9eaad6 100644 --- a/src/components/treeview/modules.vue +++ b/src/components/treeview/modules.vue @@ -35,6 +35,7 @@ @@ -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 }; } diff --git a/src/hook/jsdoc.js b/src/hook/jsdoc.js index 322a0b4..c5132d7 100644 --- a/src/hook/jsdoc.js +++ b/src/hook/jsdoc.js @@ -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] 例化模块在原模块中的视图 */ diff --git a/src/i18n/ar.json b/src/i18n/ar.json index 2dd5dfa..d80d5dd 100644 --- a/src/i18n/ar.json +++ b/src/i18n/ar.json @@ -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": "تعريف التمثيل" } \ No newline at end of file diff --git a/src/i18n/de.json b/src/i18n/de.json index 7163355..2eb17c5 100644 --- a/src/i18n/de.json +++ b/src/i18n/de.json @@ -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" } \ No newline at end of file diff --git a/src/i18n/en.json b/src/i18n/en.json index ac65963..6cc6663 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -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" } \ No newline at end of file diff --git a/src/i18n/fr.json b/src/i18n/fr.json index c5844ec..74e1181 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -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" } \ No newline at end of file diff --git a/src/i18n/ja.json b/src/i18n/ja.json index 16a1749..2ff9d18 100644 --- a/src/i18n/ja.json +++ b/src/i18n/ja.json @@ -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": "インスタンス化定義" } \ No newline at end of file diff --git a/src/i18n/ko.json b/src/i18n/ko.json index dc5458d..39e2193 100644 --- a/src/i18n/ko.json +++ b/src/i18n/ko.json @@ -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": "인스턴스화 정의" } \ No newline at end of file diff --git a/src/i18n/ru.json b/src/i18n/ru.json index ed86c46..b8bb795 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -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": "Определение инстанцирования" } \ No newline at end of file diff --git a/src/i18n/zh-cn.json b/src/i18n/zh-cn.json index 9d5bea6..db8924a 100644 --- a/src/i18n/zh-cn.json +++ b/src/i18n/zh-cn.json @@ -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": "例化定义" } \ No newline at end of file diff --git a/src/i18n/zh-tw.json b/src/i18n/zh-tw.json index f44ad96..0674a0f 100644 --- a/src/i18n/zh-tw.json +++ b/src/i18n/zh-tw.json @@ -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": "實例化定義" } \ No newline at end of file