Download presentation
Presentation is loading. Please wait.
1
Cascading 1-Bit Comparators
Discussion D7.0
2
A 1-Bit Comparator The variable Gout is 1 if Gin = 1 or if Ein = 1 and x > y. The variable Eout is 1 if Ein = 1 and x = y.
3
module comp4 ( x, y, gt, eq, lt );
input [3:0] x ; wire [3:0] x ; input [3:0] y ; wire [3:0] y ; output lt ; wire lt ; output gt ; wire gt ; output eq ; wire eq ; A 4-Bit Comparator x y lt
4
A 4-Bit Comparator wire [4:0] G; wire [4:0] E; assign G[4] = 0;
lt wire [4:0] G; wire [4:0] E; assign G[4] = 0; assign E[4] = 1; assign gt = G[0]; assign eq = E[0]; assign lt = ~(G[0] | E[0]);
5
comp1bit U3(.xi(x[3]) ,.yi(y[3]) ,.Ein(E[4]) ,
.Eout(E[3]) ,.Gin(G[4]) ,.Gout(G[3]) );
6
comp1bit U3(.xi(x[3]) ,.yi(y[3]) ,.Ein(E[4]) ,
.Eout(E[3]) ,.Gin(G[4]) ,.Gout(G[3]) );
7
comp1bit U3(. xi(x[3]) ,. yi(y[3]) ,. Ein(E[4]) ,. Eout(E[3]) ,
comp1bit U3(.xi(x[3]) ,.yi(y[3]) ,.Ein(E[4]) ,.Eout(E[3]) , .Gin(G[4]) ,.Gout(G[3]) ); comp1bit U2(.xi(x[2]) ,.yi(y[2]) ,.Ein(E[3]) ,.Eout(E[2]) , .Gin(G[3]) ,.Gout(G[2]) ); comp1bit U1(.xi(x[1]) ,.yi(y[1]) ,.Ein(E[2]) ,.Eout(E[1]) , .Gin(G[2]) ,.Gout(G[1]) ); comp1bit U0(.xi(x[0]) ,.yi(y[0]) ,.Ein(E[1]) ,.Eout(E[0]) , .Gin(G[1]) ,.Gout(G[0]) ); endmodule
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.