📄 dianji.txt
字号:
--错误
--1、Signal信号应该在begin之前;
--2、并行赋值语句不应在process中出现
--3、case语句应包含所有可能情况 (用when others)
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 11:49:28 11/08/2008
-- Design Name:
-- Module Name: cl_dianji - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity ep111 is
Port ( clk : in STD_LOGIC;
reset : in STD_LOGIC;
dir : in STD_LOGIC;
A : out STD_LOGIC;
B : out STD_LOGIC;
C : out STD_LOGIC);
end ep111;
architecture Behavioral of ep111 is
Signal abc : STD_LOGIC_VECTOR(2 DOWNTO 0);
begin
process(clk,reset)
begin
if rising_edge(clk) then
if reset='1' then
abc <= "100";
elsif dir='0' then
case abc is
when "100" => abc <= "110";
when "110" => abc <= "010";
when "010" => abc <= "011";
when "011" => abc <= "001";
when "001" => abc <= "101";
when "101" => abc <= "100";
when others => abc <= "000";
end case;
--
-- abc <= "110" when abc="100" else
-- "010" when abc="110" else
-- "011" when abc="010" else
-- "001" when abc="011" else
-- "101" when abc="001" else
-- "100" when abc="101" else
-- "000";
elsif dir='1' then
case abc is
when "110" => abc <= "100";
when "010" => abc <= "110";
when "011" => abc <= "010";
when "001" => abc <= "011";
when "101" => abc <= "001";
when "100" => abc <= "101";
when others => abc <= "000";
end case;
-- abc <= "101" when abc="100" else
-- "001" when abc="101" else
-- "011" when abc="001" else
-- "010" when abc="011" else
-- "110" when abc="010" else
-- "100" when abc="110" else
-- "000";
end if;
end if;
end process;
A <= abc(2);
B <= abc(1);
C <= abc(0);
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -