Showing posts with label COMPARATORS. Show all posts
Showing posts with label COMPARATORS. Show all posts
Thursday, January 26, 2023
TWO i/p (2bitwide) COMPARATOR:-
module comp2(gt2,eq2,lt2,A2,B2);
input[1:0]A2,B2;
output gt2,eq2,lt2;
wire [2:0]Y1;
wire a,b,c,d,e,f;
comp1 c1 (a,b,c,A2[1],B2[1]);
comp1 c2 (d,e,f,A2[0],B2[0]);
mux2x1_3b m1 ({gt2,eq2,lt2},a,Y1,3'b100);
mux2x1_3b m2 (Y1,c,{d,e,f},3'b001);
endmodule
TEST BENCH:-
Friday, January 20, 2023
TWO BIT COMPARATOR:-
(one bit wide)
module comp1 (gt,eq,lt,a,b);
input a,b;
output gt,eq,lt;
not G1(abar,a);
not G2(bbar,b);
and G3(gt,a,bbar);
and G4(lt,abar,b);
xnor G5(eq,a,b);
endmodule
TEST BENCH:-
module comp1_tb();
reg a,b;
wire gt,eq,lt;
comp1 dut (gt,eq,lt,a,b);
initial
begin
repeat(20)
begin
a=$random;
b=$random;
#1;
$display(a,b,":",gt,eq,lt);
end
end
endmodule
Subscribe to:
Posts (Atom)
VERILOG CODES :-
VERILOG CODES :- (by NUTAN.K) COMBINATIONAL :- 1.MUX:- (one bit wide) 1a) 2:1 MUX and its Testbench 1b) 4:1 MUX using 2:1 and its testb...
-
AUTOMATIC STREET LIGHTS:- In our daily life we see glowing of street lights even though there is sufficient light outside.There is a ...
-
TWO i/p (8bitwide) COMPARATOR:- module comp8 (gt8,eq8,lt8,A8,B8); input[7:0]A8,B8; output gt8,eq8,lt8; wire [2:0]Y22; wire a8,b8,c8,d8,...