Half Subtractor (Dataflow Modeling)
Half Subtractor (Dataflow Modeling):
module
half_sub(
input a,
input b,
output diff,
output borrow
);
assign
diff=a^b;
assign
borrow=(~a)&b;
endmodule
Full Subtractor (Dataflow Modeling):
module
full_sub(
input a,
input b,
input c,
output diff,
output borrow
);
assign
x= b^c;
assign
diff = a ^ x;
assign
n1=~c;
assign
y=b & n1;
assign
n2=~x;
assign
z=a & n2;
assign
borrow = y | z;
endmodule
No comments:
Post a Comment