首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >32位ALU在VHDL中的实现

32位ALU在VHDL中的实现
EN

Stack Overflow用户
提问于 2015-03-16 10:34:56
回答 1查看 1.6K关注 0票数 0

我正在用VHDL实现32位ALU。我发现了一个错误。我不明白我为什么要得到这个。在“对象out_alu”中不能更新“

代码语言:javascript
复制
 library IEEE;
 use IEEE.STD_LOGIC_1164.ALL;
 ----==== Entity of AlU with input and Output 
 entity AlU is  Port (
   A : in  STD_LOGIC_VECTOR (31 downto 0);       ---== A input   Vector with 32 Bit 
   B : in  STD_LOGIC_VECTOR (31 downto 0);       ---== B input   Vector with 32 Bit 
   S : in  STD_LOGIC_VECTOR (2 downto 0) ;       ---== S select  Input Vector 3 bit for operation  
   out_AlU : in  STD_LOGIC_VECTOR (31 downto 0));---== Output of AlU 32 
 end AlU;

 architecture Behavioral of AlU is
 begin

 Select_for_operation: Process (S)   ---= Deffierent  Process for AlU with the     selection of S
                  begin
                                Case S is  
                                when     "000" =>  
                                          out_AlU <=A xor  B ;
                                when   "001"=> 
                                          out_AlU <=A Xnor B ;
                                when   "100"=> 
                                          out_AlU <=A  or  B ; 
                                when   "101"=> 
                                         out_AlU  <=A  nor B ;
                                when   "110"=> 
                                         out_AlU  <=A  and B ;
                                when    others => 
                                                    NULL ;      
                                end case ;
                        end Process ;
 end Behavioral;
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-16 10:43:55

您的信号out_ALU被声明为实体的输入。这就是为什么你不能给它分配一个信号的原因(只能这样说)。

将其更改为out,它可能会编译:

代码语言:javascript
复制
 entity AlU is  Port (
   A : in  STD_LOGIC_VECTOR (31 downto 0);       ---== A input   Vector with 32 Bit 
   B : in  STD_LOGIC_VECTOR (31 downto 0);       ---== B input   Vector with 32 Bit 
   S : in  STD_LOGIC_VECTOR (2 downto 0) ;       ---== S select  Input Vector 3 bit for operation  
   out_AlU : out  STD_LOGIC_VECTOR (31 downto 0));---== Output of AlU 32 
 end AlU; 
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29074649

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档