|
module adder(a,b,sum,cin,co);
% [: q3 r1 A% |" I& i input[3:0] a,b; //input a,b;//input[14:0] a,b;
Y n. G. g3 d+ c! E3 k5 v input cin;5 }. w# x. d4 J; x$ d5 k0 ~ r
output[3:0] sum; //output sum;//output[14:0] sum;
+ k% D5 J& m. W# S/ { output co;/ `# e/ [2 t( b3 n4 z" E/ Y
assign {co,sum}=a+b+cin;7 o% [* A. @+ @0 V* p1 w$ J* R
endmodule
6 S" K/ a: _3 h' A$ Z) D//# H) z W: _8 a% T# ]3 I
module subber(a,b,sub,cin,co);
, h- C5 O$ d3 F5 h input[3:0] a,b; //input a,b;//input[14:0] a,b;
8 P* @/ b. N. K. c input cin;
2 H6 o' k, u4 ? output[3:0] sum; //output sum;//output[14:0] sum;6 c: Q y# X$ q
output co;
% U' X: y5 t0 i1 o9 d assign {co,sum}=a-b-cin;
j. e) Z4 j( @( G" D0 @. } zendmodule9 [ S" u8 o' V) d* l' T& F
' K5 _9 j) b0 w! x( S% I
/***replace these wrods in//...//***/
# W" a/ b6 a& A8 v. c l |
|