<?xml version="1.0" encoding="UTF-8"?>
<!-- 
 /*******************************************************************************
 * Copyright (c) 2014 Elphel, Inc.
 * This file is a part of VDT plug-in.
 * VDT plug-in is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VDT plug-in is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *  Additional permission under GNU GPL version 3 section 7:
 * If you modify this Program, or any covered work, by linking or combining it
 * with Eclipse or Eclipse plugins (or a modified version of those libraries),
 * containing parts covered by the terms of EPL/CPL, the licensors of this
 * Program grant you additional permission to convey the resulting work.
 * {Corresponding Source for a non-source form of such a combination shall
 * include the source code for the parts of Eclipse or Eclipse plugins used
 * as well as that of the covered work.}
 *******************************************************************************/
 -->
<vdt-project>
	<interface name="VivadoReportTimingSummaryInterface" extends="VivadoInterface">
	    <typedef name = "Cardinal_0_3">
            <paramtype kind="number" lo="0" hi="3" format="%d" />
        </typedef>
	
	    <typedef name="DelayTypeType">
      		<paramtype kind= "enum" base="String">
      			<item value="min"     label="Analyse minimal times"/>
      			<item value="max"     label="Analyze maximal times"/>
      			<item value="min_max" label="Analyze both minimal and maximal times"/>
      		</paramtype>
    	</typedef>
	    <typedef name="PathTypeType">
      		<paramtype kind= "enum" base="String">
      			<item value="end"                 label="Shows the endpoint of the path only, with calculated timing values."/>
      			<item value="summary"             label="Displays the startpoints and endpoints with slack calculation."/>
      			<item value="short"               label="Displays the startpoints and endpoints with calculated timing values."/>
      			<item value="full"                label="Displays the full timing path, including startpoints, through points, and endpoints."/>
      			<item value="full_clock"          label="Displays full clock paths in addition to the full timing path."/>
      			<item value="full_clock_expanded" label=" Displays full clock paths between a master clock and generated clocks in addition to the full_clock timing path."/>
      		</paramtype>
    	</typedef>
	
	</interface>

	<tool name="VivadoReportTimingSummary" label="Report Timimg Summary"
	    project="FPGA_project"
		interface="VivadoReportTimingSummaryInterface"
		package="FPGA_package"
		shell="/bin/bash"
		description="Report timing summary"
		log-dir="VivadoLogDir"
		state-dir="VivadoLocalDir"
		disable="DisableVivadoTimingSummary"
		abstract="true"
		inherits="VivadoToolPrototype"
		priority="0.4"
		>
		<action-menu>
			<action label="Report timing summary" resource="" icon="clock_sum.png" />
		</action-menu>
		
		<parameter id="DisableVivadoTimingSummary" label="Disable" tooltip="Disable timing report"
		           default="false" type= "Boolean" format="None"/>

		<parameter id="SkipTCL" label="Skip TCL commands" tooltip="Do not run pre-timing summary TCL commands"
		           default="false" type= "Boolean" format="None"/>
		
<!-- 		
		<parameter id="SkipTCL" label="Skip TCL commands" tooltip="Do not run pre-timing summary TCL commands"
		           default="false" type= "Boolean" format="None"/>
-->                   
		<parameter id="PreTCL" label="Pre timing summary TCL commands" tooltip="TCL commands to run before timing summary"
			type="Stringlist" format="ProgramSyntax" default="" omit=""
			readonly="false" visible="true" />
  
<!-- report_timing_summary arguments -->
        <parameter 	id="check_timing_verbose" label="Verbose summary" tooltip= "Output a verbose timing summary report."
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter	id="delay_type" label="Delay type" tooltip= "Delay types to analyze."
        			default="min_max" visible="true" omit="min_max" type="DelayTypeType" format="Dash"/>
        <parameter 	id="no_detailed_paths" label="No detailed paths"
                    tooltip= "Do not report the full timing path for each clock or path group analyzed."
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter 	id="setup" label="Check for setup violations" tooltip= "Same as -delay_type max."
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter 	id="hold" label="Check for hold violations" tooltip= "Same as -delay_type min."
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter	id="max_paths"  label="Number of paths per group"
                    tooltip= "Maximal number of paths to report per group."
        			default="1"  visible="true" omit="1" type="Cardinal_1" format="Dash"/>
        <parameter	id="nworst" label="Number of paths" tooltip= "Maximal number of paths per endpoint."
        			default="1"  visible="true" omit="1" type="Cardinal_1" format="Dash"/>
        <parameter 	id="unique_pins" label="One path per unique set"
                    tooltip= "Only report timing paths through each unique set of pins,  reporting one path per path group."
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter	id="path_type" label="Path type" tooltip= " Specify the path data to output in the timing summary report."
        			default="full_clock_expanded" visible="true" omit="full_clock_expanded" type="PathTypeType" format="Dash"/>
        <parameter 	id="slack_lesser_than" label="Slack lesser than"
                    tooltip= " Report timing on paths with a calculated slack value less than the specified value."
        			default="" visible="true" omit="" type="String" format="Dash"/>
        <parameter 	id="slack_greater_than" label="Slack greater than"
                    tooltip= " Report timing on paths with a calculated slack value greater than the specified value."
        			default="" visible="true" omit="" type="String" format="Dash"/>
        <parameter 	id="report_unconstrained" label="Report unconstrained paths"
                    tooltip= "Report timing on unconstrained paths in the design."
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter	id="significant_digits" label="Number of digits" tooltip= "Number of significat digits ion the output."
        			default="3"  visible="true" omit="3" type="Cardinal_0_3" format="Dash"/>
        <parameter 	id="no_header" label="No header" tooltip= "Do not add header information to the report."
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter 	id="rawfile" label="Result filename" tooltip= "Write report to the specified file."
        			default="%%ProjectName.timing_summary" visible="true" omit="" type="String" format="CopyValue"/>
        <parameter 	id="append" label="Append to file" tooltip= "Append to the output file."
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter 	id="return_string" label="Return string" tooltip= "Write result to TCL to be captured into variable."
        			default="" visible="true" omit="" type="String" format="Dash"/>
        <parameter 	id="datasheet" label="Datasheet info" tooltip= "Generate datasheet information for the report."
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter	id="quiet" outid="quiet" label="Quiet" tooltip= "Ignore errors, return TCL_OK in any case"
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>
        <parameter	id="verbose" outid="verbose" label="Verbose" tooltip= "Temporarily override message limits set with set_msg_config"
        			default="false" visible="true" omit="false" type="Boolean" format="DashName"/>

<!-- parser parameters - will have different values than the base tool -->
        <parameter id="parsers_path"/>
        <parameter id="parser_name"/>
        <parameter id="PatternErrors"/>
        <parameter id="PatternWarnings"/>
        <parameter id="PatternInfo"/>
        <parameter id="InstanceCapture"/>
        <parameter id="InstanceSeparator"/>
        <parameter id="InstanceSuffix"/>
        <parameter id="parser_mode"/>
        <parameter id="NoFileProblem"/>
        <parameter id="Drc"/>
        <parameter id="Vivado_Tcl"/>
        <parameter id="Route"/>
        <parameter id="Memdata"/>
        <parameter id="Synth"/>
        <parameter id="Netlist"/>
        <parameter id="Opt"/>
        <parameter id="Project"/>
        <parameter id="Timing"/>
        <parameter id="Pwropt"/>
        <parameter id="OtherProblems"/>
        <parameter id="ShowWarnings"/>
        <parameter id="ShowInfo"/>
        <parameter id="PreGrepW"/>
        <parameter id="PreGrepI"/>
        <parameter id="GrepEWI"/>
        <parameter id="MaxMsg"/>
        
		<!-- Invisible (calculated) parameters -->
		<!--  same value as %file, but will appear withou "-file" prefix --> 
        <parameter 	id="file" default="%VivadoRemoteDir/%rawfile" visible="false" omit="" type="String" format="Dash"/>
			
		<input>
			<group name="General">
			    "DisableVivadoTimingSummary"
				"SkipTCL"
			</group>
			<group name="TCL commands">
		        "PreTCL"
			</group>
			<group name="Timing Summary">
				"check_timing_verbose"
				"delay_type"
				"no_detailed_paths"
				"setup"
				"hold"
				"max_paths"
				"nworst"
				"unique_pins"
				"path_type"
				"slack_lesser_than"
				"slack_greater_than"
				"report_unconstrained"
				"significant_digits"
				"no_header"
				"rawfile"
				"append"
				"return_string"
				"datasheet"
       			"---"
				"quiet"
				"verbose"
			</group>
		</input>
		<output>
			<line name="vivado_run_timing_summary"
			      dest="VivadoConsole"
			      mark="``" 
			      sep=" "
			      prompt="@@FINISH@@"
			      failure="ERROR"
			      log=""
			      stdout="parser_Vivado">
			    "cd ~/%VivadoProjectRoot\n"
			    "set outputDir ~/%VivadoProjectRoot/%VivadoRemoteDir\n"			      
			    "file mkdir $outputDir\n"
		        <!-- Run pre-bitstream TCL commands (if specified) -->
			    <if SkipTCL="false">
				      <if-not PreTCL="">
				      		"%PreTCL\n"
				      </if-not>
				      <if PreTCL="">
				      		"puts \"No TCL commands specified\"\n"'
				      </if>
			    </if>
			    <!-- Run routing -->
			    "report_timing_summary "
			    "%check_timing_verbose"
				"%delay_type"
				"%no_detailed_paths"
				"%setup"
				"%hold"
				"%max_paths"
				"%nworst"
				"%unique_pins"
				"%path_type"
				"%slack_lesser_than"
				"%slack_greater_than"
				"%report_unconstrained"
				"%significant_digits"
				"%no_header"
				"%file"
				"%append"
				"%return_string"
				"%datasheet"
				"%quiet"
				"%verbose"
				"\n"
				"puts \"@@FINISH@@\"\n"
			</line>
			<line name="vivado_copy_after_timing_summary">
				"-c"
				"mkdir -p %VivadoLocalResultDir ;"
				"rsync -avr -e ssh"
				"%RemoteUser@%RemoteHost:%VivadoProjectRoot/%VivadoRemoteDir/%rawfile"
				"%VivadoLocalResultDir/"
			</line>
		</output>
	</tool>
</vdt-project>