set_property CONFIG_MODE value [current_design]

       在 Vivado 中,set_property CONFIG_MODE value [current_design] 命令用于设置 FPGA 的配置模式。以下是详细说明:

一、命令语法

set_property CONFIG_MODE <value> [current_design]

二、CONFIG_MODE 常用值

Value配置模式描述典型应用
SPISPI 模式串行 SPI Flash最常用
BPIBPI 模式并行 NOR Flash高速配置
SERIAL串行模式JTAG 配置调试用
Master SPI主 SPIFPGA 主动控制标准 SPI
Master BPI主 BPIFPGA 主动控制并行 Flash

三、使用方法

1. 在 XDC 约束文件中(推荐)

# constraints.xdc

# SPI 配置模式
set_property CONFIG_MODE SPI [current_design]

# 或 BPI 配置模式
set_property CONFIG_MODE BPI [current_design]

# 或串行模式
set_property CONFIG_MODE SERIAL [current_design]

2. 完整的配置模式设置

# SPI 模式完整配置
set_property CONFIG_MODE SPI [current_design]
set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]
set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]

# BPI 模式完整配置
set_property CONFIG_MODE BPI [current_design]
set_property BITSTREAM.CONFIG.BPI_SYNC_MODE 0 [current_design]
set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]

3. 在 Tcl 控制台中使用

# 设置配置模式
set_property CONFIG_MODE SPI [current_design]

# 验证设置
get_property CONFIG_MODE [current_design]

四、不同配置模式的详细说明

1. SPI 模式(最常用)

# 标准SPI配置
set_property CONFIG_MODE SPI [current_design]
set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 1 [current_design]  ;# 单线
set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]

# 或高性能SPI配置
set_property CONFIG_MODE SPI [current_design]
set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]  ;# 四线
set_property BITSTREAM.CONFIG.CONFIGRATE 66 [current_design]
set_property BITSTREAM.CONFIG.SPI_FALL_EDGE YES [current_design]

2. BPI 模式(并行)

# BPI 并行配置
set_property CONFIG_MODE BPI [current_design]
set_property BITSTREAM.CONFIG.BPI_SYNC_MODE 0 [current_design]     ;# 异步模式
set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]
set_property BITSTREAM.CONFIG.BPI_PAGE_SIZE 1 [current_design]     ;# 页大小

# 或同步BPI配置
set_property CONFIG_MODE BPI [current_design]
set_property BITSTREAM.CONFIG.BPI_SYNC_MODE 1 [current_design]     ;# 同步模式
set_property BITSTREAM.CONFIG.BPI_BUS_WIDTH 16 [current_design]    ;# 16位总线

3. 串行模式

# 串行配置(通常用于调试)
set_property CONFIG_MODE SERIAL [current_design]

五、不同器件的配置模式支持

1. Artix-7/Kintex-7 系列

# 支持多种模式
set_property CONFIG_MODE SPI [current_design]      ;# 推荐
# 或
set_property CONFIG_MODE BPI [current_design]      ;# 高速应用
# 或  
set_property CONFIG_MODE SERIAL [current_design]   ;# 调试

2. Zynq-7000 系列

# PS 配置 PL
set_property CONFIG_MODE SPI [current_design]
set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]

# 或主模式
set_property CONFIG_MODE Master SPI [current_design]

3. UltraScale/UltraScale+ 系列

# 高性能配置
set_property CONFIG_MODE SPIx4 [current_design]
set_property BITSTREAM.CONFIG.SPI_32BIT_ADDR YES [current_design]
set_property BITSTREAM.CONFIG.CONFIGRATE 66 [current_design]

六、验证配置的方法

1. 检查属性设置

# 查看配置模式
get_property CONFIG_MODE [current_design]

# 查看所有配置相关属性
report_property [current_design] | findstr CONFIG

2. 生成配置报告

# 生成比特流
write_bitstream -force design.bit

# 查看配置摘要
report_config_status -file config_status.rpt

七、相关属性说明

1. SPI 模式相关属性

set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]      ;# 数据位宽
set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]       ;# 时钟频率
set_property BITSTREAM.CONFIG.SPI_FALL_EDGE YES [current_design]   ;# 时钟边沿
set_property BITSTREAM.CONFIG.SPI_32BIT_ADDR YES [current_design]  ;# 地址模式

2. BPI 模式相关属性

set_property BITSTREAM.CONFIG.BPI_SYNC_MODE 0 [current_design]     ;# 同步模式
set_property BITSTREAM.CONFIG.BPI_BUS_WIDTH 16 [current_design]    ;# 总线宽度
set_property BITSTREAM.CONFIG.BPI_PAGE_SIZE 1 [current_design]     ;# 页大小
set_property BITSTREAM.CONFIG.CONFIGRATE 50 [current_design]       ;# 时钟频率

八、硬件设计注意事项

1. SPI 模式引脚需求

SPI 引脚:
- CCLK    : 配置时钟
- MOSI/IO0: 主出从入
- MISO/IO1: 主入从出  
- IO2     : Quad SPI 数据2
- IO3     : Quad SPI 数据3
- CS_B    : 片选信号

2. BPI 模式引脚需求

BPI 引脚:
- A[0:28] : 地址总线
- DQ[0:15]: 数据总线
- CS_B    : 片选信号
- OE_B    : 输出使能
- WE_B    : 写使能
- ADV_B   : 地址有效

九、调试和故障排除

1. 配置模式选择指南

# 如果配置失败,尝试以下步骤:

# 1. 确认硬件连接
# 2. 检查配置模式设置
get_property CONFIG_MODE [current_design]

# 3. 尝试不同的配置模式
set_property CONFIG_MODE SPI [current_design]
# 或
set_property CONFIG_MODE BPI [current_design]

# 4. 使用保守设置
set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 1 [current_design]
set_property BITSTREAM.CONFIG.CONFIGRATE 25 [current_design]

十、最佳实践

# 新设计推荐使用 SPI 模式
set_property CONFIG_MODE SPI [current_design]
set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 1 [current_design]  ;# 开始用单线
set_property BITSTREAM.CONFIG.CONFIGRATE 25 [current_design]   ;# 保守频率

# 验证后优化性能
set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]  ;# 升级到四线
set_property BITSTREAM.CONFIG.CONFIGRATE 66 [current_design]   ;# 提高频率

       CONFIG_MODE 是 FPGA 配置的基础设置,必须与硬件设计完全匹配。错误的配置模式会导致 FPGA 无法正常加载比特流。

[DRC NSTD-1] Unspecified I/O Standard: 2 out of 60 logical ports use I/O standard (IOSTANDARD) value 'DEFAULT', instead of a user assigned specific value. This may cause I/O contention or incompatibility with the board power or connectivity affecting performance, signal integrity or in extreme cases cause damage to the device or the components to which it is connected. To correct this violation, specify all I/O standards. This design will fail to generate a bitstream unless all logical ports have a user specified I/O standard value defined. To allow bitstream creation with unspecified I/O standard values (not recommended), use this command: set_property SEVERITY {Warning} [get_drc_checks NSTD-1]. NOTE: When using the Vivado Runs infrastructure (e.g. launch_runs Tcl command), add this command to a .tcl file and add that file as a pre-hook for write_bitstream step for the implementation run. Problem ports: clk_25m_n, and clk_25m_p. 约束文件如下 ################################################################################ ## 时钟和复位 ################################################################################ ################################################################################ ## 时钟约束 (外部晶振 + Clock Wizard) ################################################################################ # 1. 外部晶振输入约束 (25MHz) ################################################################################ ## 时钟约束 (外部差分晶振) ################################################################################ # 差分时钟约束 set_property PACKAGE_PIN N21 [get_ports clk_25m_p] set_property PACKAGE_PIN N22 [get_ports clk_25m_n] # 添加N端约束 set_property IOSTANDARD LVDS33 [get_ports clk_25m_p] # 使用LVDS标准 set_property IOSTANDARD LVDS33 [get_ports clk_25m_n] # 使用LVDS标准 set_property DIFF_TERM TRUE [get_ports clk_25m_p] # 启用差分终端 set_property DIFF_TERM TRUE [get_ports clk_25m_n] # 启用差分终端 # 创建差分时钟约束 create_clock -period 40.000 -name clk_25m -waveform {0.000 20.000} [get_ports clk_25m_p] # 复位信号保持不变 set_property PACKAGE_PIN L25 [get_ports rst_n] set_property IOSTANDARD LVCMOS33 [get_ports rst_n] set_property PULLUP true [get_ports rst_n] #connect_debug_port dbg_hub/clk [get_nets clk_25m_p] ################################################################################ ## JTAG 接口 ################################################################################ set_property PACKAGE_PIN AB25 [get_ports jtag_tck] set_property IOSTANDARD LVCMOS33 [get_ports jtag_tck] set_property PACKAGE_PIN AA25 [get_ports jtag_tms] set_property IOSTANDARD LVCMOS33 [get_ports jtag_tms] set_property PACKAGE_PIN Y26 [get_ports jtag_tdi] set_property IOSTANDARD LVCMOS33 [get_ports jtag_tdi] set_property PACKAGE_PIN K26 [get_ports jtag_tdo] set_property IOSTANDARD LVCMOS33 [get_ports jtag_tdo] ################################################################################ ## Tester 接口 ################################################################################ # 测试模式输出 (Bank 14) - 双重约束确保覆盖 set_property IOSTANDARD LVCMOS33 [get_ports {test_pattern[*]}] foreach pin [get_ports {test_pattern[*]}] { set_property IOSTANDARD LVCMOS33 $pin } set_property PACKAGE_PIN F15 [get_ports {test_pattern[0]}] set_property PACKAGE_PIN G19 [get_ports {test_pattern[1]}] set_property PACKAGE_PIN F20 [get_ports {test_pattern[2]}] set_property PACKAGE_PIN H16 [get_ports {test_pattern[3]}] set_property PACKAGE_PIN G16 [get_ports {test_pattern[4]}] set_property PACKAGE_PIN C17 [get_ports {test_pattern[5]}] set_property PACKAGE_PIN B17 [get_ports {test_pattern[6]}] set_property PACKAGE_PIN E16 [get_ports {test_pattern[7]}] set_property PACKAGE_PIN D16 [get_ports {test_pattern[8]}] set_property PACKAGE_PIN A17 [get_ports {test_pattern[9]}] set_property PACKAGE_PIN A18 [get_ports {test_pattern[10]}] set_property PACKAGE_PIN B19 [get_ports {test_pattern[11]}] set_property PACKAGE_PIN A19 [get_ports {test_pattern[12]}] set_property PACKAGE_PIN E17 [get_ports {test_pattern[13]}] set_property PACKAGE_PIN E18 [get_ports {test_pattern[14]}] set_property PACKAGE_PIN D18 [get_ports {test_pattern[15]}] set_property DRIVE 8 [get_ports {test_pattern[15:0]}] # 测试状态输入 (Bank 16) - 双重约束确保覆盖 set_property IOSTANDARD LVCMOS33 [get_ports {test_status[*]}] foreach pin [get_ports {test_status[*]}] { set_property IOSTANDARD LVCMOS33 $pin } set_property PACKAGE_PIN H17 [get_ports {test_status[0]}] set_property PACKAGE_PIN H14 [get_ports {test_status[1]}] set_property PACKAGE_PIN H15 [get_ports {test_status[2]}] set_property PACKAGE_PIN G17 [get_ports {test_status[3]}] set_property PACKAGE_PIN F17 [get_ports {test_status[4]}] set_property PACKAGE_PIN F18 [get_ports {test_status[5]}] set_property PACKAGE_PIN F19 [get_ports {test_status[6]}] set_property PACKAGE_PIN G15 [get_ports {test_status[7]}] set_property PULLDOWN true [get_ports {test_status[7:0]}] # 双向探测总线 (Bank 15) - 双重约束确保覆盖 set_property IOSTANDARD LVCMOS33 [get_ports {probe_bus[*]}] foreach pin [get_ports {probe_bus[*]}] { set_property IOSTANDARD LVCMOS33 $pin } set_property PACKAGE_PIN K18 [get_ports {probe_bus[0]}] set_property PACKAGE_PIN K15 [get_ports {probe_bus[1]}] set_property PACKAGE_PIN J16 [get_ports {probe_bus[2]}] set_property PACKAGE_PIN J14 [get_ports {probe_bus[3]}] set_property PACKAGE_PIN J15 [get_ports {probe_bus[4]}] set_property PACKAGE_PIN K16 [get_ports {probe_bus[5]}] set_property PACKAGE_PIN K17 [get_ports {probe_bus[6]}] set_property PACKAGE_PIN M14 [get_ports {probe_bus[7]}] set_property PACKAGE_PIN L14 [get_ports {probe_bus[8]}] set_property PACKAGE_PIN M15 [get_ports {probe_bus[9]}] set_property PACKAGE_PIN M16 [get_ports {probe_bus[10]}] set_property PACKAGE_PIN M17 [get_ports {probe_bus[11]}] set_property PACKAGE_PIN J19 [get_ports {probe_bus[12]}] set_property PACKAGE_PIN H19 [get_ports {probe_bus[13]}] set_property PACKAGE_PIN L17 [get_ports {probe_bus[14]}] set_property PACKAGE_PIN L18 [get_ports {probe_bus[15]}] set_property PACKAGE_PIN K20 [get_ports {probe_bus[16]}] set_property PACKAGE_PIN J20 [get_ports {probe_bus[17]}] set_property PACKAGE_PIN J18 [get_ports {probe_bus[18]}] set_property PACKAGE_PIN H18 [get_ports {probe_bus[19]}] set_property PACKAGE_PIN G20 [get_ports {probe_bus[20]}] set_property PACKAGE_PIN G21 [get_ports {probe_bus[21]}] set_property PACKAGE_PIN K21 [get_ports {probe_bus[22]}] set_property PACKAGE_PIN J21 [get_ports {probe_bus[23]}] set_property PACKAGE_PIN H21 [get_ports {probe_bus[24]}] set_property PACKAGE_PIN H22 [get_ports {probe_bus[25]}] set_property PACKAGE_PIN J23 [get_ports {probe_bus[26]}] set_property PACKAGE_PIN H23 [get_ports {probe_bus[27]}] set_property PACKAGE_PIN G22 [get_ports {probe_bus[28]}] set_property PACKAGE_PIN F22 [get_ports {probe_bus[29]}] set_property PACKAGE_PIN J24 [get_ports {probe_bus[30]}] set_property PACKAGE_PIN H24 [get_ports {probe_bus[31]}] set_property DRIVE 12 [get_ports {probe_bus[31:0]}] ################################################################################ ## 配置约束 ################################################################################ set_property CFGBVS VCCO [current_design] set_property CONFIG_VOLTAGE 3.3 [current_design] set_property BITSTREAM.CONFIG.CONFIGRATE 33 [current_design] set_property BITSTREAM.CONFIG.SPI_BUSWIDTH 4 [current_design]
08-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值