完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
LIBRARY IEEE; USE IEEE.std_logic_1164.ALL; USE IEEE.std_logic_unsigned.ALL; USE IEEE.std_logic_arith.ALL; entity ALU is port(cin: in std_logic; alu_function: in std_logic_vector(2 downto 0); a_in: in std_logic_vector(7 downto 0); b_in: in std_logic_vector(7 downto 0); alu_out: out std_logic_vector(7 downto 0); z: out std_logic; c: out std_logic; v: out std_logic; s: out std_logic ); end ALU; Architecture win of ALU is signal midout: std_logic_vector(15 downto 0); signal temp: std_logic_vector(15 downto 0); begin process(a_in,b_in,alu_function) constant ADD:std_logic_vector:="000"; constant SUB:std_logic_vector:="001"; constant ANDOP:std_logic_vector:="010"; constant OROP:std_logic_vector:="011"; constant XOROP:std_logic_vector:="100"; constant SHL:std_logic_vector:="101"; constant SHR:std_logic_vector:="110"; cinextend:="000000000000000"&cin; begin case alu_function is when ADD=>midout<=a_in + b_in + cin; when SUB=>midout<=b_in - a_in; when ANDOP=>midout<=a_in and b_in; when OROP=>midout<=a_in or b_in; when XOROP=>midout<=a_in xor b_in; when SHL=>midout<=b_in(14 downto 0)&"0"; when SHR=>midout<="0"&b_in(15 downto 0); when others=>midout<="ZZZZZZZZZZZZZZZZ"; end case; if(alu_function="000" or "001") if(a_in(15)="1" and b_in(15)="1" and midout(15)="0") or (a_in(15)="0" and b_in(15)="0" and midout(15)="1" ) then V<="1"; else V<="0"; end if; end if; if(alu_function="000") then temp:="1111111111111111"-b_in-cinextend; if temp c<="1"; else c<="0"; end if; else if(alu_function="001") if b_in c<="1"; else c="0"; end if; else if(alu_function="101") c else if(alu_function="110") c<=a_in(0); else c<="0"; end if; end process; alu_out<=midout; end win; 非常感谢 非常感谢 |
|
相关推荐
4个回答
|
|
你可以贴出综合不过 工具给出的提示是什么,有助于大家对你问题的解决。
|
|
|
|
谢谢!已经把错误贴出来了!!求帮助啊!刚学这个,实在搞不大懂 |
|
|
|
给你一个简单的分析吧! 不过于受人渔,不是鱼;
下面一个错误 “Error (10500): VHDL syntax error at alu.vhd(29) near text "cinextend"; expecting "begin", or a declaration statement” 这么一行,说明在alu.vhd文件第29行 ,靠近cinextend 的 begin 或者是上面出问题了。 仔细看看这些部分的代码吧。 查找问题是,必须从最上面第一个开始处理,(因为第一个问题可能会导致下面很多问题,所以...) |
|
|
|
本帖最后由 psi1023 于 2014-4-26 20:21 编辑
camp 发表于 2014-4-16 22:35 大哥,谢谢哈。已经解决了。我现在又出现个问题,就是在做一个cpu。 每个模块编译仿真都是正确的,但采用原理图输入法连在一起后,再检测仿真时对模块的输出检测总是错误,例如节拍器状态转换,本来顺序是100,000,111但现在变成100,XX1,XXX 请问这是为什么??非常感谢 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
求FPGA 驱动控制ltc2271 或者 ltc2180 或者 ltc2190或者 ltc2202 的代码
841 浏览 0 评论
343 浏览 0 评论
求助:遇见诡异问题,FPGA模块A输出端口连接模块B输入后,模块A不能正常工作的
1029 浏览 1 评论
406 浏览 0 评论
966 浏览 1 评论
3888 浏览 89 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-3 07:19 , Processed in 0.687879 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号