谁帮我用CPLD写一个全加器的程序?至少两种方法 选修课作业需要 呜呜 求救啦
1个回答
展开全部
//pattern 1
module FA(a,b,carryin,s,carryout)
input a,b,carryin;
output s,carryout;
assign {carryout,s}=a+b+carryin;
endmodule
//pattern 2
module FA(a,b,carryin,s,carryout)
input a,b,carryin;
output s,carryout;
assign s=a^b^carryin;
assign carryout=(a&b)|(b&carryin)|(a&carryin);
endmodule
module FA(a,b,carryin,s,carryout)
input a,b,carryin;
output s,carryout;
assign {carryout,s}=a+b+carryin;
endmodule
//pattern 2
module FA(a,b,carryin,s,carryout)
input a,b,carryin;
output s,carryout;
assign s=a^b^carryin;
assign carryout=(a&b)|(b&carryin)|(a&carryin);
endmodule
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询