DSDV Programs
DSDV Programs
endmodule
module halfadd(a,b,sum,carry);
input a,b;
output sum,carry;
assign sum= a ^ b;
assign carry = a & b;
endmodule
module halfsub(a,b,diff,borr);
input a, b;
output diff,borr;
assign diff= a ^ b;
assign borr= ((~a) & b);
endmodule
module fullsub(a,b,c,diff,borr);
input a,b,c;
output diff,borr;
assign diff= a ^ b ^ c;
assign borr= ((~a)&b) | ((~a) &c) | (b & c);
endmodule
case (b)
4’b0000:e=4’b0011;
6) Verilog program for 2 bit magnitude comparator
module comp (a b, lt, gt, et);
input [1:0] a;
input [1:0]b;
output lt, gt, et;
end
endmodule