⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mistake.vhd

📁 多个Verilog和vhdl程序例子
💻 VHD
字号:
-- Demonstrates latch warning 
-- caused by missed assignment in case "two"
-- This warning message will help you find a functional
-- error even before simulation!
library ieee;
use ieee.std_logic_1164.all;
entity mistake is
   port (inp:        in  std_logic_vector(1 downto 0);
         outp:       out std_logic_vector(3 downto 0);
         even,odd:   out std_logic);
end mistake;
architecture behave of mistake is
   constant zero:  std_logic_vector(1 downto 0):= "00";
   constant one:   std_logic_vector(1 downto 0):= "01";
   constant two:   std_logic_vector(1 downto 0):= "10";
   constant three: std_logic_vector(1 downto 0):= "11";
   begin
   process (inp) begin
      case inp is
         when zero =>
               outp <= "0001";
               even <= '1';
               odd <= '0';
         when one =>
               outp <= "0010";
               even <= '0';
               odd <= '1';
         when two =>
               outp <= "0100";
               even <= '1';
--             odd <= '0'; Notice that "odd" is not assigned
         when three =>
               outp <= "1000";
               even <= '0';
               odd <= '1';
      end case;
   end process;
end behave;








⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -