aboutsummaryrefslogtreecommitdiff
path: root/scripts/create_quartus_project_settings.tcl
blob: 2f3b00fd891a8d22d0abb43d6db6fcd9a7f12be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
## ----------------------------------------------------------------------------
## Script     : create_quartus_project_settings.tcl
## ----------------------------------------------------------------------------
## Author     : Johann Faerber, F. Beckmann
## Company    : University of Applied Sciences Augsburg
## ----------------------------------------------------------------------------
## Description: create a quartus project with default settings for device, 
##              unused pins, ...
##              expects project name as command line parameter 
##              e.g.
##              quartus_sh -t create_quartus_project_settings.tcl -projectname de1_mux2to1
##                   --vhdlfile top_simple.vhd --pinfile top_simple.pins             

package require cmdline
# Load Quartus II Tcl Project package
package require ::quartus::project

# ----------------------------------------------------------------------------
# Declare command line parameters
# ----------------------------------------------------------------------------
set parameters {
    {projectname.arg ""   "Project Name"}
	{vhdlfile.arg ""   "VHDL source file"}
	{pinfile.arg ""   "Pin Configuration File"}
	{sdcfile.arg ""   "Synopsys Designconstraints File"}
}
array set arg [::cmdline::getoptions argv $parameters]

# ----------------------------------------------------------------------------
# Verify required paramters
# ----------------------------------------------------------------------------
set requiredParameters {projectname vhdlfile pinfile sdcfile}
foreach parameter $requiredParameters {
    if {$arg($parameter) == ""} {
        puts stderr "Missing required parameter: -$parameter"
        exit 1
    }
}


	# ----------------------------------------------------------------------------
	# Create project
	# ----------------------------------------------------------------------------
	project_new $arg(projectname) -overwrite
	
	# ----------------------------------------------------------------------------
	# Assign family, device, and top-level file
	# ----------------------------------------------------------------------------
	set_global_assignment -name FAMILY "Cyclone II"
	set_global_assignment -name DEVICE EP2C20F484C7
	set_global_assignment -name SDC_FILE $arg(sdcfile)
	
	# ----------------------------------------------------------------------------
	# Default settings
	# ----------------------------------------------------------------------------
	set_global_assignment -name USE_CONFIGURATION_DEVICE ON
	set_global_assignment -name RESERVE_ALL_UNUSED_PINS "AS INPUT TRI-STATED"
	set_global_assignment -name VHDL_INPUT_VERSION VHDL_2008
	
	# ----------------------------------------------------------------------------
	# Design files
	# ----------------------------------------------------------------------------
	#set_global_assignment -name VHDL_FILE ../src/e_cntdnmodm.vhd
	set_global_assignment -name VHDL_FILE $arg(vhdlfile)
	
	# ----------------------------------------------------------------------------
	# Pin Assignments
	# ----------------------------------------------------------------------------
	# set_location_assignment PIN_L1 -to CLOCK_50
	source $arg(pinfile)

	# ----------------------------------------------------------------------------
	# Close project
	# ----------------------------------------------------------------------------
	project_close