VHDL代码如下:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
EN
tiTY selector IS
PORT ( CLK : IN STD_LOGIC;
-- DIN : IN STD_LOGIC_VECTOR(7 DOWNTO 0); --输入用下面定义信号代替
POUT : OUT STD_LOGIC_VECTOR(9 DOWNTO 0);
FOUT : OUT STD_LOGIC_VECTOR(31 DOWNTO 0) );
END selector;
ARCHITECTURE behav OF selector IS
SIGNAL FOUT_R : STD_LOGIC_VECTOR(31 DOWNTO 0);
SIGNAL POUT_R : STD_LOGIC_VECTOR(15 DOWNTO 0);
SIGNAL CNT : STD_LOGIC_VECTOR(2 DOWNTO 0):="001" ;
SIGNAL DIN : STD_LOGIC_VECTOR(7 DOWNTO 0):="00000001" ; --设定输入初值,用作8位输入值
BEGIN
PROCESS(CLK )
BEGIN
IF CLK'EVENT AND CLK = '1' THEN
CASE CNT IS
WHEN "001" =>FOUT_R(7 DOWNTO 0) <=DIN;CNT<=CNT+1;
WHEN "010" =>FOUT_R(15 DOWNTO 8) <=DIN;CNT<=CNT+1;
WHEN "011" =>FOUT_R(23 DOWNTO 16) <=DIN;CNT<=CNT+1;
WHEN "100" =>FOUT_R(31 DOWNTO 24) <=DIN;CNT<=CNT+1;
WHEN "101" =>POUT_R(7 DOWNTO 0) <=DIN;CNT<=CNT+1;
WHEN "110" =>POUT_R(15 DOWNTO 8) <=DIN;CNT<="001";
WHEN OTHERS =>CNT<="001";
END CASE;
END IF;
END PROCESS;
POUT<=POUT_R(9 DOWNTO 0);
FOUT<=FOUT_R;
END behav;
Warning: Design contains 1 input pin(s) that do not drive logic
Warning (15610): No output dependent on input pin "clk"
编译器警告:输出不依赖输入信号“CLK”。 下载
芯片验证也是CLK信号没有任何作用,即使没给CLK脉冲信号,case里的6个赋值语句都动作了。
小弟编程水平有限,不懂程序这样设计是否正确,
请求大神帮忙指点,小弟在此谢过!!
一周热门 更多>