作者tkhan (脑残)
看板Electronics
标题Re: [问题] Verilog的问题??
时间Wed Mar 22 14:44:24 2006
module add8(cin, a, b, s, cout);
input cin;
input[7:0] a,b;
output cout;
output[7:0] s;
wire[6:0] cy;
add fa0(cin,a[0],b[0],s[0],cy[0]);
add fa1(cy[0],a[1],b[1],s[1],cy[1]);
add fa2(cy[1],a[2],b[2],s[2],cy[2]);
add fa3(cy[2],a[3],b[3],s[3],cy[3]);
add fa4(cy[3],a[4],b[4],s[4],cy[4]);
add fa5(cy[4],a[5],b[5],s[5],cy[5]);
add fa6(cy[5],a[6],b[6],s[6],cy[6]);
add fa7(cy[6],a[7],b[7],s[7],cout);
endmodule
module add(cin, a, b, s, cout);
input cin;
input a, b;
output cout;
output s;
assign {cout,s} = a + b + cin;
endmodule
//以下为简易写法
module add8(cin, a, b, s, cout);
input cin;
input [7:0] a, b;
output cout;
output [7:0] s;
assign {cout,s} = a + b + cin;
endmodule
//我是来赚p币的
//错了别打我..
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.66.243.100
1F:推 padon:谢谢大大...问题解决了^^ 03/22 15:25