VHDL语言和C语言区别大吗
发布网友
发布时间:2023-05-17 06:48
我来回答
共1个回答
热心网友
时间:2023-10-05 03:26
我学过一点VHDL语言,区别还是挺大的,VHDL是一种硬件描述语言,跟C语言的语法规则的区别很大,给你一个示例看看吧,你自己体会一下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity CNT10 is
port(CLK,RST,EN,LOAD: in std_logic;
DATA: in std_logic_vector(3 downto 0);
DOUT: out std_logic_vector(3 downto 0);
COUT: out std_logic
);
end CNT10;
architecture behav of CNT10 is
begin
process(CLK,RST,EN,LOAD)
variable Q : std_logic_vector(3 downto 0);
begin
if RST='1'then Q:=(others=>'0');
elsif CLK'event and CLK='1'then
if EN='1'then
if(LOAD='1')then Q:=DATA;else
if Q<9 then Q:=Q+1;
else Q:=(others=>'0');
end if;
end if;
end if;
end if;
if Q="1001"then COUT<='1';
else COUT<='0';
end if;
DOUT<=Q;
end process;
end behav;