赞
踩
export QUARTUS_64BIT=1
export ALTERA_ROOT="/opt/quatus/13.0sp1"
export QUARTUS_ROOTDIR_OVERRIDE="$ALTERA_ROOT/quartus"
export QSYS_ROOTDIR="$QUARTUS_ROOTDIR_OVERRIDE/sopc_builder/bin"
export QUARTUS_LIBRARY_PATHS="$QUARTUS_ROOTDIR_OVERRIDE/linux64/:$QUARTUS_ROOTDIR_OVERRIDE/linux/"
export SOPC_KIT_NIOS2="$ALTERA_ROOT/nios2eds"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$QUARTUS_LIBRARY_PATHS"
export PATH="$PATH:$ALTERA_ROOT/quartus/bin"
修改为自已的所在目录,source一下。
二、新建verilog,和sdc, 简单示例
blink.v
module blink( input wire clk, output wire LED ); reg[31:0] cnt; initial begin cnt <= 31'h00000000; end always @(posedge clk) begin cnt <= cnt + 1; end assign LED = cnt[24]; endmodule
blink.sdc
create_clock -name clk -period "50MHz" [get_ports clk]
set_false_path -from * -to [get_ports LED]
三、创建项目。
quartus_sh --tcl_eval project_new blink
但这样创建的是默认器件,
写个脚本
create_prj.tcl
project_new blink -overwrite
set_global_assignment -name FAMILY Cyclone
set_global_assignment -name DEVICE EP1C6Q240C8
set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files
set_global_assignment -name RESERVE_ALL_UNUSED_PINS "AS INPUT TRI-STATED"
set_global_assignment -name TOP_LEVEL_ENTITY blink
set_global_assignment -name VERILOG_FILE blink.v
set_global_assignment -name SDC_FILE blink.sdc
set_location_assignment PIN_60 -to LED
set_location_assignment PIN_29 -to clk
project_close
执行
quartus_sh -t create_prj.tcl
目录下会生成所需的qpf、qsf。
也可以把这个脚本做成通用的,把blink换成$argv, 即开头换成
project_new $argv -overwrite
然后执行
quartus_sh -t create_prj.tcl blink
可以先用gui创建,参考自动生成的qsf改写参数。
四、编译综合
quartus_sh --flow compile blink
output_files目录下生成文件,blink.sof,blink.pof。
五、烧录
quartus_pgm -m jtag -o "p;blink.sof"
查看帮助
$quartus_pgm -help=o
-o <options>;<input_file>@<device_index>
$quartus_pgm -help=m
JTAG JTAG programming
PS Passive Serial programming
AS Active Serial programming
SD In-Socket programming
六、自动
#!/bin/sh
PROJECT=blink
TOP_LEVEL_ENTITY=blink.v
DEVICE_FAMILY="Cyclone"
DEVICE_PART=EP1C6Q240C8
PACKING_OPTION=minimize_area
quartus_map $PROJECT --source=$TOP_LEVEL_ENTITY --family=$DEVICE_FAMILY
quartus_fit $PROJECT --part=$DEVICE_PART --pack_register=$PACKING_OPTION
quartus_asm $PROJECT
quartus_sta $PROJECT
chmod +x 直接执行。
最后一行也可以添加烧录命令。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。