Signals VHDL程序计数器,多常数驱动程序错误

Signals VHDL程序计数器,多常数驱动程序错误,signals,components,vhdl,program-counter,Signals,Components,Vhdl,Program Counter,我目前正试图设计一个程序计数器(PC)使用以前的组件。 我设计的模型是这样的 im遇到的问题是将我的MUX组件连接到PC寄存器组件。 我应该使用给定的信号,但我不知道如何准确地连接它们。目前,在编译时,我收到 错误(10028):无法在PC_update.vhd(52)处解析网络“PC_next[31]”的多个常量驱动程序 错误(10028):无法在PC_update.vhd(52)解析网络“PC_next[14]”的多个常量驱动程序 错误(10029):pc_更新时的常量驱动程序。vhd(6

我目前正试图设计一个程序计数器(PC)使用以前的组件。 我设计的模型是这样的

im遇到的问题是将我的MUX组件连接到PC寄存器组件。 我应该使用给定的信号,但我不知道如何准确地连接它们。目前,在编译时,我收到

错误(10028):无法在PC_update.vhd(52)处解析网络“PC_next[31]”的多个常量驱动程序

错误(10028):无法在PC_update.vhd(52)解析网络“PC_next[14]”的多个常量驱动程序

错误(10029):pc_更新时的常量驱动程序。vhd(63)

错误:无法详细说明顶级用户层次结构

我知道这是因为我有两个组件试图写入相同的信号,这是错误的,我只是不知道我应该如何修复它。感谢您的帮助

这是我得到的代码,我的实现从第41行的begin语句开始

library ieee ;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

---------------------------------------------------

entity pc_update is
    port( clk: in std_logic; -- clock
        incH_ldL: in std_logic; -- increment PC = PC + 4 when high,
                                -- load PCInput when low
        PCInput: in std_logic_vector(31 downto 0); -- external input for PC
        InstrAddr: out std_logic_vector(31 downto 0) ); -- instruction address
end entity pc_update;

----------------------------------------------------

architecture pc_update_arch of pc_update is

    component register32 is
        port( clr: in std_logic; -- async. clear
              clk: in std_logic; -- clock
               ld: in std_logic; -- load
                D: in std_logic_vector(31 downto 0); -- data input
                Q: out std_logic_vector(31 downto 0) ); -- data output
    end component register32;

    component mux2to1_32 is
        port( sel: in std_logic; -- selection bit input
               X0: in std_logic_vector(31 downto 0); -- first input
               X1: in std_logic_vector(31 downto 0); -- second input
                Y: out std_logic_vector(31 downto 0)); -- output
    end component mux2to1_32;


    signal PC_current: std_logic_vector(31 downto 0); -- the current state of
                                                      -- PC reg
    signal PC_add_4: std_logic_vector(31 downto 0); -- output from the adder 
    signal PC_next: std_logic_vector(31 downto 0); -- output from the MUX

    begin

        PC: register32 Port Map(  --32 bit register
           clk => '1', 
            ld => '1',  
             D => PC_next, 
             Q => PC_Current 
           );

       MUX: mux2to1_32 Port Map(  -- 32 bit multiplexor
          sel => incH_ldL, 
           X0 => PCInput ,
           X1 => PC_add_4,
            Y =>  PC_next 
         );


    PC_add_4 <= (PC_current + 4);

    process (incH_ldL, clk, PC_next, PC_current)
        begin
        if rising_edge(clk) then
            if  (incH_ldL = '0') then
                PC_next <= PCInput;
            else PC_next  <= PC_add_4;
            end if;
        end if; 
        InstrAddr <= PC_current;    
    end process;

end architecture pc_update_arch; 
ieee库;
使用ieee.std_logic_1164.all;
使用ieee.std_logic_arith.all;
使用ieee.std_logic_unsigned.all;
---------------------------------------------------
实体pc_更新为
端口(时钟:标准_逻辑中——时钟
英寸低密度脂蛋白:在标准逻辑中——当高时,增量PC=PC+4,
--低时加载PCI输入
PCInput:标准逻辑向量(31到0);--PC的外部输入
InstrAddr:out std_logic_vector(31到0));--指令地址
终端实体pc_更新;
----------------------------------------------------
pc_更新的架构pc_更新的架构是
组件寄存器32是
端口(clr:标准逻辑中--async.clear
时钟:在标准逻辑中;--时钟
ld:在标准逻辑中;--加载
D:标准逻辑向量(31到0);--数据输入
Q:out标准逻辑向量(31到0));--数据输出
终端组件寄存器32;
组件mux2to1_32为
端口(sel:在标准_逻辑中;--选择位输入
X0:标准逻辑向量(31向下至0);--第一个输入
X1:标准逻辑向量(31向下至0);--第二输入
Y:输出标准逻辑向量(31到0));--输出
端部组件mux2to1_32;
信号PC_电流:标准逻辑_矢量(31向下至0);--现状
--PC注册
信号PC_添加_4:std_逻辑_向量(31向下至0);--加法器的输出
信号PC_next:std_逻辑_向量(31向下至0);--多路复用器的输出
开始
PC:寄存器32端口映射(--32位寄存器
clk=>“1”,
ld=>“1”,
D=>PC_下一步,
Q=>PC\U电流
);
MUX:mux2to1_32端口映射(--32位多路复用器
sel=>英寸低密度脂蛋白,
X0=>PCInput,
X1=>PC_添加_4,
Y=>PC\U下一步
);

PC_add_4您的进程和
MUX
实例做几乎相同的事情(假设您的
mux2to1_32
按指定方式工作)。然而,该进程会产生一个已注册的输出(因为它只作用于时钟边缘)。您需要删除其中一个


请注意,对于您的流程,
incH_ldL
PC_next
不需要在敏感度列表中,因为您仅在
clk
有事件(已在敏感度列表中)时查看它们<如果
Instr\u addr有两个PC\u下一个驱动程序,那么code>PC\u current
也可以取出:带有输出Y的mux和您的进程。。。您应该决定是使用实体还是简单的短流程。您的代码仍然不是一个最小的、完整的、可验证的示例,没有显示register32和mux2to1_32的实体体系结构对。该过程实际上执行与mux2to1_32相同的功能,并且可以消除(或者可以消除标记为MUX的组件实例化)。这在您先前删除的问题中存在。一位帮助我的用户让我写了一篇新帖子,但我发现页面变得非常凌乱,难以阅读。我决定省略mux和register32的代码,因为另一个用户似乎不需要它们,我正试图保持这一个尽可能干净。谢谢你的洞察力。我从未停下来注意到这个过程实际上是没有必要的。我想我对语言的新鲜感正在显现,我只是假设我需要明确地陈述我想要发生的事情。是的,我确实想使用组件,因为这是一个更大项目的一部分,有点像乐高积木。我移动了InstrAddr,我假设这是因为我为clr、clk和ld设置了值。我之前这样做是为了修复“已使用但未声明”的错误。当我编写register32时,这些值在模拟中是受控的,所以我不确定将它们设置为什么。所以我保留了clr=>0,并使clk=>clk,现在我的值是正确的。现在,在将管脚映射到硬件之后,这仍然有效吗?
library ieee ;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

---------------------------------------------------

entity register32 is port( 
clr: in std_logic; -- async. clear
clk: in std_logic; -- clock
 ld: in std_logic; -- load
  D: in std_logic_vector(31 downto 0); -- data input
  Q: out std_logic_vector(31 downto 0) ); -- data output
end entity register32;

----------------------------------------------------

architecture register32_arch of register32 is

begin 
    process(clk, clr)
    begin
        if clr = '1' then
            q <= x"00000000";
        elsif rising_edge(clk) then
           if ld = '1' then
                q <= d;
           end if;
        end if;
    end process;
END register32_arch;
library ieee ;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

---------------------------------------------------

entity mux2to1_32 is
port( sel: in std_logic; -- selection bit input
X0: in std_logic_vector(31 downto 0); -- first input
X1: in std_logic_vector(31 downto 0); -- second input
Y: out std_logic_vector(31 downto 0)); -- output

end entity mux2to1_32;

----------------------------------------------------

architecture mux2to1_32_arch of mux2to1_32 is
begin

    Y <= X1 when (SEL = '1') else X0;

end architecture mux2to1_32_arch; 
architecture pc_update_arch of pc_update is
    signal PC : std_logic_vector(31 downto 0):=(others=>'0');
begin
    process (clk)
        begin
        if rising_edge(clk) then
            if  (incH_ldL = '0') then
                PC <= PCInput;
            else
                PC <= PC + 4;
            end if;
        end if; 

    end process;
    InstrAddr <= PC;
end architecture pc_update_arch;