完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
刚开始学vhdl,想写一个波形发生器的代码,但过程中编译老是出现Critical Warning (332148): Timing requirements not met的警告,想用modelsim仿真,但是时钟也都是未知信号,想知道是和这个警告有关系吗?还是我的testbench写错了。之后用自己这个程序,把FPGA输出接到dac0832波形能正常输出方波正弦波以及三角波。以及突然发现不论是自己写的,还是网上直接复制粘贴的都有这个警告:Critical Warning (332148): Timing requirements not met,这又是为何呢?本人真真是萌新中的萌新啊~学了几天懂得也不多,就是按网上的代码改改~求各位前辈指点指点~积分什么的各路大神也会太在意的吧~~~(只有2个哭~) 以下是代码: ---------------------------------------------------- --正弦波 -- ---------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity sin is port(clk_sin:in std_logic; --reset:in std_logic; dd4:out std_logic_vector(7 downto 0));--———输出范围为0到255 end; architecture dacc of sin is signal q: integer range 63 downto 0; signal clk4:std_logic; begin lcd_clk: process(clk_sin) variable count:integer range 0 to 50000000; variable clk1:std_logic; begin -- if reset='0'then -- count:=0; --els if(clk_sin'event and clk_sin='1')then --rising_edge(clk) --if(count="100110001001011001111111")then --count<=(others=>'0'); if(count=24000)then count:=0; clk1:=not clk1; else count:=count+1; end if; end if; clk4<=clk1; end process; process(clk4) begin if (clk4'event and clk4='1') then q<=q+1; end if; end process; process(q) begin case q is when 00=>dd4<="11111111"; when 01=>dd4<="11111110"; when 02=>dd4<="11111101"; when 03=>dd4<="11111010"; when 04=>dd4<="11110101";--245; when 05=>dd4<="11110000";--240; when 06=>dd4<="11101010";--234; when 07=>dd4<="11100010";--226 when 08=>dd4<="11011010";--218 when 09=>dd4<="11010000";--208; when 10=>dd4<="11000110";--198; when 11=>dd4<="10111100";--188; when 12=>dd4<="10110000";--176; when 13=>dd4<="10100101";--165; when 14=>dd4<="10011000";--152; when 15=>dd4<="10001100";--140; when 16=>dd4<="10000000";--128; when 17=>dd4<="01110011";--115; when 18=>dd4<="01100111";--103; when 19=>dd4<="01011010";--90; when 20=>dd4<="01001111";--79; when 21=>dd4<="01000011";--67; when 22=>dd4<="00111001";--57; when 23=>dd4<="00101111";--47; when 24=>dd4<="00100101";--37; when 25=>dd4<="00011101";--29; when 26=>dd4<="00010101";--21; when 27=>dd4<="00001111";--15; when 28=>dd4<="00001010";--10; when 29=>dd4<="00000101";--5; when 30=>dd4<="00000010";--2; when 31=>dd4<="00000001";--1; when 32=>dd4<="00000000";--0; when 33=>dd4<="00000001";--1; when 34=>dd4<="00000010";--2; when 35=>dd4<="00000101";--5; when 36=>dd4<="00001010";--10; when 37=>dd4<="00001111";--15; when 38=>dd4<="00010101";--21; when 39=>dd4<="00011101";--29; when 40=>dd4<="00100101";--37; when 41=>dd4<="00101111";--47; when 42=>dd4<="00111001";--57; when 43=>dd4<="01000011";--67; when 44=>dd4<="01001111";--79; when 45=>dd4<="01011010";--90; when 46=>dd4<="01100111";--103; when 47=>dd4<="01110011";--115; when 48=>dd4<="10000000";--128; when 49=>dd4<="10001100";--140; when 50=>dd4<="10100101";--165; when 51=>dd4<="10110000";--176; when 52=>dd4<="10111100";--188; when 53=>dd4<="11000110";--198; when 54=>dd4<="11010000";--208; when 55=>dd4<="11011010";--218; when 56=>dd4<="11100010";--226; when 57=>dd4<="11101010";--234; when 58=>dd4<="11110000";--240; when 59=>dd4<="11110101";--245; when 60=>dd4<="11111010";--250; when 61=>dd4<="11111101";--253; when 62=>dd4<="11111110";--254; when 63=>dd4<="11111111";--255; when others=>null; end case; end process; end architecture dacc; ---------------------------------------------------- --三角波 -- ---------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity san is port(clk_san:in std_logic; --reset:in std_logic; dd3:out std_logic_vector(7 downto 0)); end san; architecture art of san is signal b:std_logic; signal clk3:std_logic; signal c:std_logic_vector(7 downto 0); begin lcd_clk: process(clk_san) variable count:integer range 0 to 50000000; variable clk1:std_logic; begin -- if reset='0'then -- count:=0; --els if(clk_san'event and clk_san='1')then --rising_edge(clk) --if(count="100110001001011001111111")then --count<=(others=>'0'); if(count=24000/8)then count:=0; clk1:=not clk1; else count:=count+1; end if; end if; clk3<=clk1; end process; process(clk3) begin if (clk3'event and clk3='1') then if(b='0') then c<=c+1; if(c=255) then b<='1'; end if; elsif(b='1') then c<=c-1; if(c=1) then b<='0'; end if; end if; dd3<=c; end if; end process; end art; ----------------------------------------------------- --方波 -- ------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity fan is port( clk_fan : in std_logic; --reset:std_logic; dd1: out std_logic_vector(7 downto 0)); end; architecture dacc of fan is signal q: integer range 1 downto 0; signal clk1:std_logic; begin process(clk_fan) variable count:integer range 0 to 50000000; variable clk0:std_logic; begin -- if reset='0'then -- count:=0; --els if(clk_fan'event and clk_fan='1')then --rising_edge(clk) --if(count="100110001001011001111111")then --count<=(others=>'0'); if(count=2400*32)then count:=0; clk0:=not clk0; else count:=count+1; end if; end if; clk1<=clk0; end process; process(clk1) begin if (clk1'event and clk1='1') then q<=q+1; end if; end process; process(q) begin case q is when 0=>dd1<="11111111"; when 1=>dd1<="00000000"; when others=>null; end case; end process; end architecture; ------------------------------------------------------- --波形选择 -- -------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity ch is port(cdd1,cdd3,cdd4 : in std_logic_vector (7 downto 0); s: in std_logic_vector(1 downto 0); y: out std_logic_vector (7 downto 0)); end entity ch; architecture art of ch is begin process(s,cdd1,cdd3,cdd4) begin case s is when "00"=>y<=cdd1; when "01"=>y<=cdd1; when "10"=>y<=cdd3; when "11"=>y<=cdd4; when others=>null; end case; end process; end architecture art; -------------------------------------------------------- --主模块 -- -------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity gen is port(clk:in std_logic; data :out std_logic_vector(7 downto 0); s:in std_logic_vector(1 downto 0)); end gen; architecture art of gen is component sin port(clk_sin:in std_logic; dd4:out std_logic_vector(7 downto 0)); end component; component san port(clk_san:in std_logic; dd3:out std_logic_vector(7 downto 0)); end component; component fan port( clk_fan : in std_logic; dd1 : out std_logic_vector(7 downto 0)); end component; component ch port(cdd1,cdd3,cdd4 : in std_logic_vector (7 downto 0); s: in std_logic_vector(1 downto 0); y: out std_logic_vector (7 downto 0)); end component; -- component f -- port(clk : in std_logic; --s: in std_logic_vector(1 downto 0); --z1,z2,z3,z4: out std_logic); -- end component; --signal _clk:std_logic; -- signal ch:std_logic_vector (1 downto 0); signal da4: std_logic_vector(7 downto 0); signal da3: std_logic_vector(7 downto 0); signal da1: std_logic_vector(7 downto 0); begin U1: sin port map(clk,da4); U2: san port map(clk,da3); U3: fan port map(clk,da1); U4: ch port map(da1,da3,da4,s,data); end architecture art; ------------------------------------------------------------------------------ testbench代码 : -- Copyright (C) 1991-2012 Altera Corporation -- Your use of Altera Corporation's design tools, logic functions -- and other software and tools, and its AMPP partner logic -- functions, and any output files from any of the foregoing -- (including device programming or simulation files), and any -- associated documentation or information are expressly subject -- to the terms and conditions of the Altera Program License -- Subscription Agreement, Altera MegaCore Function License -- Agreement, or other applicable license agreement, including, -- without limitation, that your use is for the sole purpose of -- programming logic devices manufactured by Altera and sold by -- Altera or its authorized distributors. Please refer to the -- applicable agreement for further details. -- *************************************************************************** -- This file contains a Vhdl test bench template that is freely editable to -- suit user's needs .Comments are provided in each section to help the user -- fill out necessary details. -- *************************************************************************** -- Generated on "12/10/2016 11:23:16" -- Vhdl Test Bench template for design : gen -- -- Simulation tool : ModelSim-Altera (VHDL) -- LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY gen_vhd_tst IS END gen_vhd_tst; ARCHITECTURE gen_arch OF gen_vhd_tst IS -- constants -- signals SIGNAL clk : STD_LOGIC; SIGNAL data : STD_LOGIC_VECTOR(7 DOWNTO 0); SIGNAL s : STD_LOGIC_VECTOR(1 DOWNTO 0); COMPONENT gen PORT ( clk : IN STD_LOGIC; data : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); s : IN STD_LOGIC_VECTOR(1 DOWNTO 0) ); END COMPONENT; constant clk_period :time :=20 ns; BEGIN i1 : gen PORT MAP ( -- list connections between master ports and signals clk => clk, data => data, s => s ); init : PROCESS -- variable declarations BEGIN s<="11";-- code that executes only once WAIT; END PROCESS init; always : PROCESS -- optional sensitivity list -- ( ) -- variable declarations BEGIN wait for clk_period/2; clk<='1'; wait for clk_period/2; clk<='0'; -- code executes for every event on sensitivity list WAIT; END PROCESS always; END gen_arch; 萌新求助~~~哇哇哇~ |
|
相关推荐
1个回答
|
|
好久没看VHDL的代码了,有点看不懂。。。Timing requirements not met应该是没做时序约束导致的。 综合完了以后,Timequest Timing是红色的,时序约束怎么做去网上查查吧。要是功能没那么复杂,不做约束也行,就别管Timing requirements not met了。另外我看你的仿真波形,UUU表示,你都没给信号初值呢。在Testbench里要给用到的信号初值。比如这样: init : PROCESS -- variable declarations BEGIN -- code that executes only once key1<='1'; --按键没有按下 addata<="01000110"; wait for 30_000 ns; key1<='0'; wait for 30_000_000 ns; key1<='1'; WAIT; END PROCESS init; 我也刚搞FPGA没多久,片面看法,坐等大神回答。 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1367 浏览 1 评论
助力AIoT应用:在米尔FPGA开发板上实现Tiny YOLO V4
1046 浏览 0 评论
2442 浏览 1 评论
2146 浏览 0 评论
矩阵4x4个按键,如何把识别结果按编号01-16(十进制)显示在两个七段数码管上?
2408 浏览 0 评论
1898 浏览 50 评论
6018 浏览 113 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 02:53 , Processed in 0.630093 second(s), Total 70, Slave 52 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号