【问题标题】:Designing T-Flipflop on Quartus在 Quartus 中设计 T 型触发器
【发布时间】:2021-12-05 16:49:50
【问题描述】:

我是 VHDL 新手,我想设计一个 T Flip-Flip,它可以根据 T 输入切换和更改 Q,这就是我所拥有的

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;


entity T_flipflop is

   Port ( T : in std_logic;
         CLK : in std_logic;
         Q : out std_logic ); 

end T_flipflop;


architecture Behavioral of T_flipflop is
 begin
  process (CLK) 
  --- The error in the following line
    if (CLK’event and CLK = ‘1’ )then
        Q <= Q when T = '0';
       Q <= not Q when T = '1';
    end if;
end process;
end Behavioral;

但是每次我在 Quartus 上运行它时,我都会收到以下错误,我做错了什么?提前致谢

Info: *******************************************************************
Info: Running Quartus Prime Analysis & Synthesis
    Info: Version 18.1.0 Build 625 09/12/2018 SJ Lite Edition
    Info: Processing started: Sun Dec 05 19:20:03 2021
    Info: Version 18.1.0 Build 625 09/12/2018 SJ Lite Edition
    Info: Processing started: Sun Dec 05 19:20:03 2021
Info: Command: quartus_map --read_settings_files=on --write_settings_files=off T_FlipFlop2 -c T_FlipFlop2
Warning (18236): Number of processors has not been specified which may cause overloading on shared machines.  Set the global assignment NUM_PARALLEL_PROCESSORS in your QSF to an appropriate value for best performance.
Info (20030): Parallel compilation is enabled and will use 6 of the 6 processors detected
Error (10500): VHDL syntax error at T_FlipFlop2.vhd(19) near text "if";  expecting "begin", or a declaration statement
Error (10500): VHDL syntax error at T_FlipFlop2.vhd(19) near text 
Error (10500): VHDL syntax error at T_FlipFlop2.vhd(19) near text 
Error (10500): VHDL syntax error at T_FlipFlop2.vhd(19) near text 
Info (12021): Found 0 design units, including 0 entities, in source file t_flipflop2.vhd
Error: Quartus Prime Analysis & Synthesis was unsuccessful. 4 errors, 1 warning
    Error: Peak virtual memory: 4836 megabytes
    Error: Processing ended: Sun Dec 05 19:20:11 2021
    Error: Elapsed time: 00:00:08
    Error: Total CPU time (on all processors): 00:00:18
    Error: Peak virtual memory: 4836 megabytes
    Error: Processing ended: Sun Dec 05 19:20:11 2021
    Error: Elapsed time: 00:00:08
    Error: Total CPU time (on all processors): 00:00:18
Error (293001): Quartus Prime Full Compilation was unsuccessful. 6 errors, 1 warning

【问题讨论】:

  • 您没有向我们展示完整的错误消息。顺便说一句,请将所有内容复制为文本,而不是截图。 “vhdl4.vhd”在哪里?请标记来源中的错误行,例如通过评论。
  • 抱歉,我刚刚添加了完整的错误信息

标签: vhdl quartus


【解决方案1】:

process (CLK) 需要 is begin

将第 19 行更改为:

process (CLK) is begin

这里是更多信息的参考:https://fpgatutorial.com/using-vhdl-process-blocks-to-model-sequential-logic/

【讨论】:

  • 非常感谢,现在我做到了,又弹出了两个错误:首先在第 20 行 " if (CLK'event and CLK = '1' )then " ,错误是 ( Error (10500):T_FlipFlop2.vhd(20) 附近文本“”的 VHDL 语法错误;需要“)”或“,”)
  • 第 21 行和第 22 行的第二个说:“错误 (10500): VHDL 语法错误在 T_FlipFlop2.vhd(21) 靠近文本 "when"; 期待 ";" : "
  • @Alselvdor 好吧,看来您需要拿起您的 VHDL 书并查找正确的语法。
  • when 关键字只允许在使用 VHDL 2008 的进程中使用。我不确定 VHDL 2008 Quartus Prime 实际支持多少。
  • 流程声明不需要is,它是可选的。begin 将流程声明部分与流程声明部分分开。就您链接的教程准确性而言,流程是并发语句。块是表示层次结构的单独并发语句。实体及其架构被详细描述为嵌套块语句。进程块来自 Systemverilog 用户。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-08-04
  • 2017-10-08
  • 2016-10-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多