abhineet22
Advanced Member level 4
- Joined
- Jan 25, 2005
- Messages
- 105
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,296
- Location
- bangalore
- Activity points
- 1,017
verilog 4:1 mux
. Design a 4:1 mux in Verilog.
Multiple styles of coding. e.g.
Using if-else statements
if(sel_1 == 0 && sel_0 == 0) output = I0;
else if(sel_1 == 0 && sel_0 == 1) output = I1;
else if(sel_1 == 1 && sel_0 == 0) output = I2;
else if(sel_1 == 1 && sel_0 == 1) output = I3;
Using case statement
case ({sel_1, sel_0})
00 : output = I0;
01 : output = I1;
10 : output = I2;
11 : output = I3;
default : output = I0;
endcase
1What are the advantages / disadvantages of each coding style shown above?
2How Synthesis tool will give result for above codes?
3What happens if default statement is removed in case statement?
4What happens if combination 11 and default statement is removed?
. Design a 4:1 mux in Verilog.
Multiple styles of coding. e.g.
Using if-else statements
if(sel_1 == 0 && sel_0 == 0) output = I0;
else if(sel_1 == 0 && sel_0 == 1) output = I1;
else if(sel_1 == 1 && sel_0 == 0) output = I2;
else if(sel_1 == 1 && sel_0 == 1) output = I3;
Using case statement
case ({sel_1, sel_0})
00 : output = I0;
01 : output = I1;
10 : output = I2;
11 : output = I3;
default : output = I0;
endcase
1What are the advantages / disadvantages of each coding style shown above?
2How Synthesis tool will give result for above codes?
3What happens if default statement is removed in case statement?
4What happens if combination 11 and default statement is removed?