异或

拥有回忆 提交于 2020-02-27 04:13:02

用逻辑图和VHDL语言设计一个异或门

说来也感动,一个学期过去了,终于写了第一个属于自己的代码。虽然十分简单(惭愧)

一、要求

用逻辑图和VHDL语言设计一个异或门

二、代码

	library ieee;
	use ieee.std_logic_1164.all;
	 entity myxor is
	 port(x,y:in std_logic;
			z:out std_logic);
	end myxor;

	architecture one of myxor is
	signal r0,r1,r2,r3:std_logic;
	begin
	r0<=not x;
	r1<=not y;
	r2<=x and r1;
	r3<=y and r0;
	z<=r2 or r3;
	end one;

关于代码

其中signal不能定义在process和subprogram当中(包括function和procedure)中,只可定义在其外部

三、RTL viewer

异或表达式x⊕y=xy(非)+x(非)y

四、电路图

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!