Board logo

标题: [求助]关于vhdl中元件调用的问题 [打印本页]

作者: Monoceros    时间: 2008-10-10 13:14     标题: [求助]关于vhdl中元件调用的问题

我想编一个加法器和减法器集成的程序,但似乎掉用元件的语句属于并行,而process是串行的,怎么处理呢,我需要一个if来作筛选

library ieee;
use ieee.std_logic_1164.all;
entity plus is
port(
judge: in std_logic;
oper1,oper2:in std_logic_vector(3 downto 0);
result1,result2ut std_logic_vector(3 downto 0);
rout1,rout2ut std_logic);
end entity plus;
architecture a of plus is
component adder
port(
a,b:in std_logic_vector(3 downto 0);
sut std_logic_vector(3 downto 0);
coutut std_logic);
end component;
component minus
port(
a,b:in std_logic_vector(3 downto 0);
sut std_logic_vector(3 downto 0);
coutut std_logic);
end component;
begin
u1:adder port map(a=>oper1,b=>oper2,s1=>result,cout1=>rout);
u1:minus port map(a=>oper1,b=>oper2,s2=>result,cout2=>rout);
end a;

[此贴子已经被作者于2008-10-10 13:14:39编辑过]


作者: caopengly    时间: 2008-10-10 21:29

楼主可以用一个标志位来做选择,比如当为1时加法器开通,当为0时减法器打通。




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0