52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
import mitt from 'mitt';
|
|
import { reactive } from 'vue';
|
|
|
|
const emitter = mitt();
|
|
|
|
// 用于记载全局的一些对象,以便在不同组件中比较 ID
|
|
const globalLookup = reactive({
|
|
// 所有的顶层文件
|
|
topModules: [],
|
|
// 当前选中的 信号,也就是 tree-view 左列的,默认是第一个。不可复选。
|
|
currentModule: undefined,
|
|
// 当前选中的某个 信号 的 数据。可复选。
|
|
currentWires: new Set(),
|
|
|
|
// 模拟器的版本,比如如果使用 iverilog 那么就是 Icarus Verilog
|
|
version: '',
|
|
// 创建时间
|
|
date: '',
|
|
// 状态 默认是 simulation
|
|
status: '',
|
|
// 单位时间
|
|
timescale: '',
|
|
// 初始时间,一般都是 0
|
|
t0: 0,
|
|
|
|
initcurrentModule(module) {
|
|
if (this.currentModule === undefined && module) {
|
|
this.currentModule = module;
|
|
}
|
|
// 创造 parent
|
|
if (module.body && module.body instanceof Array) {
|
|
for (const childModule of module.body) {
|
|
childModule.parent = module;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
const globalSetting = reactive({
|
|
caseSensitivity: false,
|
|
displayParentOnly: false,
|
|
displaySignalHeight: 50,
|
|
searchMode: 'so', // so, mo, sm
|
|
searchScope: ['wire', 'reg'],
|
|
displaySignalInfoScope: ['width', 'parent'],
|
|
})
|
|
|
|
export {
|
|
emitter,
|
|
globalLookup,
|
|
globalSetting
|
|
}; |