diff --git a/resources/script/xilinx/program.tcl b/resources/script/xilinx/program.tcl deleted file mode 100644 index b2174e7..0000000 --- a/resources/script/xilinx/program.tcl +++ /dev/null @@ -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 diff --git a/resources/script/xilinx/simulate.tcl b/resources/script/xilinx/simulate.tcl deleted file mode 100644 index 5556bcb..0000000 --- a/resources/script/xilinx/simulate.tcl +++ /dev/null @@ -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 diff --git a/src/function/dide-netlist/worker.ts b/src/function/dide-netlist/worker.ts index 90c6ddf..9a439fd 100644 --- a/src/function/dide-netlist/worker.ts +++ b/src/function/dide-netlist/worker.ts @@ -311,6 +311,7 @@ class Netlist { wasi_snapshot_preview1: wasi.wasiImport }); + try { const exitCode = wasi.start(instance); } catch (error) { diff --git a/src/manager/prj.ts b/src/manager/prj.ts index 52aefa7..add1ba9 100644 --- a/src/manager/prj.ts +++ b/src/manager/prj.ts @@ -342,18 +342,55 @@ class PrjManage { continue; } + const sourcePath = hdlPath.join(workspace, file); + + // 排除非 hdl 文件 + if (hdlFile.isFile(sourcePath) && !hdlFile.isHDLFile(sourcePath)) { + continue; + } + if (file.startsWith(plname)) { const targetFolder = hdlPath.join(workspace, 'prj', 'xilinx'); - const sourcePath = hdlPath.join(workspace, file); hdlFile.move(sourcePath, targetFolder); } else { const targetFolder = hdlPath.join(workspace, 'user', 'src'); - const sourcePath = hdlPath.join(workspace, file); + 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 * @@ -481,11 +518,15 @@ class PrjManage { // 创建标准项目结构基本文件夹 // xilinx prj hdlDir.mkdir(hdlPath.join(workspacePath, 'prj', 'xilinx')); + // hardware hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'src')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sim')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'data')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'ip')); + + hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'bd')); + // software hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk')); hdlDir.mkdir(hdlPath.join(workspacePath, 'user', 'sdk', 'data')); @@ -498,6 +539,10 @@ class PrjManage { transformIP('sources_', workspacePath, plname); transformIP('sim_', workspacePath, plname); + // 迁移 BD + transformBD('sources_', workspacePath, plname); + transformBD('sim_', workspacePath, plname); + // 迁移文件夹 ${workspace}/${plname}.srcs transformXilinxPL('src', 'sources_', workspacePath, plname); transformXilinxPL('sim', 'sim_', workspacePath, plname);