VHDL8:同一个quartusII工程下调用两个vhd文件并仿真

目录

1. 示例说明

2. add_single.vhd源码

3. add_total.vhd源码

4. 运行结果

5. 功能仿真结果

6. 调用关系解析


1. 示例说明

本例是一个quartus II的工程下有两个vhd文件,其中一个调用另一个的过程。

两个vhd文件:

         add_single.vhd

         add_total.vhd

其中实现的是在add_total.vhd文件中多次调用add_single的过程。

工程名称是add_total调用关系如下:

 

2. add_single.vhd源码

 

源码如下:

LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL;

USE IEEE.STD_LOGIC_UNSIGNED.ALL;

entity add_single is

port(

         X                : in STD_LOGIC;

         Y                : in STD_LOGIC;

         C_in : in STD_LOGIC;

         Sum           : out STD_LOGIC;

         C_out       : out STD_LOGIC);

end add_single;

architecture behav of add_single is

begin

         process(X, Y, C_in)

                   begin       

                            Sum <= (X xor Y) xor C_in;

                   C_out <= (X and Y) or (C_in and X) or (C_in and Y);         

         end process;

end behav;

3. add_total.vhd源码

 

源码如下:

LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL;

USE IEEE.STD_LOGIC_UNSIGNED.ALL;

entity add_total is

port(

         X                : in STD_LOGIC_VECTOR(1 downto 0);

         Y                : IN STD_LOGIC_VECTOR(1 downto 0);

         C_in : in STD_LOGIC;

         Sum           : out STD_LOGIC_VECTOR(1 downto 0);

         C_out       : out STD_LOGIC);

end add_total;

architecture behav of add_total is

component add_single

         port(

                   X: in STD_LOGIC;

                   Y: in STD_LOGIC;

                   C_in: in STD_LOGIC;

                   Sum: out STD_LOGIC;

                   C_out: out STD_LOGIC

         );

end component;

signal C_temp: std_logic;

begin

         A1: add_single

         port map(X(0), Y(0), C_in, Sum(0), C_temp);

         A2: add_single

         port map(X(1), Y(1), C_in, Sum(1), C_out);

end behav;

4. 运行结果

 

5. 功能仿真结果

 

6. 调用关系解析

 

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WendyWJGu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值