📄 componentslib.vhd
字号:
---------------------------------------------------------------------------
---------------------------------------------------------------------------
--组原 Group 6;
--顶层数据包
--将各个模块(ALU,Q_REG,RAM_REGS,SRC_OP,OUT_MUX)进行实例化,以供顶层主体使用
----------------------------------------------------------------------------
----------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
package componentslib is
component ram_regs
port(
w_ctl : in std_logic; --字/字节控制信号;
clk,rst : in std_logic;
a,b : in std_logic_vector(3 downto 0); --A,B地址;
f1 : in std_logic_vector(15 downto 0); --存储数据;
dest_ctl : in std_logic_vector(3 downto 0); --数据输出控制信号;
ram_0,ram_7,ram_15
: in std_logic;
ram0,ram7,ram15 : out std_logic;
ad,bd : buffer std_logic_vector(15 downto 0) --从通用寄存器组取出的数据;
);
end component;
component alu
port (
w_ctl : in std_logic;
r,s : in std_logic_vector( 15 downto 0);
c_n : in std_logic; --最低位进位
alu_ctl : in std_logic_vector( 3 downto 0); --运算选择
f1 : buffer std_logic_vector( 15 downto 0);
f2 : buffer std_logic_vector( 15 downto 0);
c_n_32, c_n_16, c_n_8, ovr, zero, sign
: buffer std_logic
);
end component;
component out_mux
port (
ad, f1 : in std_logic_vector ( 15 downto 0); --数据来源;
dest_ctl : in std_logic_vector ( 3 downto 0); --输出控制信号;
y : buffer std_logic_vector ( 15 downto 0) --运算器输出端;
);
end component;
component q_reg
port(
w_ctl : in std_logic; --字/字节控制信号;
clk,rst,load : in std_logic; --寄存器控制信号:时钟,清零,加载;
f1 : in std_logic_vector(15 downto 0); --数据输入;
f2 : in std_logic_vector(15 downto 0); --数据输入;
dest_ctl : in std_logic_vector(3 downto 0); --数据选择控制信号;
qs_0,qs_7,qs_15 : in std_logic;
qs0,qs7,qs15 : out std_logic;
q : buffer std_logic_vector(15 downto 0) --寄存器当前值;
);
end component;
component src_op
port (
d, ad, bd, q : in std_logic_vector ( 15 downto 0); --数据来源;
src_ctl : in std_logic_vector (3 downto 0); --数据源选择控制信号;
r, s : buffer std_logic_vector ( 15 downto 0) --最终参加运算的两个数据;
);
end component;
end componentslib;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -