FPGA常用脚本

tcl脚本pin文件 .tcl
注意项目中的引脚名字与.tcl文件名字要一致
在这里插入图片描述

*set_global_assignment -name FAMILY “Cyclone IV E”
set_global_assignment -name RESERVE_ALL_UNUSED_PINS_WEAK_PULLUP “AS INPUT TRI-STATED”
set_global_assignment -name STRATIX_DEVICE_IO_STANDARD “3.3-V LVTTL”
set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION “USE AS REGULAR IO”
set_global_assignment -name RESERVE_DATA0_AFTER_CONFIGURATION “USE AS REGULAR IO”
set_global_assignment -name RESERVE_DATA1_AFTER_CONFIGURATION “USE AS REGULAR IO”
set_global_assignment -name RESERVE_FLASH_NCE_AFTER_CONFIGURATION “USE AS REGULAR IO”
set_global_assignment -name RESERVE_DCLK_AFTER_CONFIGURATION “USE AS REGULAR IO”
#引脚参数导入脚本
#时钟、复位
set_location_assignment PIN_E1 -to clk
set_location_assignment PIN_E15 -to rst_n
#UART
#set_location_assignment PIN_M2 -to uart_rx
#set_location_assignment PIN_G1 -to uart_tx
#LED
#set_location_assignment PIN_D16 -to led[3]
#set_location_assignment PIN_F15 -to led[2]
#set_location_assignment PIN_F16 -to led[1]
#set_location_assignment PIN_G15 -to led[0]
#独立按键
#set_location_assignment PIN_M15 -to key_in[2]
#set_location_assignment PIN_M16 -to key_in[1]
#set_location_assignment PIN_E16 -to key_in[0]
#数码管选段
set_location_assignment PIN_B7 -to dig_o[0]
set_location_assignment PIN_A8 -to dig_o[1]
set_location_assignment PIN_A6 -to dig_o[2]
set_location_assignment PIN_B5 -to dig_o[3]
set_location_assignment PIN_B6 -to dig_o[4]
set_location_assignment PIN_A7 -to dig_o[5]
set_location_assignment PIN_B8 -to dig_o[6]
set_location_assignment PIN_A5 -to dig_o[7]
#数码管片选
set_location_assignment PIN_A4 -to sel_o[0]
set_location_assignment PIN_B4 -to sel_o[1]
set_location_assignment PIN_A3 -to sel_o[2]
set_location_assignment PIN_B3 -to sel_o[3]
set_location_assignment PIN_A2 -to sel_o[4]
set_location_assignment PIN_B1 -to sel_o[5]
#蜂鸣器
#set_location_assignment PIN_J1 -to beep
#SDRAM
#地址
#set_location_assignment PIN_T8 -to addr[0]
#set_location_assignment PIN_P9 -to addr[1]
#set_location_assignment PIN_T9 -to addr[2]
#set_location_assignment PIN_R9 -to addr[3]
#set_location_assignment PIN_L16 -to addr[4]
#set_location_assignment PIN_L15 -to addr[5]
#set_location_assignment PIN_N16 -to addr[6]
#set_location_assignment PIN_N15 -to addr[7]
#set_location_assignment PIN_P16 -to addr[8]
#set_location_assignment PIN_P15 -to addr[9]
#set_location_assignment PIN_R8 -to addr[10]
#set_location_assignment PIN_R16 -to addr[11]
#set_location_assignment PIN_T15 -to addr[12]

#数据

#set_location_assignment PIN_R5 -to dq[0]
#set_location_assignment PIN_T4 -to dq[1]
#set_location_assignment PIN_T3 -to dq[2]
#set_location_assignment PIN_R3 -to dq[3]
#set_location_assignment PIN_T2 -to dq[4]
#set_location_assignment PIN_R1 -to dq[5]
#set_location_assignment PIN_P2 -to dq[6]
#set_location_assignment PIN_P1 -to dq[7]
#set_location_assignment PIN_R13 -to dq[8]
#set_location_assignment PIN_T13 -to dq[9]
#set_location_assignment PIN_R12 -to dq[10]
#set_location_assignment PIN_T12 -to dq[11]
#set_location_assignment PIN_T10 -to dq[12]
#set_location_assignment PIN_R10 -to dq[13]
#set_location_assignment PIN_T11 -to dq[14]
#set_location_assignment PIN_R11 -to dq[15]
#bank
#set_location_assignment PIN_R7 -to bank[0]
#set_location_assignment PIN_T7 -to bank[1]
#dqm
#set_location_assignment PIN_N2 -to dqm[0]
#set_location_assignment PIN_T14 -to dqm[1]

#时钟

#set_location_assignment PIN_R4 -to sdram_clk
#控制信号
#set_location_assignment PIN_R14 -to cke
#set_location_assignment PIN_T6 -to cs_n
#set_location_assignment PIN_R6 -to ras_n
#set_location_assignment PIN_T5 -to cas_n
#set_location_assignment PIN_N1 -to we_n
#flash
#set_location_assignment PIN_H2 -to miso
#set_location_assignment PIN_C1 -to mosi
#set_location_assignment PIN_H1 -to sclk
#set_location_assignment PIN_D2 -to cs_n
#EEPROM
#set_location_assignment PIN_L2 -to sda
#set_location_assignment PIN_L1 -to sclk

16bit vga output VGA

#set_location_assignment PIN_F6 -to vga_out_b[4]
#set_location_assignment PIN_E5 -to vga_out_b[3]
#set_location_assignment PIN_D3 -to vga_out_b[2]
#set_location_assignment PIN_D4 -to vga_out_b[1]
#set_location_assignment PIN_C3 -to vga_out_b[0]
#set_location_assignment PIN_J6 -to vga_out_g[5]
#set_location_assignment PIN_L8 -to vga_out_g[4]
#set_location_assignment PIN_K8 -to vga_out_g[3]
#set_location_assignment PIN_F7 -to vga_out_g[2]
#set_location_assignment PIN_G5 -to vga_out_g[1]
#set_location_assignment PIN_F5 -to vga_out_g[0]
#set_location_assignment PIN_L6 -to vga_out_hs
#set_location_assignment PIN_L4 -to vga_out_r[4]
#set_location_assignment PIN_L3 -to vga_out_r[3]
#set_location_assignment PIN_L7 -to vga_out_r[2]
#set_location_assignment PIN_K5 -to vga_out_r[1]
#set_location_assignment PIN_K6 -to vga_out_r[0]
#set_location_assignment PIN_N3 -to vga_out_vs
#cmos an5640 module 摄像头
#set_location_assignment PIN_C3 -to cmos_db[7]
#set_location_assignment PIN_E5 -to cmos_db[6]
#set_location_assignment PIN_F2 -to cmos_db[5]
#set_location_assignment PIN_F3 -to cmos_db[4]
#set_location_assignment PIN_M1 -to cmos_db[3]
#set_location_assignment PIN_D4 -to cmos_db[2]
#set_location_assignment PIN_G5 -to cmos_db[1]
#set_location_assignment PIN_F5 -to cmos_db[0]
#set_location_assignment PIN_D1 -to cmos_href
#set_location_assignment PIN_D5 -to cmos_pclk
#set_location_assignment PIN_C6 -to cmos_scl
#set_location_assignment PIN_D6 -to cmos_sda
#set_location_assignment PIN_F6 -to cmos_vsync
#set_location_assignment PIN_D3 -to cmos_xclk
#set_location_assignment PIN_F1 -to cmos_rst_n
#set_location_assignment PIN_G2 -to cmos_pwdn
#lcd an430 J2
#set_location_assignment PIN_J11 -to lcd_b[7]
#set_location_assignment PIN_G16 -to lcd_b[6]
#set_location_assignment PIN_K10 -to lcd_b[5]
#set_location_assignment PIN_K9 -to lcd_b[4]
#set_location_assignment PIN_G11 -to lcd_b[3]
#set_location_assignment PIN_F14 -to lcd_b[2]
#set_location_assignment PIN_F13 -to lcd_b[1]
#set_location_assignment PIN_F11 -to lcd_b[0]
#set_location_assignment PIN_J12 -to lcd_dclk
#set_location_assignment PIN_K11 -to lcd_de
#set_location_assignment PIN_D14 -to lcd_g[7]
#set_location_assignment PIN_F10 -to lcd_g[6]
#set_location_assignment PIN_C14 -to lcd_g[5]
#set_location_assignment PIN_E11 -to lcd_g[4]
#set_location_assignment PIN_D12 -to lcd_g[3]
#set_location_assignment PIN_D11 -to lcd_g[2]
#set_location_assignment PIN_C11 -to lcd_g[1]
#set_location_assignment PIN_E10 -to lcd_g[0]
#set_location_assignment PIN_J13 -to lcd_hs
#set_location_assignment PIN_D9 -to lcd_r[7]
#set_location_assignment PIN_C9 -to lcd_r[6]
#set_location_assignment PIN_E9 -to lcd_r[5]
#set_location_assignment PIN_F9 -to lcd_r[4]
#set_location_assignment PIN_F7 -to lcd_r[3]
#set_location_assignment PIN_E8 -to lcd_r[2]
#set_location_assignment PIN_D8 -to lcd_r[1]
#set_location_assignment PIN_E7 -to lcd_r[0]
#set_location_assignment PIN_J14 -to lcd_vs*

modlsim脚本仿真
.do文件执行 格式 在执行框中输入 do name.do 回车
注意仿真模块要放在do文件的平行目录下,不然找不到被测试文件
注意修改do文件中的文件名字
在这里插入图片描述

#tcl脚本 自动化仿真
#创建工作库 名为work
vlib work

#映射工作库 work 到 work
vmap work work

#编译testbench文件
vlog clock_tb.v

#若要仿真IP核必须添加该文件
#vlog altera_mf.v

#编译被仿真文件
vlog …/rtl/clock.v
#vlog …/rtl/key_filter.v
#vlog …/rtl/led.v

#对IP核进行仿真
#vlog …/par/ipcore/pll.v

#指定仿真顶层
vsim -novopt work.clock_tb

#添加testbench顶层模块中的信号到波形窗
add wave -position insertpoint sim:clock_tb//*

#表示让该tb_clk信号显示黄色
#add wave -noupdate -color Yellow /follow_led_tb/tb_clk

#表示让div_coef信号用十进制tb_led来显示
#add wave -noupdate -radix decimal /follow_led_tb/tb_led

#运行2000个时间单位
run 200

#一直仿真下去
#run -all

C4开发板 数码管
localparam ZER = 7’b100_0000,
ONE = 7’b111_1001,
TWO = 7’b010_0100,
THR = 7’b011_0000,
FOU = 7’b001_1001,
FIV = 7’b001_0010,
SIX = 7’b000_0010,
SEV = 7’b111_1000,
EIG = 7’b000_0000,
NIN = 7’b001_0000;

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值