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

📄 sub4.vhd

📁 用VHDL语言实现通用计算器设计
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity sub4 is
port(a : in std_logic_vector(3 downto 0);
b : in std_logic_vector (3 downto 0);
ci : in std_logic;
S : out std_logic_vector(3 downto 0);
co :out std_logic);
end sub4;

architecture rt1 of sub4 is
component adder is
port 
(a: in std_logic;
 b: in std_logic;
 ci: in std_logic;
 s : out std_logic;
 co: out std_logic);
end component;
signal btem: std_logic_vector( 3 downto 0);
signal ctem: std_logic_vector( 4 downto 0);
signal stem: std_logic_vector (3 downto 0);
begin
btem(3 downto 0 ) <=not b( 3 downto 0);
ctem(0)<=not ci;
g1: for i in 0 to 3 generate 
add: adder port map (a(i),btem(i),ctem(i),stem(i),ctem(i+1));
end generate;
s(3 downto 0)<=stem( 3 downto 0);
co<= not ctem(4);
end rt1;

⌨️ 快捷键说明

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