This commit is contained in:
锦恢 2025-01-10 21:08:06 +08:00
parent 2886673c94
commit 27db47c467
4 changed files with 48 additions and 47 deletions

View File

@ -1,27 +0,0 @@
open_hw -quiet
connect_hw_server -quiet
set found 0
foreach hw_target [get_hw_targets] {
current_hw_target $hw_target
open_hw_target -quiet
foreach hw_device [get_hw_devices] {
if { [string equal -length 6 [get_property PART $hw_device] xc7z020clg400-2] == 1 } {
puts "------Successfully Found Hardware Target with a xc7z020clg400-2 device------ "
current_hw_device $hw_device
set found 1
}
}
if {$found == 1} {break}
close_hw_target
}
#download the hw_targets
if {$found == 0 } {
puts "******ERROR : Did not find any Hardware Target with a xc7z020clg400-2 device****** "
} else {
set_property PROGRAM.FILE ./[current_project].bit [current_hw_device]
program_hw_devices [current_hw_device] -quiet
disconnect_hw_server -quiet
}
file delete /home/dide/project/Digital-IDE/resources/script/xilinx/program.tcl -force

View File

@ -1,18 +0,0 @@
if {[current_sim] != ""} {
relaunch_sim -quiet
} else {
launch_simulation -quiet
}
set curr_wave [current_wave_config]
if { [string length $curr_wave] == 0 } {
if { [llength [get_objects]] > 0} {
add_wave /
set_property needs_save false [current_wave_config]
} else {
send_msg_id Add_Wave-1 WARNING "No top level signals found. Simulator will start without a wave window. If you want to open a wave window go to 'File->New Waveform Configuration' or type 'create_wave_config' in the TCL console."
}
}
run 1us
file delete c:/Users/11934/Project/Digital-IDE/digital-ide/resources/script/xilinx/simulate.tcl -force

View File

@ -311,6 +311,7 @@ class Netlist {
wasi_snapshot_preview1: wasi.wasiImport wasi_snapshot_preview1: wasi.wasiImport
}); });
try { try {
const exitCode = wasi.start(instance); const exitCode = wasi.start(instance);
} catch (error) { } catch (error) {

View File

@ -342,18 +342,55 @@ class PrjManage {
continue; continue;
} }
const sourcePath = hdlPath.join(workspace, file);
// 排除非 hdl 文件
if (hdlFile.isFile(sourcePath) && !hdlFile.isHDLFile(sourcePath)) {
continue;
}
if (file.startsWith(plname)) { if (file.startsWith(plname)) {
const targetFolder = hdlPath.join(workspace, 'prj', 'xilinx'); const targetFolder = hdlPath.join(workspace, 'prj', 'xilinx');
const sourcePath = hdlPath.join(workspace, file);
hdlFile.move(sourcePath, targetFolder); hdlFile.move(sourcePath, targetFolder);
} else { } else {
const targetFolder = hdlPath.join(workspace, 'user', 'src'); const targetFolder = hdlPath.join(workspace, 'user', 'src');
const sourcePath = hdlPath.join(workspace, file);
hdlFile.move(sourcePath, targetFolder); hdlFile.move(sourcePath, targetFolder);
} }
} }
} }
/**
* @description Xilinx BD
*
* bd ${workspace}/${plname}.srcs/sources_xxx/bd
*/
function transformBD(
matchPrefix: string,
workspace: string,
plname: string
) {
const xilinxSrcsPath = hdlPath.join(workspace, plname + '.srcs');
const standardBdPath = hdlPath.join(workspace, 'user', 'bd');
if (!fs.existsSync(xilinxSrcsPath)) {
return;
}
const sourceNames = fs.readdirSync(xilinxSrcsPath).filter(filename => filename.startsWith(matchPrefix));
for (const sn of sourceNames) {
const bdPath = hdlPath.join(xilinxSrcsPath, sn, 'bd');
if (!hdlFile.isDir(bdPath)) {
continue;
}
for (const bdname of fs.readdirSync(bdPath)) {
const sourcePath = hdlPath.join(bdPath, bdname);
hdlDir.mvdir(sourcePath, standardBdPath, true);
}
hdlDir.rmdir(bdPath);
}
}
/** /**
* @description Xilinx IP * @description Xilinx IP
* *
@ -481,11 +518,15 @@ class PrjManage {
// 创建标准项目结构基本文件夹 // 创建标准项目结构基本文件夹
// xilinx prj // xilinx prj
hdlDir.mkdir(hdlPath.join(workspacePath, 'prj', 'xilinx')); hdlDir.mkdir(hdlPath.join(workspacePath, 'prj', 'xilinx'));
// hardware // hardware
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'src')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'src'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sim')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sim'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'data')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'data'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'ip')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'ip'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'bd'));
// software // software
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk'));
hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk', 'data')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk', 'data'));
@ -498,6 +539,10 @@ class PrjManage {
transformIP('sources_', workspacePath, plname); transformIP('sources_', workspacePath, plname);
transformIP('sim_', workspacePath, plname); transformIP('sim_', workspacePath, plname);
// 迁移 BD
transformBD('sources_', workspacePath, plname);
transformBD('sim_', workspacePath, plname);
// 迁移文件夹 ${workspace}/${plname}.srcs // 迁移文件夹 ${workspace}/${plname}.srcs
transformXilinxPL('src', 'sources_', workspacePath, plname); transformXilinxPL('src', 'sources_', workspacePath, plname);
transformXilinxPL('sim', 'sim_', workspacePath, plname); transformXilinxPL('sim', 'sim_', workspacePath, plname);