Commit 751b73cf authored by Mikhail Karpenko's avatar Mikhail Karpenko
Browse files

Add Quartus bitstream generator interface

parent 6d29066b
Loading
Loading
Loading
Loading
+155 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!-- 
 /*******************************************************************************
 * Copyright (c) 2015 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="QuartusAssemblerInterface" extends="QuartusInterface">
	</interface>

	<tool name="QuartusAssembler" label="Generate a device programming image"
	    project="FPGA_project"
		interface="QuartusAssemblerInterface"
		package="FPGA_package"
		shell="/bin/bash"
		ignore="%QuartusIgnoreSource"
		description="Quartus assembler generates a device programming image"
		log-dir="QuartusLogDir"
		inherits="QuartusToolPrototype"
		disable="DisableTool"
		>

		<depends-list>
			<depends state="QuartusSnapshotPlace"/>
		</depends-list>
		<action-menu>
			<action label="Generate bitstream" resourse="" icon="bitstream.png"/>
		</action-menu>

		<!-- Interfce parameters -->	
		<parameter id="DisableTool" label="Disable autorun" tooltip="Disable automatic launch of this tool"
			type="Boolean" default="false" visible="true" readonly="false" format="None"/>
		<parameter id="BitfileName" label="Bitstream file name" tooltip="Bitstream file name (will have 'sof' extension)"
			type="String" default="%%ProjectName" visible="true" readonly="false" format="CopyValue"/>
		<parameter id="CreatePof" label="Create .pof" tooltip="Create Programming Object File (.pof)"
			type="Boolean" default="false" visible="true" readonly="false" format="None"/>
		<parameter id="ConfigDevice" label="Configuration device" tooltip="Specify Altera configuration device"
			type="String" default="EPCS128" visible="true" readonly="false" format="CopyValue"/>
		<parameter id="CreateHex" label="Create .hexout" tooltip="Create Hexadecimal (Intel format) Output File (.hexout)"
			type="Boolean" default="false" visible="true" readonly="false" format="None"/>

		<input>
			<group name="General">
				"DisableTool"
				"BitfileName"
				"CreatePof"
				"ConfigDevice"
				"CreateHex"
			</group>
		</input>

		<output>
			<!-- Start assembler -->
			<line name="quartus_run_asm"
			      dest="QuartusConsole"
			      mark="``" 
			      sep="\n"
				  prompt="@@FINISH@@"
				  success="@@FINISH@@"
				  log=""
				  stdout="parser_Quartus">
				"cd ~/%QuartusProjectRoot"
				"set projectName %%ProjectName"
			    "set outputDir ~/%QuartusProjectRoot/%QuartusRemoteDir"
				"file mkdir $outputDir"
				"load_package flow"
				<!-- Reopen project if it was closed somehow -->
				"if [is_project_open] {"
				"puts \"Project is open, starting assembler\""
				"} else {"
				"project_open $projectName"
				"}"
				"if {[catch {execute_module -tool asm} result]} {"
				"puts \"Result: $result\""
				"puts \"Error: Assembler faild. See the report file.\""
				"} else {"
				"puts \"Info: Assembly was successful.\""
				"}"
				<!-- Convert generated sof to pof -->
				<if CreatePof="true">
					<if-not ConfigDevice="">
						"set sof_file %BitfileName.sof"
						"set pof_file %BitfileName.pof"
						"set device_name %ConfigDevice"
						"if {[catch {execute_module -tool cpf -args \"-c -d $device_name $sof_file $pof_file\"} result]} {"
						"puts \"Result: $result\""
						"puts \"Error: Programming files converter faild. See the report file.\""
						"} else {"
						"puts \"Info: File convertion was successful.\""
						"}"
					</if-not>
					<if configDevice="">
						"puts \"Error: configuration device is not specified, Programmer Object File is not created \""
					</if>
				</if>
				<!-- Convert generated sof to hex -->
				<if CreatePof="true">
					"set sof_file %BitfileName.sof"
					"set hex_file %BitfileName.hexout"
					"if {[catch {execute_module -tool cpf -args \"-c $sof_file $hex_file\"} result]} {"
					"puts \"Result: $result\""
					"puts \"Error: Programming files converter faild. See the report file.\""
					"} else {"
					"puts \"Info: File convertion was successful.\""
					"}"
				</if>
				"puts \"@@FINISH@@\""
			</line>
			<line name="quartus_copy_bitstream">
				"-c"
				"mkdir -p %QuartusLocalResultDir;"
				"rsync -avr -e ssh"
				"%RemoteUser@%RemoteHost:%QuartusProjectRoot/%BitfileName.sof"
				"%QuartusLocalResultDir/;"
				<!-- Copy pof if it was created -->
				<if CreatePof="true">
					<if-not ConfigDevice="">
						"rsync -avr -e ssh"
						"%RemoteUser@%RemoteHost:%QuartusProjectRoot/%BitfileName.pof"
						"%QuartusLocalResultDir/;"
					</if-not>
				</if>
				<!-- Copy hex if it was created -->
				<if CreateHex="true">
					"rsync -avr -e ssh"
					"%RemoteUser@%RemoteHost:%QuartusProjectRoot/%BitfileName.hexout"
					"%QuartusLocalResultDir/;"
				</if>
			</line>
		</output>
	</tool>
	
</vdt-project>
+6 −3
Original line number Diff line number Diff line
@@ -81,6 +81,9 @@ register cascade chains, or that can be converted to register cascade chains"/>
		<depends-list>
			<depends state="QuartusSnapshotSynth"/>
		</depends-list>
		<action-menu>
			<action label="Place and route design" resourse="" icon="route66.png"/>
		</action-menu>

		<!-- Interfce parameters -->	
		<parameter id="AutosaveQuartusPlace" label="Create snapshot" tooltip="Automaticaly create snapshot after fitter"
@@ -174,7 +177,7 @@ timing information"
				"\"\n"
			</line>
			<!-- Start fitter -->
			<line name="quartus_run_synth"
			<line name="quartus_run_pace_and_route"
			      dest="QuartusConsole"
			      mark="``" 
			      sep="\n"
@@ -195,9 +198,9 @@ timing information"
				"}"
				"if {[catch {execute_module -tool fit -args $par_args} result]} {"
				"puts \"Result: $result\""
				"puts \"ERROR: Place and route faild. See the report file.\""
				"puts \"Error: Place and route faild. See the report file.\""
				"} else {"
				"puts \"INFO: Place and route was successful.\""
				"puts \"Info: Place and route was successful.\""
				"}"
				"puts \"@@FINISH@@\""
			</line>
+3 −2
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ may decrease as fast-synthesis netlists take longer to route."/>
			<depends files="FilteredSourceListPar"/>
			<depends files="FilteredIncludesListPar"/>			
			<depends files="ConstraintsFiles"/>
			<depends files="PinAssignment"/>
		</depends-list>
		<action-menu>
			<action label="Synthesise with Quartus" resourse="%ImplementationTopFile"
@@ -275,9 +276,9 @@ semantec errors, and perform a netlist exraction."
				<!-- Start synthesizer -->
				"if {[catch {execute_module -tool map -args $synth_args} result]} {"
				"puts \"Result: $result\""
				"puts \"ERROR: Analysis and Synthesis faild. See the report file.\""
				"puts \"Error: Analysis and Synthesis faild. See the report file.\""
				"} else {"
				"puts \"INFO: Analysis and Synthesis was successful.\""
				"puts \"Info: Analysis and Synthesis was successful.\""
				"}"
				"puts \"@@FINISH@@\""
			</line>
+14 −4
Original line number Diff line number Diff line
@@ -57,12 +57,19 @@
		log-dir="QuartusLogDir"
		state-dir="QuartusLocalDir"
		inherits="QuartusToolPrototype"
		disable="DisableTool"
		>

		<depends-list>
			<depends state="QuartusSnapshotPlace"/>
		</depends-list>
		<action-menu>
			<action label="Run timing analizer" resourse="" icon="clock.png"/>
		</action-menu>

		<!-- General parameters-->
		<parameter id="DisableTool" label="Disable autorun" tooltip="Disable automatic launch of this tool"
			type="Boolean" default="false" visible="true" readonly="false" format="None"/>
		<!-- Command line parameters -->
		<parameter id="lower_priority" label="Lower priority" tooltip="Option to lower priority of the current process."
			type="Boolean" default="false" visible="true" readonly="false" omit="false" format="DoubleDashName"/>
@@ -118,6 +125,9 @@ the TimeQuest Timing Analyzer"
			type="Cardinal" default="" visible="true" readonly="false" omit="" format="DoubleDashName"/>

		<input>
			<group name="General">
				"DisableTool"
			</group>
			<group name="Timing analizer">
				"lower_priority"
				"parallel"
@@ -154,8 +164,8 @@ the TimeQuest Timing Analyzer"
				"%voltage"
				"\""
			</line>
			<!-- Start fitter -->
			<line name="quartus_run_synth"
			<!-- Start timing analyze r-->
			<line name="quartus_run_timing_analyser"
			      dest="QuartusConsole"
			      mark="``" 
			      sep="\n"
@@ -176,9 +186,9 @@ the TimeQuest Timing Analyzer"
				"}"
				"if {[catch {execute_module -tool sta -args $sta_args} result]} {"
				"puts \"Result: $result\""
				"puts \"ERROR: Timing analizer faild. See the report file.\""
				"puts \"Error: Timing analizer faild. See the report file.\""
				"} else {"
				"puts \"INFO: Timing analysis was successful.\""
				"puts \"Info: Timing analysis was successful.\""
				"}"
				"puts \"@@FINISH@@\""
			</line>
+4 −0
Original line number Diff line number Diff line
@@ -201,6 +201,10 @@
				label="Timing analizer"
				icon="clock.png"
				call="QuartusTimequest"/>
			<menuitem name="QuartusAssembler"
				label="Generate bitsream"
				icon="bitstream.png"
				call="QuartusAssembler"/>
		</menu>
    </menu>