Altera Quartus II编译报错:顶层分区无逻辑,Modelsim仿真正常
Quartus编译错误:"Can't synthesize current design -- Top partition does not contain any logic" 解决方案
问题根源
你的顶层实体fpga_aufgabe1没有定义任何输入/输出端口,所有信号都是内部信号。Quartus这类综合工具要求顶层设计必须包含可绑定到FPGA引脚的IO端口,否则会判定为不存在可综合的硬件逻辑。而ModelSim等仿真工具不依赖硬件引脚,只要内部信号连接正确就能运行,这就是仿真正常但综合失败的核心原因。
修改方案
1. 给顶层实体添加IO端口
把需要与外部交互的信号(控制信号s、输入a/b、输出ar/al/br/bl/cr/cl)定义为顶层端口:
library ieee; use ieee.std_logic_1164.all; entity fpga_aufgabe1 is port( s : in std_logic_vector(2 downto 0); a : in std_logic_vector(6 downto 0); b : in std_logic_vector(6 downto 0); ar : out std_logic_vector(6 downto 0); al : out std_logic_vector(6 downto 0); br : out std_logic_vector(6 downto 0); bl : out std_logic_vector(6 downto 0); cr : out std_logic_vector(6 downto 0); cl : out std_logic_vector(6 downto 0) ); end entity;
2. 调整顶层架构的信号声明与例化
去掉架构中已变为端口的信号声明,保留内部中间信号;同时建议使用命名关联例化模块,避免位置关联出错:
architecture arch of fpga_aufgabe1 is -- 保留内部中间信号 signal c : std_logic_vector(6 downto 0); signal a_high : std_logic_vector(3 downto 0); signal a_low : std_logic_vector(3 downto 0); signal b_high : std_logic_vector(3 downto 0); signal b_low : std_logic_vector(3 downto 0); signal c_high : std_logic_vector(3 downto 0); signal c_low : std_logic_vector(3 downto 0); begin -- 原有信号赋值逻辑不变 a_high <= '0' & a(6 downto 4); a_low <= a(3 downto 0); b_high <= '0' & b(6 downto 4); b_low <= b(3 downto 0); c_high <= '0' & c(6 downto 4); c_low <= c(3 downto 0); -- 命名关联例化模块,提升可读性与容错性 dekoder_ina1: entity work.fpga_ssd(arch) port map (g => a_low, y => ar); dekoder_ina2: entity work.fpga_ssd(arch) port map (g => a_high, y => al); dekoder_inb1: entity work.fpga_ssd(arch) port map (g => b_low, y => br); dekoder_inb2: entity work.fpga_ssd(arch) port map (g => b_high, y => bl); alu: entity work.fpga_ALU(arch) port map (s => s, a => a, b => b, c => c); dekoder_out1: entity work.fpga_ssd(arch) port map (g => c_low, y => cr); dekoder_out2: entity work.fpga_ssd(arch) port map (g => c_high, y => cl); end arch;
额外注意事项
- 综合工具仅处理能映射到FPGA硬件的逻辑,无IO端口的顶层设计无法绑定到物理引脚,因此会被判定为无效设计。
- 仿真工具不关心硬件引脚映射,仅验证逻辑功能,这是两者行为差异的关键。
内容的提问来源于stack exchange,提问作者Setes
相关产品推荐
相关产品推荐

