本人是一个CPLD自学者,望大家帮助下!
一3-8译吗器;程序编译就无法通过。顺便问下改程序是否可以用2个IF嵌套,象C的用法一样;
例如:
process (cs,int3)
begin
if (cs = '0')
then
if (int3 = "000")
then
out8 <= "00000001";
:
:
:
---------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity ch_2 is
port(
cs : in std_logic;
in3 : in std_logic_vector(2 downto 0);
out8 : out std_logic_vector(7 downto 0)
);
end ch_2;
architecture a of ch_2 is
begin
p1:process (cs,in3)
if (cs = '0')
then
case in3 is
when "000" => out8<="00000001";
when "001" => out8<="00000010";
when "010" => out8<="00000100";
when "011" => out8<="00001000";
when "100" => out8<="00010000";
when "101" => out8<="00100000";
when "110" => out8<="01000000";
when "111" => out8<="10000000";
when others => out8<="0000000";
else
out8 <= "11111111";
end if;
end process p1;
end a;作者: magicsys 时间: 2003-10-27 13:12 标题: 通过后的程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity ch_2 is
port(
cs : in std_logic;
in3 : in std_logic_vector(2 downto 0);
out8 : out std_logic_vector(7 downto 0)
);
end ch_2;
architecture a of ch_2 is
begin
p1:process (cs,in3)
begin
if (cs = '0')
then
case in3 is
when "000" => out8<="00000001";
when "001" => out8<="00000010";
when "010" => out8<="00000100";
when "011" => out8<="00001000";
when "100" => out8<="00010000";
when "101" => out8<="00100000";
when "110" => out8<="01000000";
when "111" => out8<="10000000";
when others => out8<="0000000";
end case;
else
out8 <= "11111111";
end if;
end process p1;
end a;