finish libPick set top function | iverilog simulation
This commit is contained in:
parent
7fee932ade
commit
8a4fc5bb70
@ -1,4 +1,5 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
import * as fs from 'fs';
|
||||||
import * as child_process from 'child_process';
|
import * as child_process from 'child_process';
|
||||||
|
|
||||||
import { hdlParam } from '../../hdlParser';
|
import { hdlParam } from '../../hdlParser';
|
||||||
@ -53,7 +54,7 @@ class Simulate {
|
|||||||
};
|
};
|
||||||
let code = hdlFile.readFile(path);
|
let code = hdlFile.readFile(path);
|
||||||
if (!code) {
|
if (!code) {
|
||||||
MainOutput.report('error when read ' + path, ReportType.Error);
|
MainOutput.report('error when read ' + path, ReportType.Error, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,11 +70,14 @@ class Simulate {
|
|||||||
// make simulation dir
|
// make simulation dir
|
||||||
const defaultSimulationDir = hdlPath.join(opeParam.prjInfo.arch.prjPath, 'simulation', 'icarus');
|
const defaultSimulationDir = hdlPath.join(opeParam.prjInfo.arch.prjPath, 'simulation', 'icarus');
|
||||||
simConfig.simulationHome = setting.get('function.simulate.simulationHome', '');
|
simConfig.simulationHome = setting.get('function.simulate.simulationHome', '');
|
||||||
if (!simConfig.simulationHome) {
|
if (!fs.existsSync(simConfig.simulationHome)) {
|
||||||
simConfig.simulationHome = defaultSimulationDir;
|
simConfig.simulationHome = defaultSimulationDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!hdlFile.isDir(simConfig.simulationHome)) {
|
if (!hdlFile.isDir(simConfig.simulationHome)) {
|
||||||
|
MainOutput.report('create dir ' + simConfig.simulationHome, ReportType.Info);
|
||||||
hdlDir.mkdir(simConfig.simulationHome);
|
hdlDir.mkdir(simConfig.simulationHome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +95,7 @@ class Simulate {
|
|||||||
|
|
||||||
simConfig.installPath = setting.get('function.simulate.icarus.installPath', '');
|
simConfig.installPath = setting.get('function.simulate.icarus.installPath', '');
|
||||||
if (simConfig.installPath !== '' && !hdlFile.isDir(simConfig.installPath)) {
|
if (simConfig.installPath !== '' && !hdlFile.isDir(simConfig.installPath)) {
|
||||||
MainOutput.report(`install path ${simConfig.installPath} is illegal`, ReportType.Error);
|
MainOutput.report(`install path ${simConfig.installPath} is illegal`, ReportType.Error, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +259,6 @@ class IcarusSimulate extends Simulate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const runInTerminal = vscode.workspace.getConfiguration().get('function.simulate.runInTerminal');
|
const runInTerminal = vscode.workspace.getConfiguration().get('function.simulate.runInTerminal');
|
||||||
console.log(runInTerminal);
|
|
||||||
|
|
||||||
if (runInTerminal) {
|
if (runInTerminal) {
|
||||||
this.execInTerminal(command, cwd);
|
this.execInTerminal(command, cwd);
|
||||||
@ -267,8 +270,6 @@ class IcarusSimulate extends Simulate {
|
|||||||
private getAllOtherDependences(path: AbsPath, name: string): AbsPath[] {
|
private getAllOtherDependences(path: AbsPath, name: string): AbsPath[] {
|
||||||
const deps = hdlParam.getAllDependences(path, name);
|
const deps = hdlParam.getAllDependences(path, name);
|
||||||
if (deps) {
|
if (deps) {
|
||||||
console.log(deps);
|
|
||||||
|
|
||||||
return deps.others;
|
return deps.others;
|
||||||
} else {
|
} else {
|
||||||
MainOutput.report('Fail to get dependences of path: ' + path + ' name: ' + name, ReportType.Warn);
|
MainOutput.report('Fail to get dependences of path: ' + path + ' name: ' + name, ReportType.Warn);
|
||||||
@ -280,7 +281,8 @@ class IcarusSimulate extends Simulate {
|
|||||||
const name = hdlModule.name;
|
const name = hdlModule.name;
|
||||||
const path = hdlModule.path;
|
const path = hdlModule.path;
|
||||||
if (!hdlParam.isTopModule(path, name, false)) {
|
if (!hdlParam.isTopModule(path, name, false)) {
|
||||||
MainOutput.report('path: ' + path + ' name: ' + name + ' is not top module');
|
const warningMsg = name + ' in ' + path + ' is not top module';
|
||||||
|
MainOutput.report(warningMsg, ReportType.Warn, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const dependences = this.getAllOtherDependences(path, name);
|
const dependences = this.getAllOtherDependences(path, name);
|
||||||
@ -289,7 +291,8 @@ class IcarusSimulate extends Simulate {
|
|||||||
const cwd = hdlPath.resolve(hdlModule.path, '..');
|
const cwd = hdlPath.resolve(hdlModule.path, '..');
|
||||||
this.exec(simulationCommand, cwd);
|
this.exec(simulationCommand, cwd);
|
||||||
} else {
|
} else {
|
||||||
MainOutput.report('Fail to generate command', ReportType.Error);
|
const errorMsg = 'Fail to generate command';
|
||||||
|
MainOutput.report(errorMsg, ReportType.Error, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -309,7 +312,7 @@ class IcarusSimulate extends Simulate {
|
|||||||
|
|
||||||
const currentFile = hdlParam.getHdlFile(path);
|
const currentFile = hdlParam.getHdlFile(path);
|
||||||
if (!currentFile) {
|
if (!currentFile) {
|
||||||
MainOutput.report('path ' + path + ' is not a hdlFile', ReportType.Error);
|
MainOutput.report('path ' + path + ' is not a hdlFile', ReportType.Error, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const items = getSelectItem(currentFile.getAllHdlModules());
|
const items = getSelectItem(currentFile.getAllHdlModules());
|
||||||
|
@ -58,7 +58,6 @@ async function testbench() {
|
|||||||
placeHolder: 'Select a Module to generate testbench'
|
placeHolder: 'Select a Module to generate testbench'
|
||||||
};
|
};
|
||||||
const path = hdlPath.toSlash(uri.fsPath);
|
const path = hdlPath.toSlash(uri.fsPath);
|
||||||
console.log(path);
|
|
||||||
|
|
||||||
if (!hdlFile.isHDLFile(path)) {
|
if (!hdlFile.isHDLFile(path)) {
|
||||||
return;
|
return;
|
||||||
|
@ -52,27 +52,26 @@ function canExpandable(element: ModuleDataItem) {
|
|||||||
|
|
||||||
|
|
||||||
class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
||||||
treeEventEmitter: vscode.EventEmitter<ModuleDataItem>;
|
_onDidChangeTreeData: vscode.EventEmitter<ModuleDataItem>;
|
||||||
treeEvent: vscode.Event<ModuleDataItem>;
|
onDidChangeTreeData: vscode.Event<ModuleDataItem>;
|
||||||
firstTop: FirstTop;
|
firstTop: FirstTop;
|
||||||
srcRootItem: ModuleDataItem;
|
srcRootItem: ModuleDataItem;
|
||||||
simRootItem: ModuleDataItem;
|
simRootItem: ModuleDataItem;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.treeEventEmitter = new vscode.EventEmitter<ModuleDataItem>();
|
this._onDidChangeTreeData = new vscode.EventEmitter<ModuleDataItem>();
|
||||||
this.treeEvent = this.treeEventEmitter.event;
|
this.onDidChangeTreeData = this._onDidChangeTreeData.event;
|
||||||
this.firstTop = {
|
this.firstTop = {
|
||||||
src: null,
|
src: null,
|
||||||
sim: null,
|
sim: null,
|
||||||
};
|
};
|
||||||
this.srcRootItem = {icon: 'src', type: HdlFileType.Src, name: 'src', range: null, path: '', parent: null};
|
this.srcRootItem = {icon: 'src', type: HdlFileType.Src, name: 'src', range: null, path: '', parent: null};
|
||||||
this.simRootItem = {icon: 'sim', type: HdlFileType.Sim, name: 'sim', range: null, path: '', parent: null};
|
this.simRootItem = {icon: 'sim', type: HdlFileType.Sim, name: 'sim', range: null, path: '', parent: null};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public refresh(element?: ModuleDataItem) {
|
public refresh(element?: ModuleDataItem) {
|
||||||
if (element) {
|
if (element) {
|
||||||
this.treeEventEmitter.fire(element);
|
this._onDidChangeTreeData.fire(element);
|
||||||
} else {
|
} else {
|
||||||
// refresh all the root in default
|
// refresh all the root in default
|
||||||
this.refreshSim();
|
this.refreshSim();
|
||||||
@ -81,13 +80,11 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public refreshSrc() {
|
public refreshSrc() {
|
||||||
this.treeEventEmitter.fire(this.srcRootItem);
|
this._onDidChangeTreeData.fire(this.srcRootItem);
|
||||||
console.log('enter');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public refreshSim() {
|
public refreshSim() {
|
||||||
this.treeEventEmitter.fire(this.simRootItem);
|
this._onDidChangeTreeData.fire(this.simRootItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -136,8 +133,6 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
|
|||||||
|
|
||||||
public getChildren(element?: ModuleDataItem | undefined): vscode.ProviderResult<ModuleDataItem[]> {
|
public getChildren(element?: ModuleDataItem | undefined): vscode.ProviderResult<ModuleDataItem[]> {
|
||||||
if (element) {
|
if (element) {
|
||||||
console.log(element);
|
|
||||||
|
|
||||||
const name = element.name;
|
const name = element.name;
|
||||||
if (name === 'sim' || name === 'src') {
|
if (name === 'sim' || name === 'src') {
|
||||||
element.parent = null;
|
element.parent = null;
|
||||||
|
@ -40,11 +40,31 @@ class Output {
|
|||||||
return this._ignoreTypes.includes(type);
|
return this._ignoreTypes.includes(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public report(message: string | unknown, type: ReportType = ReportType.Info) {
|
private showInWindows(message: string, type: ReportType = ReportType.Info) {
|
||||||
|
if (type === ReportType.Warn) {
|
||||||
|
vscode.window.showWarningMessage(message);
|
||||||
|
} else if (type === ReportType.Error) {
|
||||||
|
vscode.window.showErrorMessage(message);
|
||||||
|
} else {
|
||||||
|
vscode.window.showInformationMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param message message
|
||||||
|
* @param type report type
|
||||||
|
* @param reportInWindows whether use vscode.windows.<api> to show info
|
||||||
|
*/
|
||||||
|
public report(message: string | unknown, type: ReportType = ReportType.Info, reportInWindows: boolean = false) {
|
||||||
if (!this.skipMessage(type) && message) {
|
if (!this.skipMessage(type) && message) {
|
||||||
this._output.show(true);
|
this._output.show(true);
|
||||||
const currentTime = this.getCurrentTime();
|
const currentTime = this.getCurrentTime();
|
||||||
this._output.appendLine('[' + type + ' - ' + currentTime + '] ' + message);
|
this._output.appendLine('[' + type + ' - ' + currentTime + '] ' + message);
|
||||||
|
|
||||||
|
if (reportInWindows) {
|
||||||
|
this.showInWindows('' + message, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,15 +44,15 @@ const PrjInfoDefaults: PrjInfoMeta = {
|
|||||||
device: 'none',
|
device: 'none',
|
||||||
|
|
||||||
arch: {
|
arch: {
|
||||||
prjPath: './prj',
|
prjPath: '',
|
||||||
hardware: {
|
hardware: {
|
||||||
src: './user/src',
|
src: '',
|
||||||
sim: './user/sim',
|
sim: '',
|
||||||
data: './user/data'
|
data: ''
|
||||||
},
|
},
|
||||||
software: {
|
software: {
|
||||||
src: './user/software/src',
|
src: '',
|
||||||
data: './user/software/data'
|
data: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -155,7 +155,6 @@ class LibPick {
|
|||||||
|
|
||||||
if (selectedPath && hdlPath.exist(selectedPath)) {
|
if (selectedPath && hdlPath.exist(selectedPath)) {
|
||||||
const userPrjInfo = opeParam.getUserPrjInfo();
|
const userPrjInfo = opeParam.getUserPrjInfo();
|
||||||
console.log(userPrjInfo);
|
|
||||||
|
|
||||||
if (selectedPath.includes(this.commonQuickPickItem.path!)) {
|
if (selectedPath.includes(this.commonQuickPickItem.path!)) {
|
||||||
// this is a module import from common, use relative path
|
// this is a module import from common, use relative path
|
||||||
|
17
src/test/vlog/dependence_test/.vscode/property.json
vendored
Normal file
17
src/test/vlog/dependence_test/.vscode/property.json
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"toolChain": "xilinx",
|
||||||
|
"prjName": {
|
||||||
|
"PL": "template"
|
||||||
|
},
|
||||||
|
"soc": {
|
||||||
|
"core": "none"
|
||||||
|
},
|
||||||
|
"arch": {
|
||||||
|
"hardware": {
|
||||||
|
"sim": "./",
|
||||||
|
"src": "./"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enableShowLog": false,
|
||||||
|
"device": "none"
|
||||||
|
}
|
6
src/test/vlog/dependence_test/hello.v
Normal file
6
src/test/vlog/dependence_test/hello.v
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module hello;
|
||||||
|
initial begin
|
||||||
|
$display("hello world");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
endmodule
|
26
src/test/vlog/dependence_test/simulation/icarus/out.vvp
Normal file
26
src/test/vlog/dependence_test/simulation/icarus/out.vvp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#! /c/Source/iverilog-install/bin/vvp
|
||||||
|
:ivl_version "12.0 (devel)" "(s20150603-1110-g18392a46)";
|
||||||
|
:ivl_delay_selection "TYPICAL";
|
||||||
|
:vpi_time_precision + 0;
|
||||||
|
:vpi_module "C:\iverilog\lib\ivl\system.vpi";
|
||||||
|
:vpi_module "C:\iverilog\lib\ivl\vhdl_sys.vpi";
|
||||||
|
:vpi_module "C:\iverilog\lib\ivl\vhdl_textio.vpi";
|
||||||
|
:vpi_module "C:\iverilog\lib\ivl\v2005_math.vpi";
|
||||||
|
:vpi_module "C:\iverilog\lib\ivl\va_math.vpi";
|
||||||
|
:vpi_module "C:\iverilog\lib\ivl\v2009.vpi";
|
||||||
|
S_0000023701252df0 .scope package, "$unit" "$unit" 2 1;
|
||||||
|
.timescale 0 0;
|
||||||
|
S_0000023701252f80 .scope module, "hello" "hello" 3 1;
|
||||||
|
.timescale 0 0;
|
||||||
|
.scope S_0000023701252f80;
|
||||||
|
T_0 ;
|
||||||
|
%vpi_call/w 3 3 "$display", "hello world" {0 0 0};
|
||||||
|
%vpi_call/w 3 4 "$finish" {0 0 0};
|
||||||
|
%end;
|
||||||
|
.thread T_0;
|
||||||
|
# The file index is used to find the file name in the following table.
|
||||||
|
:file_names 4;
|
||||||
|
"N/A";
|
||||||
|
"<interactive>";
|
||||||
|
"-";
|
||||||
|
"e:/Project/Digial-IDE/digital-ide/src/test/vlog/dependence_test/hello.v";
|
Loading…
x
Reference in New Issue
Block a user