[an error occurred while processing this directive]
|
module sum(a, b, addnsub, res);
input addnsub;
input [7:0] a;
input [7:0] b;
output [8:0] res;
reg [8:0] res;
always @(a or b or addnsub)
begin
if (addnsub)
res = a + b;
else
res = a - b;
end
endmodule
module add_sub(a, b, c, d, addnsub, res_a, res_b);
input addnsub;
input [7:0] a;
input [7:0] b;
input [7:0] c;
input [7:0] d;
output [8:0] res_a;
output [8:0] res_b;
sum sum_a (
.addnsub (addnsub),
.a (a),
.b (b),
.res (res_a)
);
sum sum_b (
.addnsub (addnsub),
.a (c),
.b (d),
.res (res_b)
);
endmodule
E-mail: info@telesys.ru