-- STD_LOGIC_SIGNED --
-- A set of signed arithmetic, conversion, and comparison .......--
-- functions for STD_LOGIC_VECTOR. --
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
entity counter is
port
(
c, clr : in std_logic;
q : out std_logic_vector(3 downto 0)
);
end counter;
architecture archi of counter is
signal tmp: std_logic_vector(3 downto 0);
begin
process (c, clr)
begin
if (clr='1') then
tmp <= "0000";
elsif (c'event and c='1') then
tmp <= tmp + 1;
end if;
end process;
q <= tmp;
end archi
تا پیش از Verilog 2001، کد معادلی برای کد بالا در Verilog وجود نداشت، زیرا Verilog-95 از مقادیر علامت دار پشتیبانی نمی کرد و این وظیفه برنامه نویس (من) بود که این مسئله را مدیریت کند...
خوب ! منظور ...!
از سال 88، بدون این که فکری کنم که دارم چی کاری می کنم ... فایل های .vhd که می نوشتم با عبارات زیر شروع می شد...
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
خوب! هدف ساده نویسی بود!