test efinix finish

This commit is contained in:
Nitcloud 2025-03-09 22:01:00 +08:00
parent 559ad7ca5a
commit d98dd69d8f
10 changed files with 75 additions and 21 deletions

View File

@ -1278,9 +1278,9 @@
"chokidar": "^4.0.1", "chokidar": "^4.0.1",
"minimatch": "^10.0.1", "minimatch": "^10.0.1",
"pako": "^2.1.0", "pako": "^2.1.0",
"puppeteer-core": "^24.4.0", "puppeteer-core": "^19.4.1",
"showdown": "^2.1.0", "showdown": "^2.1.0",
"state-machine-cat": "^12.0.21", "state-machine-cat": "^9.2.5",
"tar": "^7.4.3", "tar": "^7.4.3",
"temp": "^0.9.4", "temp": "^0.9.4",
"vscode-jsonrpc": "^8.2.1", "vscode-jsonrpc": "^8.2.1",

View File

@ -198,7 +198,8 @@
"xc7a35tftg256-1", "xc7a35tftg256-1",
"xc7a35tcsg324-1", "xc7a35tcsg324-1",
"xc7z035ffg676-2", "xc7z035ffg676-2",
"xc7z020clg484-1" "xc7z020clg484-1",
"Ti60F100S3F2-C4"
] ]
} }
}, },

View File

@ -0,0 +1,7 @@
set_param general.maxThreads 8
create_project template d:/Project/FPGA/Design/TCL_project/Test/Efinity/prj/xilinx -part none -force
set_property SOURCE_SET sources_1 [get_filesets sim_1]
set_property top_lib xil_defaultlib [get_filesets sim_1]
update_compile_order -fileset sim_1 -quiet
source d:/Project/Code/.prj/Digital-IDE/resources/script/xilinx/refresh.tcl -quiet
file delete d:/Project/Code/.prj/Digital-IDE/resources/script/xilinx/launch.tcl -force

View File

@ -0,0 +1,17 @@
remove_files -quiet [get_files]
set xip_repo_paths {}
set_property ip_repo_paths $xip_repo_paths [current_project] -quiet
update_ip_catalog -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/async_fifo.v -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/DPRAM.v -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/ecc_decode.sv -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/ecc_encode.sv -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/ecc_pkg.sv -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/hbram/hbram_controller.v -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/hbram/hbram_ctrl.v -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/hbram/hyper_bus.v -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/hbram_test.v -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/spi_slave.v -quiet
add_file d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/src/test.v -quiet
add_files -fileset constrs_1 d:/Project/FPGA/Design/TCL_project/Test/Efinity/user/data -quiet
file delete d:/Project/Code/.prj/Digital-IDE/resources/script/xilinx/refresh.tcl -force

View File

@ -288,9 +288,15 @@ class ModuleTreeProvider implements vscode.TreeDataProvider<ModuleDataItem> {
public setFirstTop(type: keyof FirstTop, name: string, path: AbsPath | undefined) { public setFirstTop(type: keyof FirstTop, name: string, path: AbsPath | undefined) {
this.firstTop[type] = {name, path}; this.firstTop[type] = {name, path};
if (type == "src") {
opeParam.firstSrcTopModule.name = name;
opeParam.firstSrcTopModule.path = path;
} else if (type == "sim") {
opeParam.firstSimTopModule.name = name;
opeParam.firstSimTopModule.path = path;
}
} }
private makeFirstTopIconName(type: string): string { private makeFirstTopIconName(type: string): string {
return 'current-' + type + '-top'; return 'current-' + type + '-top';
} }

View File

@ -34,6 +34,7 @@ function validToolChainType(name: ToolChainType) {
const allTypes = [ const allTypes = [
'xilinx', 'xilinx',
'intel', 'intel',
'efinity',
'custom' 'custom'
]; ];
return allTypes.includes(name); return allTypes.includes(name);

View File

@ -22,7 +22,7 @@ const OpeParamDefaults = {
interface FirstTopModuleDesc { interface FirstTopModuleDesc {
name: string name: string
path: AbsPath path: AbsPath | undefined
}; };
function readJSON(path: AbsPath): object { function readJSON(path: AbsPath): object {

View File

@ -96,13 +96,25 @@ const security = ` <efx:security>
<efx:param name="auth_key_file" value="NONE" value_type="e_string"/> <efx:param name="auth_key_file" value="NONE" value_type="e_string"/>
</efx:security>`; </efx:security>`;
export interface ePLContext {
// 保留启动上下文
terminal? : vscode.Terminal,
// 目前使用的启动上下文
process?: ChildProcessWithoutNullStreams,
// 工具类型
tool? : string,
// 第三方工具运行路径
path? : string,
// 操作类
ope : EfinityOperation,
};
export class EfinityOperation { export class EfinityOperation {
script: string; script: string;
efxPath: string; efxPath: string;
constructor() { constructor() {
this.script = ''; this.script = '';
this.efxPath = hdlPath.join(opeParam.workspacePath, `${opeParam.prjInfo.prjName}.xml`); this.efxPath = hdlPath.join(opeParam.workspacePath, `${opeParam.prjInfo.prjName.PL}.xml`);
} }
private getDeviceInfo(device: string): string { private getDeviceInfo(device: string): string {
@ -120,12 +132,22 @@ export class EfinityOperation {
} }
private getDesignInfo(): string { private getDesignInfo(): string {
let designFile = ` <efx:top_module name="${opeParam.firstSrcTopModule.name}"/>\n`; let designFile = ` <efx:top_module name="${opeParam.firstSrcTopModule.name}"/>\n`;
for (const hdlFile of hdlParam.getAllHdlFiles()) { for (const hdlFile of hdlParam.getAllHdlFiles()) {
// ${hdlFile.path} switch (hdlFile.projectType) {
designFile += ` <efx:design_file name="${hdlFile.path}" version="default" library="default"/>\n`; case HdlFileProjectType.Src:
case HdlFileProjectType.LocalLib:
case HdlFileProjectType.RemoteLib:
case HdlFileProjectType.Sim:
designFile += ` <efx:design_file name="${hdlFile.path}" version="default" library="default"/>\n`;
break;
case HdlFileProjectType.IP:
case HdlFileProjectType.Primitive:
// IP 和 原语不用管
break;
default:
break;
}
} }
designFile += ` <efx:top_vhdl_arch name=""/>` designFile += ` <efx:top_vhdl_arch name=""/>`
return ` <efx:design_info def_veri_version="verilog_2k" def_vhdl_version="vhdl_2008">\n${designFile} return ` <efx:design_info def_veri_version="verilog_2k" def_vhdl_version="vhdl_2008">\n${designFile}
@ -136,25 +158,24 @@ export class EfinityOperation {
let constraintFile = ''; let constraintFile = '';
hdlFile.pickFileRecursive(opeParam.prjInfo.arch.hardware.data, filePath => { hdlFile.pickFileRecursive(opeParam.prjInfo.arch.hardware.data, filePath => {
if (filePath.endsWith('.sdc')) { if (filePath.endsWith('.sdc')) {
constraintFile += ` <efx:constraint_file name="${filePath}" />\n`; constraintFile += ` <efx:constraint_file name="${filePath}" />\n`;
} }
}); });
constraintFile += ` <efx:inter_file name="" />\n`; constraintFile += ` <efx:inter_file name="" />\n`;
return ` <efx:constraint_info>\n${constraintFile} </efx:constraint_info>`; return ` <efx:constraint_info>\n${constraintFile} </efx:constraint_info>`;
} }
public launch() { public launch() {
this.script = `<efx:project xmlns:efx="http://www.efinixinc.com/enf_proj" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="${opeParam.prjInfo.prjName}" description="" last_change="1724639062" sw_version="2023.2.307" last_run_state="pass" last_run_flow="bitstream" config_result_in_sync="sync" design_ood="sync" place_ood="sync" route_ood="sync" xsi:schemaLocation="http://www.efinixinc.com/enf_proj enf_proj.xsd">\n${this.getDeviceInfo}\n${this.getDesignInfo}\n${this.getConstraintInfo}\n <efx:sim_info />\n <efx:misc_info />\n <efx:ip_info />\n${syn}\n${pnr}\n${bit}\n${debug}\n${security}\n</efx:project>`; this.script = `<efx:project xmlns:efx="http://www.efinixinc.com/enf_proj" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="${opeParam.prjInfo.prjName}" description="" last_change="1724639062" sw_version="2023.2.307" last_run_state="pass" last_run_flow="bitstream" config_result_in_sync="sync" design_ood="sync" place_ood="sync" route_ood="sync" xsi:schemaLocation="http://www.efinixinc.com/enf_proj enf_proj.xsd">\n${this.getDeviceInfo(opeParam.prjInfo.device)}\n${this.getDesignInfo()}\n${this.getConstraintInfo()}\n <efx:sim_info />\n <efx:misc_info />\n <efx:ip_info />\n${syn}\n${pnr}\n${bit}\n${debug}\n${security}\n</efx:project>`;
fs.writeFileSync(this.efxPath, this.script); fs.writeFileSync(this.efxPath, this.script);
} }
public build() { public build() {
const efxPath = hdlPath.join(opeParam.workspacePath, `${opeParam.prjInfo.prjName}.xml`); exec(`${this.updateEfinixPath()} ${this.efxPath} --flow compile --work_dir=${opeParam.workspacePath}/prj/efinix --output_dir ${opeParam.workspacePath}/prj/efinix/outflow --cleanup_work_dir work_pt`, (error, stdout, stderr) => {
exec(`${this.updateEfinixPath()} ${efxPath} --flow compile --work_dir=${opeParam.workspacePath}/prj/efinix --output_dir ${opeParam.workspacePath}/prj/efinix/outflow --cleanup_work_dir work_pt`, (error, stdout, stderr) => {
console.log(error); console.log(error);
}) })

View File

@ -16,6 +16,7 @@ import { PropertySchema } from '../../global/propertySchema';
import { HardwareOutput, MainOutput, ReportType } from '../../global/outputChannel'; import { HardwareOutput, MainOutput, ReportType } from '../../global/outputChannel';
import { AbsPath } from '../../global'; import { AbsPath } from '../../global';
import { t } from '../../i18n'; import { t } from '../../i18n';
import { EfinityOperation } from './efinity';
class PlManage extends BaseManage { class PlManage extends BaseManage {
context: PLContext; context: PLContext;
@ -24,7 +25,7 @@ class PlManage extends BaseManage {
super(); super();
this.context = { this.context = {
tool: opeParam.prjInfo.toolChain || 'xilinx', tool: opeParam.prjInfo.toolChain,
path: '', path: '',
ope: new XilinxOperation(), ope: new XilinxOperation(),
terminal: undefined, terminal: undefined,
@ -34,7 +35,10 @@ class PlManage extends BaseManage {
const curToolChain = this.context.tool; const curToolChain = this.context.tool;
if (curToolChain === ToolChainType.Xilinx) { if (curToolChain === ToolChainType.Xilinx) {
this.context.path = this.context.ope.updateVivadoPath(); this.context.path = this.context.ope.updateVivadoPath();
} } else if (curToolChain === ToolChainType.Efinity) {
this.context.ope = new EfinityOperation();
this.context.path = this.context.ope.updateEfinixPath();
}
} }
public launch() { public launch() {

View File

@ -36,7 +36,7 @@ interface PLContext {
// 第三方工具运行路径 // 第三方工具运行路径
path? : string, path? : string,
// 操作类 // 操作类
ope : XilinxOperation, ope : Record<string, any>
}; };
interface PLPrjInfo { interface PLPrjInfo {
@ -54,7 +54,6 @@ interface BootInfo {
fsblPath : AbsPath fsblPath : AbsPath
}; };
/** /**
* xilinx operation under PL * xilinx operation under PL
*/ */
@ -394,7 +393,6 @@ class XilinxOperation {
}); });
// 导入非本地的设计源文件 // 导入非本地的设计源文件
console.log(hdlParam.getAllHdlFiles());
for (const hdlFile of hdlParam.getAllHdlFiles()) { for (const hdlFile of hdlParam.getAllHdlFiles()) {
switch (hdlFile.projectType) { switch (hdlFile.projectType) {
case HdlFileProjectType.Src: case HdlFileProjectType.Src:
@ -620,7 +618,6 @@ file delete ${scriptPath} -force\n`;
context.process?.stdin.write(cmd + '\n'); context.process?.stdin.write(cmd + '\n');
} }
generateBit(context: PLContext) { generateBit(context: PLContext) {
vscode.window.showInformationMessage( vscode.window.showInformationMessage(
"Xilinx: BitStream", "Xilinx: BitStream",