From 7d28e35e107e7c1fef9dc374a8374f3321ab2da7 Mon Sep 17 00:00:00 2001 From: Tobias Knopp Date: Fri, 6 Dec 2024 19:45:49 +0100 Subject: [PATCH] update bd --- src/fpga/bd/hbridgewaveform.tcl | 96 +++++++++++++++++---------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/src/fpga/bd/hbridgewaveform.tcl b/src/fpga/bd/hbridgewaveform.tcl index d2f98ab8..5e6adbc8 100644 --- a/src/fpga/bd/hbridgewaveform.tcl +++ b/src/fpga/bd/hbridgewaveform.tcl @@ -58,68 +58,70 @@ if { $list_projs eq "" } { variable design_name set design_name hbridgewaveform -# This script was generated for a remote BD. To create a non-remote design, -# change the variable to <0>. - -set run_remote_bd_flow 1 -if { $run_remote_bd_flow == 1 } { - # Set the reference directory for source file relative paths (by default - # the value is script directory path) - set origin_dir ./.julia/dev/RedPitayaDAQServer/src/fpga/bd - - # Use origin directory path location variable, if specified in the tcl shell - if { [info exists ::origin_dir_loc] } { - set origin_dir $::origin_dir_loc - } +# If you do not already have an existing IP Integrator design open, +# you can create a design using the following command: +# create_bd_design $design_name - set str_bd_folder [file normalize ${origin_dir}] - set str_bd_filepath ${str_bd_folder}/${design_name}/${design_name}.bd +# Creating design if needed +set errMsg "" +set nRet 0 - # Check if remote design exists on disk - if { [file exists $str_bd_filepath ] == 1 } { - catch {common::send_gid_msg -ssname BD::TCL -id 2030 -severity "ERROR" "The remote BD file path <$str_bd_filepath> already exists!"} - common::send_gid_msg -ssname BD::TCL -id 2031 -severity "INFO" "To create a non-remote BD, change the variable to <0>." - common::send_gid_msg -ssname BD::TCL -id 2032 -severity "INFO" "Also make sure there is no design <$design_name> existing in your current project." +set cur_design [current_bd_design -quiet] +set list_cells [get_bd_cells -quiet] - return 1 - } +if { ${design_name} eq "" } { + # USE CASES: + # 1) Design_name not set - # Check if design exists in memory - set list_existing_designs [get_bd_designs -quiet $design_name] - if { $list_existing_designs ne "" } { - catch {common::send_gid_msg -ssname BD::TCL -id 2033 -severity "ERROR" "The design <$design_name> already exists in this project! Will not create the remote BD <$design_name> at the folder <$str_bd_folder>."} + set errMsg "Please set the variable to a non-empty value." + set nRet 1 - common::send_gid_msg -ssname BD::TCL -id 2034 -severity "INFO" "To create a non-remote BD, change the variable to <0> or please set a different value to variable ." +} elseif { ${cur_design} ne "" && ${list_cells} eq "" } { + # USE CASES: + # 2): Current design opened AND is empty AND names same. + # 3): Current design opened AND is empty AND names diff; design_name NOT in project. + # 4): Current design opened AND is empty AND names diff; design_name exists in project. - return 1 - } + if { $cur_design ne $design_name } { + common::send_gid_msg -ssname BD::TCL -id 2001 -severity "INFO" "Changing value of from <$design_name> to <$cur_design> since current design is empty." + set design_name [get_property NAME $cur_design] + } + common::send_gid_msg -ssname BD::TCL -id 2002 -severity "INFO" "Constructing design in IPI design <$cur_design>..." - # Check if design exists on disk within project - set list_existing_designs [get_files -quiet */${design_name}.bd] - if { $list_existing_designs ne "" } { - catch {common::send_gid_msg -ssname BD::TCL -id 2035 -severity "ERROR" "The design <$design_name> already exists in this project at location: - $list_existing_designs"} - catch {common::send_gid_msg -ssname BD::TCL -id 2036 -severity "ERROR" "Will not create the remote BD <$design_name> at the folder <$str_bd_folder>."} +} elseif { ${cur_design} ne "" && $list_cells ne "" && $cur_design eq $design_name } { + # USE CASES: + # 5) Current design opened AND has components AND same names. - common::send_gid_msg -ssname BD::TCL -id 2037 -severity "INFO" "To create a non-remote BD, change the variable to <0> or please set a different value to variable ." + set errMsg "Design <$design_name> already exists in your project, please set the variable to another value." + set nRet 1 +} elseif { [get_files -quiet ${design_name}.bd] ne "" } { + # USE CASES: + # 6) Current opened design, has components, but diff names, design_name exists in project. + # 7) No opened design, design_name exists in project. - return 1 - } + set errMsg "Design <$design_name> already exists in your project, please set the variable to another value." + set nRet 2 - # Now can create the remote BD - # NOTE - usage of <-dir> will create <$str_bd_folder/$design_name/$design_name.bd> - create_bd_design -dir $str_bd_folder $design_name } else { + # USE CASES: + # 8) No opened design, design_name not in project. + # 9) Current opened design, has components, but diff names, design_name not in project. - # Create regular design - if { [catch {create_bd_design $design_name} errmsg] } { - common::send_gid_msg -ssname BD::TCL -id 2038 -severity "INFO" "Please set a different value to variable ." + common::send_gid_msg -ssname BD::TCL -id 2003 -severity "INFO" "Currently there is no design <$design_name> in project, so creating one..." + + create_bd_design $design_name + + common::send_gid_msg -ssname BD::TCL -id 2004 -severity "INFO" "Making design <$design_name> as current_bd_design." + current_bd_design $design_name - return 1 - } } -current_bd_design $design_name +common::send_gid_msg -ssname BD::TCL -id 2005 -severity "INFO" "Currently the variable is equal to \"$design_name\"." + +if { $nRet != 0 } { + catch {common::send_gid_msg -ssname BD::TCL -id 2006 -severity "ERROR" $errMsg} + return $nRet +} set bCheckIPsPassed 1 ##################################################################