在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1765|回复: 0

大家都来帮我看看这个程序!!!!

[复制链接]
发表于 2007-8-30 16:20:15 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
这是8位ALU程序,  在Quartus 11中运行,有几个错误,请大家来帮忙好吗!!  谢谢大家了!!!


LIBRARY    IEEE;
USE   IEEE.STD_LOGIC_1164.ALL;
USE   IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY   ALU181  IS
PORT(S:IN  STD_LOGIC_VECTOR(3 DOWNTO 0);
     A,B : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
     F : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
     COUT : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
     M,CN : IN STD_LOGIC;
     CO,FZ: OUT STD_LOGIC);
END ALU181;
ARCHITECTURE behav OF ALU181 IS
SIGNAL A9,B9,F9: STD_LOGIC_VECTOR(8 DOWNTO 0);
BEGIN
A9 <= '0' & A ; B9 <= '0' & B ;
PROCESS (M,CN,A9,B9)
BEGIN
CASE S IS
WHEN"0000"=>IF M='0' THEN F9<=A9+CN;ELSE F9<=NOT A9;END IF;
WHEN"0001"=>IF M='0' THEN F9<=(A9 OR B9)+CN;ELSE F9<=NOT(A9 OR B9);
     END IF;
WHEN"0010"=>IF M='0' THEN F9<=(A9 OR (NOT B9))+CN;
     ELSE F9<=(NOT A9)AND B9;END IF;
WHEN"0011"=>IF M='0' THEN F9<="000000000"-CN;ELSE F9<="000000000";
     END IF;
WHEN"0100"=>IF M='0' THEN F9<=A9+(A9 AND NOT B9)+CN;
     ELSE F9<=NOT(A9 AND B9);END IF;
WHEN"0101"=>IF M='0' THEN F<=(A9 OR B9)+(A9 AND NOT B9)+CN;
     ELSE F9<=NOT B9;END IF;
WHEN"0110"=>IF M='0' THEN F9<=A9 -B9 - CN;ELSE F9<=A9 XOR B9;END IF;
WHEN"0111"=>IF M='0' THEN F9<=(A9 AND (NOT B9)) -CN;
     ELSE F9<=A9 AND(NOT B9); END IF;
WHEN"1000"=>IF M='0' THEN F9<=A9 + (A9 AND B9)+CN;
     ELSE F9<=(NOT A9) OR B9; END IF;
WHEN"1001"=>IF M='0' THEN F9<=A9+B9+CN;ELSE F9<=NOT(A9 XOR B9);
     END IF;
WHEN"1010"=>IF M='0' THEN F9<=(A9 OR(NOT B9))+(A9 AND B9)+CN;
     ELSE F9<=B9; END IF;
WHEN"1011"=>IF M='0' THEN F9<=(A9 AND B9) - CN; ELSE F9<=A9 AND B9;
     END IF;
WHEN"1100"=>IF M='0' THEN F9<=A9 + A9 + CN; ELSE F9<="000000001";
     END IF;
WHEN"1101"=>IF M='0' THEN F9<=(A9 OR B9)+A9+CN;
     ELSE F9<=A9 OR (NOT B9); END IF;
WHEN"1110"=>IF M='0' THEN F9<=(A9 OR(NOT B9))+A9+CN; ELSE F9<=A9
     OR B9; END IF;
WHEN"1111"=>IF M='0' THEN F9<=A9-CN; ELSE F9<=A9; END IF;
WHEN OTHERS =>F9<="000000000";
END CASE;
    IF(A9=B9) THEN FZ <='0'; END IF;
       END PROCESS;
    F<=F9(7 DOWNTO 0); CO <= F9(8);
    COUT <="0000" WHEN F9(8)='0' ELSE "0001";
END behav;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-11-17 06:38 , Processed in 0.011977 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表