Created
March 22, 2019 19:37
-
-
Save Shashi18/d88dedc8d1fbf1c2863e258f1d7f0aeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MUX1(a,b,sel,c); | |
input [3:0] a,b; | |
input sel; | |
output reg [3:0]c; | |
always @(*)begin | |
if(sel==0) | |
c = a; | |
else | |
c = b; | |
end | |
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MUX2(a,b,sel,c); | |
input [7:0] a,b; | |
input sel; | |
output reg [7:0]c; | |
always @(*)begin | |
if(sel==0) | |
c = a; | |
else | |
c = b; | |
end | |
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MUX3(a,b,sel,c); | |
input [7:0] a,b; | |
input sel; | |
output reg [7:0]c; | |
always @(*)begin | |
if(sel==0) | |
c = a; | |
else | |
c = b; | |
end | |
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MUX4(a,b,sel,c); | |
input [7:0] a; | |
input [7:0] b; | |
input sel; | |
output reg [7:0]c; | |
always @(*)begin | |
if(sel==1'b0) | |
c = a; | |
else | |
c = b; | |
end | |
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MUX4(a,b,sel,c); | |
input [7:0] a; | |
input [7:0] b; | |
input sel; | |
output reg [7:0]c; | |
always @(*)begin | |
if(sel==1'b0) | |
c = a; | |
else | |
c = b; | |
end | |
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MUX4(a,b,sel,c); | |
input [7:0] a; | |
input [7:0] b; | |
input sel; | |
output reg [7:0]c; | |
always @(*)begin | |
if(sel==1'b0) | |
c = a; | |
else | |
c = b; | |
end | |
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MUX4(a,b,sel,c); | |
input [7:0] a; | |
input [7:0] b; | |
input sel; | |
output reg [7:0]c; | |
always @(*)begin | |
if(sel==1'b0) | |
c = a; | |
else | |
c = b; | |
end | |
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MUX8(a,b,c,d,f,g,sel,e); | |
input [7:0] a; | |
input [7:0] b; | |
input [7:0] c; | |
input [7:0] d; | |
input [7:0] f; | |
input [7:0] g; | |
input [3:0]sel; | |
output reg [7:0]e; | |
always @(*)begin | |
case(sel) | |
4'b1000: | |
e = b; //out | |
4'b0100: | |
e = c; | |
4'b0010: | |
e = d; | |
4'b0001: | |
e = f; | |
4'b0000: | |
e = a; | |
default: | |
e = g; | |
endcase | |
end | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment