概述
行为描述方法实现
--二输入与门
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY and2 IS
PORT(a,b:IN STD_LOGIC;
c:OUT STD_LOGIC);
END and2;
ARCHITECTURE and2_behavior OF and2 IS
BEGIN
c<= a AND b;
END and2_behavior;
--二输入或门
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY or2 IS
PORT(a,b:IN STD_LOGIC;
c:OUT STD_LOGIC);
END or2;
ARCHITECTURE or2_behavior OF or2 IS
BEGIN
c<=a OR b;
END or2_behavior;
--非门
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY not_gate IS
PORT(a:IN STD_LOGIC;
f:OUT STD_LOGIC);
END not_gate;
ARCHITECTURE not_gate_behavior OF not_gate IS
BEGIN
f<= NOT a;
END not_gate_behavior;
数据流描述方法
--二输入与门
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY and2 IS
PORT(a,b:IN STD_LOGIC;
c:OUT STD_LOGIC);
END and2;
ARCHITECTURE and2_behavior OF and2 IS
BEGIN
PROCESS(a,b)
VARIABLE comb:STD_LOGIC_VECTOR(0 TO 1);
BEGIN
comb:= a&b;
CASE comb IS
WHEN "00" => c<='0';
WHEN "01" => c<='0';
WHEN "10" => c<='0';
WHEN "11" => c<='1';
WHEN OTHERS => c<='Z';
END CASE;
END PROCESS;
END and2_behavior;
--二输入或门
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY or2 IS
PORT(a,b:IN STD_LOGIC;
c:OUT STD_LOGIC);
END or2;
ARCHITECTURE or2_behavior OF or2 IS
SIGNAL comb:STD_LOGIC_VECTOR(0 TO 1);
BEGIN
comb<= a&b;
WITH comb SELECT
c<= '0' WHEN "00",
'1' WHEN "01",
'1' WHEN "10",
'1' WHEN "11";
'z' WHEN OTHERS;
END or2_behavior;
--非门
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY not_gate IS
PORT(a:IN STD_LOGIC;
f:OUT STD_LOGIC);
END not_gate;
ARCHITECTURE not_gate_behavior OF not_gate IS
BEGIN
f<= '0' WHEN a='1' ELSE
'1' WHEN a='0' ELSE
'Z';
END not_gate_behavior;
最后
以上就是怕黑果汁为你收集整理的VHDL实现与门,或门,非门。行为描述方法实现数据流描述方法的全部内容,希望文章能够帮你解决VHDL实现与门,或门,非门。行为描述方法实现数据流描述方法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复