想将信号d扩展20个脉宽输出 用VHDL语言怎么实现?以下是自己的代码 但是编译有错 纠结了半天!
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity count5 is
port(clk,d:in std_logic;
q:out std_logic);
end;
architecture rtl of count5 is
signal q1:std_logic_vector(4 downto 0);
signal q2:std_logic;
signal q3:std_logic;
signal q4:std_logic;
begin
process(clk,q2,q3)
begin
if q2='1' then
q1<="00000";
elsif clk'event and clk='1' then
if q1="10100" then
q4<='1';
else
q1<=not q1;
end if;
end if;
end process;
process(clk,d)
begin
if clk'event and clk='1' then
if d='1' then
q2<='1';
q3<='1';
else
q2<='0';
end if;
end if;
end process;
q<='1' when q4='1' else
'0' when q3='1' else
'Z';
end rtl;
想得到的效果如下: |