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...
-
THE STORY BEHIND 15TH SEPTEMBER --- NUTAN SATYA SAI RAJ .K Every story has a hero. The hero of our story is Sir Mokshagundam...
-
WHY A STEP-UP TRANSFORMER CANT BE USED AS AN AMPLIFIER? As you can see in the above figure, for a step-up transformer the amplitude o...
.png)
.png)